The CLI's command definitions are the single source of truth for its reference documentation. The command tree is introspected at build time to produce the command reference pages served by the in-repo docs site, so flags, arguments, and examples never drift from the code.
See ADR 0003 for the original design rationale.
This page covers the in-repo Fumadocs site under apps/docs. The
separate pipeline that publishes the command spec to supabase.com is described in
apps/cli/docs/README.md.
apps/cli/scripts/generate-docs.ts runs as the docs generate task before the docs build task
when invoked through Turbo (for example, pnpm run build from the repository root). The package's
build script is a leaf next build; pnpm run generate remains available for local docs
development. The generator:
- Walks the command tree from
rootCommandwithcollectCommands()and keeps the leaf commands. - Extracts a
HelpDoc(description, flags, arguments, examples) for each leaf withgetHelpDoc()and renders it withformatHelpDocAsMarkdown(). - Writes each command as
content/docs/commands/<path>.mdxwith title and description frontmatter. - Writes
content/docs/commands/index.mdx, a table linking to every command page, andcontent/docs/commands/meta.json, which controls sidebar order. - Copies the built
@supabase/configJSON schemas intopublic/cli/so the configuration reference links resolve. This requires@supabase/config#buildto have run first, whichturbo.jsonwires up.
The generated content/docs/commands/ directory is git-ignored; only the hand-authored pages are
committed.
The extraction helpers live in apps/cli/src/shared/cli/command-docs.ts and
apps/cli/src/shared/cli/markdown-formatter.ts.
apps/docs/
├── app/ ← Next.js app (Fumadocs layout + routing)
│ ├── layout.tsx ← Root layout (imports fumadocs styles + Supabase theme)
│ ├── supabase.css ← Supabase color theme overrides
│ └── docs/
│ ├── layout.tsx ← Docs sidebar layout
│ └── [[...slug]]/page.tsx ← Catch-all page renderer
├── content/docs/ ← MDX content (hand-authored + generated)
│ ├── index.mdx ← Landing page (hand-authored)
│ ├── getting-started.mdx ← Quickstart guide (hand-authored)
│ ├── meta.json ← Top-level page order
│ └── commands/ ← Auto-generated command reference (git-ignored)
├── public/cli/ ← Generated config schema assets
└── lib/
└── source.ts ← Fumadocs content source loader
# From the repository root:
pnpm run dev:docs # Generate command pages, then start the Next.js dev server
# To generate pages without starting the server:
pnpm --filter @supabase/docs run generate- Write the command definition with descriptions, flags, and examples in the
.command.tsfile. That file is the source of truth; there is no separate page to author. - Run
pnpm --filter @supabase/docs run generateto regenerate the site. The new command appears in the command index and sidebar automatically.