A modern static documentation website for plugin documentation with automatic GitHub integration, built with Next.js and Fumadocs. Optimized for GitHub Pages deployment with automated CI/CD.
- π Plugin Documentation: Automatically fetch and display documentation from GitHub repositories
- π·οΈ Version Management: Support multiple versions mapped to different GitHub branches
- π Full-Text Search: Powered by Orama for fast documentation search
- π Theme Toggle: Light/dark mode support
- π± Responsive Design: Mobile-friendly layout
- π Static Export: Optimized for GitHub Pages deployment
- π Auto Deployment: GitHub Actions workflow for continuous deployment
- πΎ Smart Caching: Intelligent caching system for GitHub API calls
- Node.js 18+ or higher
- npm or pnpm
- GitHub Personal Access Token (optional, but recommended)
# Clone the repository
git clone <your-repository-url>
cd static-plugin-doc-site-3
# Install dependencies
npm install
# or
pnpm installCreate a .env.local file in the root directory:
GITHUB_TOKEN=your_github_personal_access_token_here
NEXT_PUBLIC_SITE_URL=http://localhost:3000- 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.localfile
Note: GitHub token is optional for public repositories, but recommended to avoid rate limiting.
npm run devOpen http://localhost:3001 in your browser.
# Build with fresh documentation fetch
npm run build
# Or build with cached documentation (faster)
npm run build:cachestatic-plugin-doc-site-3/
βββ .github/
β βββ workflows/
β βββ deploy.yml # GitHub Actions deployment workflow
βββ app/ # Next.js app directory
β βββ (home)/ # Homepage with plugin/product listings
β βββ docs/ # Documentation pages
β β βββ [[...slug]]/ # Dynamic documentation routes
β β βββ components/ # Docs-specific components
β βββ api/ # API routes (search, etc.)
β βββ llms-full.txt/ # LLM-optimized documentation
βββ components/ # Shared React components
β βββ partials/ # Reusable partial components
β βββ provider.tsx # Theme and context providers
βββ content/docs/ # Generated documentation (auto-created)
β βββ [plugin-name]/
β β βββ _meta.json # Navigation structure
β β βββ [version]/
β β βββ overview.mdx # Version documentation
βββ lib/
β βββ config.ts # **Plugin/product configuration (EDIT THIS)**
β βββ source.ts # Fumadocs source configuration
β βββ layout.shared.tsx # Shared layout configuration
βββ public/ # Static assets
β βββ images/ # Plugin images and assets
βββ scripts/
β βββ fetch-docs.ts # Documentation fetcher script
βββ next.config.mjs # Next.js configuration
βββ source.config.ts # MDX configuration
βββ package.json # Dependencies and scripts
Edit lib/config.ts and add your plugin to the plugins array:
export const config: Config = {
plugins: [
{
id: "your-plugin-slug",
title: "Your Plugin Name",
description: "Brief description of what your plugin does",
repo: "your-github-username/your-repo-name",
latestVersion: "3.x",
versions: [
{
version: "1.x",
github_branch: "1.x",
limited_files: [
{ name: "README.md", title: "Overview", slug: "overview" },
],
},
{
version: "2.x",
github_branch: "2.x",
limited_files: [
{ name: "README.md", title: "Overview", slug: "overview" },
],
},
{
version: "3.x",
github_branch: "3.x",
limited_files: [
{ name: "README.md", title: "Overview", slug: "overview" },
],
},
],
},
// Add more plugins...
],
products: [
// Your products here...
],
};id(required): Unique identifier, used in URLs (e.g.,/docs/filament-tree/3.x/overview)title(required): Display name shown in the UIdescription(required): Short description for the plugin cardrepo(required): GitHub repository in formatowner/repolatestVersion(required): The default version shown to usersversions(required): Array of version configurationsversion: Version identifier (e.g., '1.x', '2.x')github_branch: Branch name in GitHub repositorylimited_files: Array of specific files to fetch (usually just README.md for overview)
hidden(optional): Set totrueto hide from the homepageis_manual(optional): Set totruefor custom documentation structuredocs_structure(optional): 'folder_based' for complex structuresdocs_path(optional): Custom path in repo for documentationsections(optional): Manual section definitions for complex docs
Products are external links shown alongside plugins on the homepage:
products: [
{
id: "your-product-id",
title: "Your Product Name",
description: "What your product does",
link: "https://yourproduct.com",
badge: {
text: "External",
color: "green",
},
},
];For plugins with multiple documentation files organized in folders:
{
id: 'complex-plugin',
title: 'Complex Plugin',
description: 'Plugin with structured documentation',
repo: 'owner/repo',
latestVersion: '3.x',
is_manual: true,
docs_structure: 'folder_based',
docs_path: 'docs', // Path within the repository
versions: [
{ version: '3.x', github_branch: 'main' }
],
sections: [
{
name: 'Getting Started',
slug: 'getting-started',
files: [
{ name: 'installation.md', title: 'Installation', slug: 'installation' },
{ name: 'configuration.md', title: 'Configuration', slug: 'configuration' },
],
},
{
name: 'Advanced',
slug: 'advanced',
files: [
{ name: 'customization.md', title: 'Customization', slug: 'customization' },
],
},
],
}-
Push your code to GitHub:
git add . git commit -m "Initial commit" git push origin main
-
Enable GitHub Pages:
- Go to your repository on GitHub
- Navigate to Settings β Pages
- Under "Build and deployment"
- Source: Select "GitHub Actions"
-
Set GitHub Token (Optional):
- Only needed if fetching from private repositories
- Go to Settings β Secrets and variables β Actions
- Add a new repository secret named
GITHUB_TOKEN - Use a Personal Access Token with
reposcope
-
Configure Base Path (if needed):
- The workflow automatically detects your repository name
- Your site will be at:
https://[username].github.io/[repository-name]/ - To customize, set
NEXT_PUBLIC_BASE_PATHenvironment variable
The GitHub Actions workflow automatically:
- β
Triggers on every push to
mainbranch - β Fetches latest documentation from configured repos
- β Builds the static site
- β Deploys to GitHub Pages
You can also trigger deployment manually:
- Go to Actions tab in your repository
- Select "Deploy to GitHub Pages" workflow
- Click "Run workflow"
To rebuild docs without code changes:
# Locally trigger a repository dispatch event
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token YOUR_GITHUB_TOKEN" \
https://api.github.com/repos/YOUR_USERNAME/YOUR_REPO/dispatches \
-d '{"event_type":"rebuild-docs"}'# Development
npm run dev # Start development server on port 3001
# Building
npm run build # Fetch docs and build for production
npm run build:cache # Build using cached documentation (faster)
npm run build:static # Build for static export (used by GitHub Actions)
# Documentation Management
npm run fetch-docs # Fetch documentation from GitHub
npm run fetch-docs:cache # Use cached docs, skip GitHub fetch
# Type Checking
npm run types:check # Run TypeScript type checking
# Preview Production Build
npm run start # Serve the production build locallyCauses:
- README.md doesn't exist in the specified GitHub repository/branch
- GitHub token lacks proper permissions
- Branch name doesn't match configuration
Solutions:
- Verify the file exists:
https://github.com/[owner]/[repo]/blob/[branch]/README.md - Check your GitHub token has access to the repository
- Ensure
github_branchinlib/config.tsmatches the actual branch name - Run
npm run fetch-docsto see detailed error messages
Cause: GitHub API rate limiting (60 requests/hour without token, 5000 with token)
Solutions:
- Add a GitHub token to
.env.local - Use cached documentation:
npm run build:cache - Wait for the rate limit to reset (check headers in error)
Solutions:
- Delete
node_modulesand reinstall:rm -rf node_modules && npm install - Clear Next.js cache:
rm -rf .next - Ensure all dependencies are installed:
npm install
Causes:
- Images not in
public/images/directory - Incorrect image paths in markdown
- Base path not configured correctly
Solutions:
- Ensure images are in
public/images/[plugin-name]/ - Use relative paths in markdown:
 - Check
basePathconfiguration innext.config.mjs
Common issues:
-
Permissions error:
- Go to Settings β Actions β General
- Scroll to "Workflow permissions"
- Select "Read and write permissions"
-
Pages not enabled:
- Go to Settings β Pages
- Set source to "GitHub Actions"
-
Build errors:
- Check the Actions tab for detailed logs
- Ensure all required files exist in repository
- Verify
lib/config.tsis correctly formatted
Solutions:
# Clear all caches
rm -rf .next .cache node_modules/.cache
# Rebuild
npm run buildEnable verbose logging by checking:
- Browser console for client-side errors
- Terminal output for build-time errors
.cache/directory for fetched files
- Check the Fumadocs documentation
- Review GitHub Actions logs in the Actions tab
- Inspect
.cache/raw/to see fetched files - Enable debug mode by adding
console.logstatements inscripts/fetch-docs.ts
Update site colors in app/global.css:
:root {
--primary: 220 90% 56%;
--primary-foreground: 0 0% 100%;
/* Modify other colors as needed */
}Update navigation in lib/layout.shared.tsx:
export const baseOptions: HomeLayoutProps = {
nav: {
title: "Your Site Name",
},
links: [
// Add custom navigation links
],
};Customize MDX components in mdx-components.tsx:
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
// Add custom component overrides
};
}Create new pages in the app/ directory following Next.js conventions.
This project is open source. Please check the repository for license details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes
- Test locally:
npm run build && npm run start - Commit changes:
git commit -m "Add your feature" - Push to branch:
git push origin feature/your-feature - Submit a pull request
Built with β€οΈ using Next.js and Fumadocs
npm run dev
npm run types:check
npm run build
npm run start
## Contributing
1. Add new plugins/products to `lib/config.ts`
2. Test locally with `npm run dev`
3. Ensure build passes with `npm run build`
4. Commit and push changes
## License
[Add your license here]