Guides
Quick Reference
Essential commands and endpoints at a glance
Quick reference for common tasks, commands, and endpoints.
Endpoints
AI & LLM
| URL | Purpose | For |
|---|---|---|
/llms.txt | Discovery file | AI agents |
/llms-full.txt | All docs, structured format | RAG systems |
/docs/page.mdx | Page as markdown | AI tools |
/docs/page.md | Page as markdown (alt) | AI tools |
/llms-full.txt has enhanced structure with metadata, TOC, and clear separators. See Format Documentation.RSS Feeds
| URL | Format | Content |
|---|---|---|
/rss.xml | RSS 2.0 | Sitewide |
/atom.xml | Atom 1.0 | Sitewide |
/feed.json | JSON Feed | Sitewide |
/docs/rss.xml | RSS 2.0 | Docs only |
/docs/atom.xml | Atom 1.0 | Docs only |
/docs/feed.json | JSON Feed | Docs only |
All feeds are auto-discoverable via <link> tags and refreshed hourly. See RSS Feeds.
Content Negotiation
# Get markdown automatically
curl -H "Accept: text/markdown" https://yourdomain.com/docs/pageScripts
Development
# Start dev server
pnpm dev
# Start on different port
PORT=3001 pnpm devPDF Export
# Export all pages
pnpm export-pdf
# Export specific pages
pnpm export-pdf:specific /docs /docs/getting-started
# Build and export (production)
pnpm export-pdf:buildLink Validation
# Validate all documentation links
pnpm lint:linksBuild & Deploy
# Build for production
pnpm build
# Start production server
pnpm start
# Build with PDF export mode
NEXT_PUBLIC_PDF_EXPORT=true pnpm buildTesting Commands
Test Endpoints
# Discovery file
curl http://localhost:3000/llms.txt
# Full documentation
curl http://localhost:3000/llms-full.txt
# Specific page as markdown
curl http://localhost:3000/docs.mdx
# Test content negotiation
curl -H "Accept: text/markdown" http://localhost:3000/docsInspect Headers
# Check HTTP headers
curl -I http://localhost:3000/llms.txt
curl -I http://localhost:3000/llms-full.txt
# Check custom headers
curl -I http://localhost:3000/llms-full.txt | grep "X-"Download Content
# Download full documentation
curl http://localhost:3000/llms-full.txt -o docs.txt
# View table of contents
curl http://localhost:3000/llms-full.txt | \
sed -n '/Table of Contents:/,/^===/p'
# Count pages
curl http://localhost:3000/llms-full.txt | \
grep -c "^PAGE [0-9]"Components
AI Page Actions
import { LLMCopyButton, ViewOptions } from '@/components/page-actions';
// Copy markdown button
<LLMCopyButton markdownUrl={`${page.url}.mdx`} />
// View options dropdown
<ViewOptions
markdownUrl={`${page.url}.mdx`}
githubUrl="https://github.com/user/repo/blob/main/..."
/>Cards and Callouts
import { Card, Cards } from "fumadocs-ui/components/card";
import { Callout } from "fumadocs-ui/components/callout";
<Cards>
<Card title="Title" description="Description" href="/link" />
</Cards>
<Callout type="info">Information message</Callout>
<Callout type="warn">Warning message</Callout>Tabs and Steps
import { Tab, Tabs } from "fumadocs-ui/components/tabs";
import { Step, Steps } from "fumadocs-ui/components/steps";
<Tabs items={["Tab 1", "Tab 2"]}>
<Tab value="Tab 1">Content 1</Tab>
<Tab value="Tab 2">Content 2</Tab>
</Tabs>
<Steps>
<Step>First step</Step>
<Step>Second step</Step>
</Steps>Configuration Files
Key Files
| File | Purpose |
|---|---|
middleware.ts | Content negotiation |
next.config.mjs | URL rewrites |
source.config.ts | MDX processing |
app/llms.txt/route.ts | Discovery endpoint |
components/page-actions.tsx | AI UI components |
Environment Variables
# Enable PDF export mode
NEXT_PUBLIC_PDF_EXPORT=true
# Set port
PORT=3001Customization
Update GitHub URL
Edit app/docs/[[...slug]]/page.tsx:
githubUrl={`https://github.com/YOUR_ORG/YOUR_REPO/blob/main/apps/web/content/docs/${page.file.path}`}Add AI Tool
Edit components/page-actions.tsx:
{
title: 'Open in MyAI',
href: `https://myai.com/?url=${markdownUrl}`,
icon: <MyIcon />,
}Customize PDF Settings
Edit scripts/export-pdf.ts:
await page.pdf({
width: "950px",
margin: { top: "20px", right: "20px", bottom: "20px", left: "20px" },
});Modify Discovery File
Edit app/llms.txt/route.ts:
const content = `# Your Custom Title
> Your custom description
## Documentation Pages
${pages.map((page) => `- [${page.data.title}](${origin}${page.url}.mdx): ${page.data.description ?? ""}`).join("\n")}
`;Common Tasks
Add New Doc Page
- Create file in
content/docs/ - Add frontmatter with title and description
- Write MDX content
- Page automatically appears in navigation
Export PDFs
- Start dev server:
pnpm dev - Run export:
pnpm export-pdf - Find PDFs in
pdfs/directory
Test AI Integration
- Start dev server:
pnpm dev - Test endpoints with curl (see above)
- Check page actions in browser
- Verify content negotiation
Deploy to Production
- Build:
pnpm build - Test locally:
pnpm start - Deploy to hosting platform
- Verify all endpoints work
Performance Optimization
Caching Strategy
| Resource | Cache-Control |
|---|---|
/llms.txt | s-maxage=86400 (24h) |
/llms-full.txt | revalidate=false (permanent) |
*.mdx routes | immutable (forever) |
Build Optimization
# Analyze bundle
pnpm build --analyze
# Check bundle size
du -sh .next/
# Clear cache
rm -rf .next/Troubleshooting
Clear Cache
# Clear Next.js cache
rm -rf .next/
# Clear node modules
rm -rf node_modules/
pnpm installCheck Errors
# View build errors
pnpm build 2>&1 | tee build.log
# Check TypeScript errors
pnpm tsc --noEmitVerify Configuration
# Check source config
cat source.config.ts | grep includeProcessedMarkdown
# Check middleware
cat middleware.ts
# Check rewrites
cat next.config.mjs | grep -A 10 "rewrites"Documentation
Full Guides
- Getting Started - Overview and introduction
- PDF Export - Complete PDF export guide
- AI Integration - AI/LLM integration guide
- llms-full.txt Format - Format specification
- Testing Guide - Comprehensive testing
External Resources
Status
✅ All features implemented and tested ✅ Following Fumadocs official guidelines ✅ Performance optimized with caching ✅ Production ready