Overview
By default, Fumadocs uses a server-first approach requiring a running Node.js server. Static export allows you to generate a fully static site (HTML, CSS, JS) that can be hosted on any CDN or static file server. Benefits:- No server required - Host on GitHub Pages, Netlify, Cloudflare Pages
- Maximum performance - Serve directly from CDN edge locations
- Lower costs - No server runtime charges
- Simple deployment - Just upload static files
Prerequisites
Before enabling static export, configure your search implementation:Built-in Search (Orama)
Configure both server and client for static mode:Pre-generate search indexes as static JSON. Follow the Static Export guide.
import { allDocs } from '@/.source';
import { createSearchAPI } from 'fumadocs-core/search/server';
const api = createSearchAPI('advanced', {
indexes: allDocs.map((page) => ({
id: page.url,
title: page.data.title,
description: page.data.description,
url: page.url,
structuredData: page.data.structuredData,
})),
});
export const GET = api.staticGET();
export const dynamic = 'force-static';
Cloud Search Solutions
Third-party search providers work automatically with static export:- Algolia - Pre-index during build, search via API
- Orama Cloud - Remote search indexes
- Trieve - Cloud-hosted search
Framework Configuration
Next.js
Enable static export in your Next.js configuration:next.config.mjs
See Next.js Static Exports for limitations including:
- No Server Components with dynamic rendering
- No API routes
- No Image Optimization (use
unoptimized: true) - No Internationalized Routing
Build and Export
out/ directory. Deploy these files to your static host.
React Router
Configure SPA mode to serve thebuild/client directory as static files:
react-router.config.ts
On SPA mode, all server-side loaders must be pre-rendered. See React Router SPA Mode for details.
Build and Export
build/client directory to your static host.
Tanstack Start
Enable SPA mode with pre-rendering:vite.config.ts
pages array for routes not linked in your navigation.
See Tanstack Start SPA Mode for complete documentation.
Build and Export
Waku
Waku serves sites statically when all pages usestatic render mode:
pages/docs/[...slug].tsx
Hosting Options
Once you’ve generated static files, deploy to any static host:Cloudflare Pages
Netlify
netlify.toml
GitHub Pages
.github/workflows/deploy.yml
Vercel
Vercel automatically detects static exports:vercel.json
Testing Locally
Test your static export before deploying:Using Python
http://localhost:8000
Using Node.js
Using Nginx (Docker)
Image Optimization
Next.js Image Optimization requires a server. For static export:next.config.mjs
next.config.mjs
image-loader.js
Troubleshooting
Build Fails with Dynamic Routes
Ensure all dynamic routes havegenerateStaticParams (Next.js) or are included in pre-render configuration.
Search Not Working
Verify:- Search indexes are generated at build time
- Search client is configured for
type: 'static' - Static JSON file is accessible at the specified path
404 Errors on Refresh
Configure your host for SPA routing: Netlify:netlify.toml
_redirects file:
public/_redirects