Docs site
Run, verify, and publish the buyer-distributed Fumadocs and Next.js application.
apps/docs is a separate Next.js documentation application. It renders the canonical Markdown and
MDX files from the repository-level docs/ directory; there is no second content/docs copy.
Changing a guide changes the repository contract and the rendered site together.
The docs site is not the React product SPA and is not deployed by the application OpenTofu, Railway, or Cloudflare static-assets paths. It is optional buyer-owned documentation and needs an independently selected Next.js host when published.
Local development
The scaffold creates ignored apps/docs/.env with a localhost origin so the full zero-key workspace
build remains deterministic.
bun --filter @app/docs devOpen http://localhost:3002; documentation is served directly at /, and legacy /docs/* paths
redirect permanently to /*. The site uses Fumadocs 16's Notebook layout (top navigation bar with
search, grouped sidebar sections with icons, page breadcrumbs, Clerk-style table of contents, and
per-page Copy Markdown and Open in AI actions). Search is served by the Next route handler. Markdown
negotiation, llms.txt, llms-full.txt, per-page Markdown, sitemap, robots, and Open Graph image
routes are part of the application.
Offline Markdown bundle
The documentation navigation includes Download Markdown. It downloads the current published
documentation as one Markdown file from llms-full.txt; save that file for offline reading or give
it to an agent alongside the exact product release. It contains only the published documentation,
not private environment files or seller-only surfaces.
Download the current Markdown bundle
Content and navigation
For every new published page:
- add the
.mdor.mdxfile underdocs/withtitle,description, and Lucideiconfrontmatter; - add it to
docs/meta.jsonunder the intended sidebar section separator (---Section---); - add it to the
fileslist inapps/docs/lib/source.ts; - use links to other published docs pages or external HTTPS pages;
- render and verify the route, Markdown representation, search, sitemap, and adjacent navigation.
Repository-only files such as ADRs, commercial policies, and infrastructure READMEs should be referenced as code paths unless they are deliberately added to the published source list. A filesystem-valid relative Markdown link can still be a 404 in the docs application.
The page renders the frontmatter title as its only h1. A file may open with its own # heading
for readers of the repository; the docs application drops that leading heading so the rendered page,
its table of contents, and its Markdown representation do not repeat the title, and no link may
target its anchor. Every other heading in a published page is ## or deeper.
Verification
bun --filter @app/docs lint
bun --filter @app/docs typecheck
bun --filter @app/docs test
NEXT_PUBLIC_SITE_URL=https://docs.example.com \
bun --filter @app/docs build:publicThe ordinary build command accepts the generated localhost origin for repository-wide local and CI
verification. build:public rejects missing, HTTP, localhost, credentialed, query, fragment, or
path-bearing values before Next builds.
Publication
Set NEXT_PUBLIC_SITE_URL to the exact public HTTPS origin in the deployment environment. It is
inlined into canonical URLs, sitemap entries, robots, and Open Graph metadata at build time. Rebuild
after changing the origin.
Use a Node-compatible Next.js deployment that can run the search route and proxy. Build with
build:public, then start the produced application with:
bun --filter @app/docs startapps/docs/vercel.json supplies Vercel build defaults (bun install --frozen-lockfile and
bun run build:public), while no CI deploy workflow or OpenTofu automation is bundled. The selected
host must preserve Next route handlers, static assets, proxy behavior, HTTPS, immutable release
identification, logs, rollback, and a smoke covering /, /api/search, /sitemap.xml,
/robots.txt, /llms.txt, and one Open Graph image.
Do not publish the generated local .env, rely on localhost metadata, or assume the product SPA
deployment also serves this application.