Manual Installation
Learn how to integrate Docstra into an existing Next.js project.
Integrating Docstra into an existing Next.js project is straightforward. Follow these steps to get up and running.
Prerequisites
- An existing Next.js project (Version 14 or later recommended).
- Node.js 20 or later.
- Tailwind CSS installed and configured.
Step 1: Install Dependencies
Install the docstra package using your preferred package manager:
Terminal
Step 2: Create Configuration
Create a docstra.config.ts file in the root of your project. This file controls the behavior and appearance of your documentation.
docstra.config.ts
For more information about the configuration, see Configuration.
Step 3: Setup Data Source
Create a lib/source.ts file to initialize the Docstra data source. This will handle loading your MDX files and generating the sidebar.
lib/source.ts
Step 4: Configure MDX Components
Define the components that will be used to render your MDX content in mdx-components.tsx.
mdx-components.tsx
Good to know: You can see our custom MDX Components for more information.
Step 5: Create the docs route
Create a docs route at app/docs/layout.tsx and app/docs/[[...slug]]/page.tsx.
Now add the following code to app/docs/layout.tsx:
app/docs/layout.tsx
Now add the following code to app/docs/[[...slug]]/page.tsx:
app/docs/[[...slug]]/page.tsx
Step 6: Import Styles
Include Docstra's CSS in your app/globals.css file.
app/globals.css
Step 7: Add Content
Create your first documentation page at content/index.mdx:
content/01-index.mdx
Visit /docs in your browser to see your documentation in action!
How is this guide?
Last updated on March 30, 2026