Installation
Quick Start
Create asource.config.ts file in your project root:
source.config.ts
lib/source.ts
Collections
Fumadocs MDX supports three types of collections:Docs Collection
The most common type, combining both page documents and metadata files:source.config.ts
Doc Collection
For standalone MDX documents without folder metadata:source.config.ts
Meta Collection
For metadata-only collections (JSON/YAML files):source.config.ts
Configuration Options
Collection Options
MDX Preset Options
TheapplyMdxPreset function configures MDX processing with Fumadocs defaults:
source.config.ts
Postprocessing
Control how MDX content is processed and what data is extracted:source.config.ts
Async and Dynamic Loading
Async Loading
Load documents asynchronously for better performance:source.config.ts
load() to access the document body:
app/docs/[[...slug]]/page.tsx
Dynamic Compilation
Compile MDX on-demand for very large documentation sites:source.config.ts
Plugins
Fumadocs MDX includes several built-in plugins:JSON Schema Plugin
Generate JSON schemas for your collections:source.config.ts
Last Modified Plugin
Add last modified timestamps using Git:source.config.ts
Framework Integration
Next.js
Add the plugin tonext.config.mjs:
next.config.mjs
Vite
Add the plugin tovite.config.ts:
vite.config.ts
Node.js
Use the Node.js loader:Bun
Configure the Bun plugin:bunfig.toml
Using the Source
Once configured, use the loader API to access your content:lib/source.ts
app/docs/[[...slug]]/page.tsx
Type Safety
Fumadocs MDX automatically generates TypeScript types for your collections:Workspaces
Organize multiple documentation sites in a monorepo:source.config.ts
Migration from Content Collections
If you’re migrating from Content Collections:- Replace
content-collections.tswithsource.config.ts - Update collection definitions to use
defineDocsordefineCollections - Replace
createMDXSourcewithdocs.toFumadocsSource() - Update your framework integration (Next.js plugin, etc.)