A modern documentation website for showcasing plugin documentation with automatic GitHub integration, built with Next.js and Fumadocs.
- Node.js 18+ or higher
- npm, yarn, or pnpm
- GitHub Personal Access Token
# Clone the repository
git clone <your-repository-url>
cd nextjs-fumadocs
# Install dependencies
npm install
# or
pnpm install
# or
yarn install
Create a .env.local
file in the root directory:
GITHUB_TOKEN=your_github_personal_access_token_here
NEXT_PUBLIC_SITE_URL=http://localhost:3001
- Go to GitHub Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)"
- Give it a descriptive name like "Plugin Docs Site"
- Select scopes:
public_repo
(for public repositories)repo
(if you need access to private repositories)
- Copy the generated token and add it to your
.env.local
file
Edit lib/plugins.ts
to add your plugins:
export const plugins: Plugin[] = [
{
name: "Your Plugin Name",
slug: "your-plugin-slug",
description: "Description of what your plugin does",
repository_url: "https://github.com/your-username/your-plugin",
latest_version: "2.x",
is_private: false, // Set to true for private repositories
versions: [
{ version: "1.x", github_branch: "1.x" },
{ version: "2.x", github_branch: "2.x" },
],
},
// Add more plugins here...
];
npm run dev
# or
pnpm dev
# or
yarn dev
Open http://localhost:3001 in your browser.
npm run build
npm start
# or
pnpm build && pnpm start
├── app/
│ ├── (home)/ # Homepage with plugin listings
│ ├── docs/ # Documentation pages
│ │ ├── layout.tsx # Docs layout with sidebar
│ │ └── [[...slug]]/ # Dynamic plugin documentation
│ ├── api/ # API endpoints
│ └── layout.tsx # Root layout
├── lib/
│ ├── plugins.ts # Plugin configuration (EDIT THIS)
│ ├── sources/ # GitHub integration
│ ├── cache.ts # Performance optimizations
│ └── compile-md.ts # Markdown processing
├── components/ # React components
└── public/ # Static assets
The site automatically fetches and displays documentation from your GitHub repositories:
- README.md → Overview page
- DOCUMENTATION.md → Detailed documentation
- CHANGELOG.md → Version history
Each plugin can have multiple versions mapped to different GitHub branches:
versions: [
{ version: "1.x", github_branch: "1.x" },
{ version: "2.x", github_branch: "2.x" },
{ version: "3.x", github_branch: "main" },
];
- Caching: Intelligent caching system for GitHub API calls
- ISR: Incremental Static Regeneration for optimal performance
- Rate Limiting: Respects GitHub API limits
- Error Handling: Graceful fallbacks for missing content
- Add plugin configuration to
lib/plugins.ts
- Ensure your GitHub repository has documentation files
- The site will automatically generate pages for each version
For private repositories, set is_private: true
in the plugin configuration. This will:
- Hide GitHub repository links in the UI
- Require proper token permissions
- Show appropriate fallback content if access is denied
- Update
app/layout.config.tsx
for site configuration - Modify
app/global.css
for custom styles - Colors are defined using CSS custom properties
/api/status?action=health
- Site health check/api/status?action=plugins
- List all configured plugins/api/status?action=cache-stats
- Cache performance stats
- Push your code to GitHub
- Connect repository to Vercel
- Add environment variables in Vercel dashboard:
GITHUB_TOKEN
NEXT_PUBLIC_SITE_URL
- Deploy automatically
- Build the project:
npm run build
- Serve the generated files
- Set environment variables on your hosting platform
"No documentation found"
- Check if README.md exists in your repository
- Verify GitHub token has correct permissions
- Check if the branch name matches your configuration
"Rate limit exceeded"
- The site includes rate limiting, wait a few minutes
- Consider caching in production environment
"Build fails"
- Ensure all environment variables are set
- Check if GitHub token is valid
- Verify plugin configurations in
lib/plugins.ts
Check the browser console for detailed error messages. The site logs:
- Cache hits/misses
- GitHub API calls
- Compilation errors
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally
- Submit a pull request
MIT License - see LICENSE file for details.