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 overridesconstconfig=createReactDocsConfig({basePath: "/docs",contentPath: "content/docs",// searchApiPath and aiChatApiPath use defaults});exportdefaultfunctionDocsPage(){return(<DocumentationLayoutconfig={config}navigation={navigation}currentPath="/docs/introduction"headings={headings}><div>Your documentation content here</div></DocumentationLayout>);}interfaceReactDocsConfig{basePath: string;// Base URL path for docscontentPath: string;// Path to MDX content filessearchApiPath: string;// API endpoint for search indexaiChatApiPath: string;// API endpoint for AI chat}// Factory function with optional overridesfunctioncreateReactDocsConfig(options?: ReactDocsConfigOptions): ReactDocsConfiginterfaceReactDocsConfigOptions{basePath?: string;// Default: "/docs"contentPath?: string;// Default: "content/docs"searchApiPath?: string;// Default: "/api/docs/search-index"aiChatApiPath?: string;// Default: "/api/docs/chat"}// Use all defaultsconstconfig=createReactDocsConfig();// Override specific fieldsconstconfig=createReactDocsConfig({basePath: "/documentation",aiChatApiPath: "/api/custom-chat"});// Override all fieldsconstconfig=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';functionCustomComponent(){constcolors=useDocsColors();return(<divstyle={{color: colors.primary}}>
Themed content
</div>);}import{streamDocsChatResponse}from'react-docs-module/chat-api';// API route exampleexportasyncfunctionPOST(req: Request){const{ messages }=awaitreq.json();returnstreamDocsChatResponse(config,messages,"You are a helpful documentation assistant.",async(result)=>{// Handle completionconsole.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.tsimport{buildSearchIndex,createReactDocsConfig}from'react-docs-module';constDOCS_CONFIG=createReactDocsConfig({contentPath: "content/docs"});exportdefaultasyncfunctionhandler(req,res){constsearchIndex=awaitbuildSearchIndex(DOCS_CONFIG);res.json(searchIndex);}constmodelProvider: 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.