This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev # Next.js dev server with Turbopack (http://localhost:3000/docs)
npm run build # Runs `fumadocs-mdx` then `next build` — both steps required for content changes
npm start # Serve the production build
npm run lint # ESLint over .js/.jsx/.ts/.tsxThere is no test suite. npm install triggers postinstall: fumadocs-mdx, which generates the .source/ directory consumed by lib/source.tsx.
This is a Fumadocs documentation site on Next.js 16 (App Router, React 19). All pages are MDX under content/docs/; there are no per-page React routes.
- Single catch-all route:
app/[[...slug]]/page.tsxis the only page component. It callssource.getPage(slug)and renders the MDXbodyinsideDocsPage/DocsBodyfromfumadocs-ui.generateStaticParamsproduces every doc URL at build time. - Content pipeline:
source.config.ts(root) →fumadocs-mdxreadscontent/docs/**/*.mdxand emits to.source/→lib/source.tsxwraps that withloader()to produce the page tree, URL map, and icon resolver. Every directory incontent/docs/has ameta.jsoncontrolling sidebar order/title/icon (icons are string keys mapped tolucide-reactcomponents inlib/source.tsx— adding a new icon means importing it there and adding acaseto the switch). - URL rewriting: The
introduction/section is the site root.lib/source.tsx'surl()strips theintroductionprefix, andnext.config.mjsadds matchingrewrites(so/quick-startresolves to/introduction/quick-start.mdxinternally) plusredirectsfrom old/introduction/*URLs. The whole site is served underbasePath: '/docs'. - Search:
app/api/search/route.tsexposes a Fumadocs-built static index viacreateFromSource(source). No external search service. - Layout:
app/layout.tsxwraps everything inDocsLayoutonce at the root (not per-page). Header nav links live inlib/layout.shared.tsx.
- MDX is parsed as JSX, so bare
<followed by an alphanumeric is read as a tag start. Patterns like<N,<5min,<container_id>will fail the build — escape as<or wrap in backticks. (See commit80c0217.) - Frontmatter accepts a numeric
orderfield beyond the Fumadocs defaults (defined insource.config.ts). Sidebar ordering is normally controlled bymeta.json'spagesarray, not frontmatter. - Section roots:
introduction/meta.jsonhas"root": true, making it a top-level sidebar group rather than a nested folder.
Built as a standalone Next.js Docker image (output: 'standalone' in next.config.mjs, multi-stage Dockerfile). The companion ../deploy/ repo composes this image and routes stackpatrol.dev/docs through nginx. public/ must exist at build time — it's tracked via .gitkeep so the Docker COPY stage doesn't fail.