A powerful, embeddable documentation system with built-in search and AI chat capabilities. Perfect for creating beautiful, interactive documentation pages with minimal setup.
- 🎨 Themeable - Customize colors and appearance via
docs.jsonconfiguration - 🔍 Full-text Search - Fast, client-side search with caching
- 🤖 AI Chat - Integrated AI assistant for documentation Q&A
- 📝 MDX Support - Write docs in Markdown with custom components
- đź“‹ Mintlify Compatible - Full support for Mintlify docs.json schema
- 📱 Responsive - Mobile-friendly design with adaptive layouts
npm install react-docs-moduleCreate a docs.json file with your documentation configuration using the Mintlify schema:
{
"$schema": "https://leaves.mintlify.com/schema/docs.json",
"theme": "mint",
"name": "My Documentation",
"description": "Comprehensive documentation for my project",
"logo": {
"dark": "/assets/logo-dark.png",
"light": "/assets/logo-light.png"
},
"favicon": "/assets/favicon.png",
"colors": {
"primary": "#3B82F6",
"light": "#60A5FA",
"dark": "#1D4ED8"
},
"navbar": {
"cta": {
"type": "github",
"url": "https://github.com/your-org/your-repo"
}
},
"navigation": {
"groups": [
{
"group": "Getting Started",
"pages": [
"introduction",
"installation",
"quick-start"
]
},
{
"group": "API Reference",
"pages": [
"api/overview",
"api/authentication"
]
}
]
},
"footer": {
"socials": {
"github": "https://github.com/your-org/your-repo",
"twitter": "https://twitter.com/your-handle"
}
},
"feedback": {
"thumbsRating": true
}
}import { DocumentationLayout, createReactDocsConfig } from 'react-docs-module';
// Create config with defaults or custom overrides
const config = createReactDocsConfig({
basePath: "/docs",
contentPath: "content/docs",
// searchApiPath and aiChatApiPath use defaults
});
export default function DocsPage() {
return (
<DocumentationLayout
config={config}
navigation={navigation}
currentPath="/docs/introduction"
headings={headings}
>
<div>Your documentation content here</div>
</DocumentationLayout>
);
}interface ReactDocsConfig {
basePath: string; // Base URL path for docs
contentPath: string; // Path to MDX content files
searchApiPath: string; // API endpoint for search index
aiChatApiPath: string; // API endpoint for AI chat
}
// Factory function with optional overrides
function createReactDocsConfig(options?: ReactDocsConfigOptions): ReactDocsConfig
interface ReactDocsConfigOptions {
basePath?: string; // Default: "/docs"
contentPath?: string; // Default: "content/docs"
searchApiPath?: string; // Default: "/api/docs/search-index"
aiChatApiPath?: string; // Default: "/api/docs/chat"
}// Use all defaults
const config = createReactDocsConfig();
// Override specific fields
const config = createReactDocsConfig({
basePath: "/documentation",
aiChatApiPath: "/api/custom-chat"
});
// Override all fields
const config = createReactDocsConfig({
basePath: "/my-docs",
contentPath: "docs",
searchApiPath: "/api/search",
aiChatApiPath: "/api/ai-chat"
});The docs.json file uses the complete Mintlify schema for full compatibility:
- Required:
theme,name,colors.primary,navigation - Optional:
description,logo,favicon,navbar,footer,feedback, and more - Migration: Existing Mintlify projects can use their
mint.jsonstructure indocs.json
DocumentationLayout- Main layout wrapper with sidebar and TOCSearch- Search component with AI chat integrationDocsIndex- Documentation index/landing pageDocsSidebar- Navigation sidebarTableOfContents- Page table of contentsDocPagination- Previous/next page navigation
import { DocsThemeProvider, useDocsColors } from 'react-docs-module';
function CustomComponent() {
const colors = useDocsColors();
return (
<div style={{ color: colors.primary }}>
Themed content
</div>
);
}import { streamDocsChatResponse } from 'react-docs-module/chat-api';
// API route example
export async function POST(req: Request) {
const { messages } = await req.json();
return streamDocsChatResponse(
config,
messages,
"You are a helpful documentation assistant.",
async (result) => {
// Handle completion
console.log(result.text);
}
);
}getDocsSidebar(config)- Generate sidebar navigation from docs.jsongetAllDocs(config)- Get all documentation files metadatagetAllDocsContent(config)- Get all documentation content (cached)getDocBySlug(config, slug)- Get specific document by slugbuildSearchIndex(config)- Build search index from contentstreamDocsChatResponse(...)- Stream AI chat responses
ReactDocsConfig- Main configuration interfaceReactDocsConfigOptions- Configuration factory optionsDocsJsonConfig- docs.json configuration schema (Mintlify compatible)ThemeColors- Color theme interfaceModelProvider- AI model provider configuration
// pages/api/search-index.ts
import { buildSearchIndex, createReactDocsConfig } from 'react-docs-module';
const DOCS_CONFIG = createReactDocsConfig({
contentPath: "content/docs"
});
export default async function handler(req, res) {
const searchIndex = await buildSearchIndex(DOCS_CONFIG);
res.json(searchIndex);
}const modelProvider: ModelProvider = {
providerType: 'anthropic',
model: 'claude-3-sonnet',
apiKey: process.env.ANTHROPIC_API_KEY
};
streamDocsChatResponse(config, messages, prompt, callback, modelProvider);/* Use CSS custom properties set by DocsThemeProvider */
.custom-element {
color: var(--docs-primary);
border-color: var(--docs-primary-light);
background-color: var(--docs-primary-dark);
}- React 19+
- TypeScript 5.6+
- Node.js 18+
MIT
Contributions welcome! Please read our contributing guidelines and submit pull requests to the main repository.