Nextra (Next.js Docs Framework) architecture, MDX, and theme config
Next.js-Based Documentation Framework
Focus: MDX Authoring, File-Based Routing, Theme Configuration
Stack: Next.js 14, Nextra 3, MDX 3, Storybook (optional)
Nextra is a static site generator built on Next.js, optimized for documentation with zero-config MDX and automatic routing.
.mdx files).npm install next nextra nextra-theme-docs react react-dom
next.config.js:
const withNextra = require("nextra")({
theme: "nextra-theme-docs",
themeConfig: "./theme.config.tsx",
});
module.exports = withNextra();
theme.config.tsx (Core Configuration):
import { DocsThemeConfig } from "nextra-theme-docs";
const config: DocsThemeConfig = {
logo: <span>My Docs</span>,
project: {
link: "https://github.com/user/project",
},
docsRepositoryBase: "https://github.com/user/project/tree/main/docs",
footer: {
text: "© 2025 My Company",
},
sidebar: {
defaultMenuCollapseLevel: 1,
},
darkMode: true,
};
export default config;
pages/
├── index.mdx # Homepage
├── _meta.json # Navigation metadata
├── getting-started/
│ ├── installation.mdx
│ └── quickstart.mdx
└── api-reference/
├── functions.mdx
└── classes.mdx
_meta.json (Navigation Config):
{
"index": "Introduction",
"getting-started": "Getting Started",
"api-reference": "API Reference"
}
Tabs, Callouts, Code Blocks:
---