The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
Docs build pipeline
How apps/docs is built through Turborepo and pnpm lifecycle hooks.
Verify against the current apps/docs/turbo.jsonc and
apps/docs/package.json if behavior surprises you.
Build flow
flowchart TB
subgraph turbo["Turborepo — apps/docs/turbo.jsonc"]
direction TB
WP["^build — workspace deps<br/>(common, ui, config, icons, …)"]
CE["codegen:examples<br/>copy ../../examples → apps/docs/examples"]
CR["codegen:references<br/>→ features/docs/generated/**"]
WP --> DOC["docs#build"]
CE --> DOC
CR --> DOC
end
subgraph npm["pnpm — apps/docs/package.json"]
direction TB
PRE["prebuild"]
NB["build — next build"]
POST["postbuild"]
PRE --> NB --> POST
end
DOC --> PRE
subgraph pre["prebuild steps"]
direction LR
GQL["codegen:graphql"]
REF["codegen:references"]
EX["codegen:examples"]
GM["build:markdown<br/>(guides + reference)"]
GZ["build:gz-archive"]
end
PRE --> GQL
PRE --> REF
PRE --> EX
PRE --> GM
PRE --> GZ
subgraph post["postbuild steps"]
direction LR
SM["build:sitemap"]
CDN["upload-static-assets.sh<br/>(R2, production-style deploys)"]
end
POST --> SM
POST --> CDN
Commands
From the repo root:
- Full graph:
pnpm build→turbo run build(builds every package/app in dependency order). - Docs only:
pnpm build:docs→turbo run build --filter=docs.
"build:docs": "turbo run build --filter=docs"
What Turbo does
Root turbo.jsonc defines build with dependsOn: ["^build"], so
workspace dependencies of docs (e.g. common, ui, config, …) are
built before docs.
apps/docs/turbo.jsonc extends that and tightens the docs task:
buildalso depends oncodegen:examplesandcodegen:references(with explicit inputs/outputs so Turbo can cache them).- It lists env vars that affect caching for the docs app.
codegen:examplescopies../../examplesintoapps/docs/examples;codegen:referenceswrites underfeatures/docs/generated/**.
Pipeline Turbo orchestrates for docs: dependency packages → example / reference codegen → Next build.
What the docs package runs (pnpm lifecycle)
"prebuild": "pnpm run codegen:graphql && pnpm run codegen:references && pnpm run codegen:examples && pnpm run build:markdown && pnpm run build:gz-archive",
"postbuild": "pnpm run build:sitemap && ./../../scripts/upload-static-assets.sh"
prebuild— GraphQL codegen, reference codegen, copy examples, generate guides + reference markdown (build:markdown), then tarball (build:gz-archive).build—next build.postbuild— sitemap, thenupload-static-assets.sh(R2 CDN upload on production-style deploys).
Same monorepo pattern as Studio / www (pnpm workspaces + Turbo ^build),
with extra codegen wired as Turbo tasks and npm pre/post hooks around
next build.
Codegen scripts
codegen:graphql— generates GraphQL types from schema.codegen:examples— copiesexamples/from monorepo root intoapps/docs/examplesfor$CodeSampledirective resolution.codegen:references:legacy—features/docs/Reference.generated.script.ts(includes Management API: merge OpenAPI v1+v2 →api.latest.*JSON). Spec download/bundle lives inapps/docs/spec/Makefile(Redocly); seemanagement-api-reference.md.codegen:references:new—scripts/build-reference-content.ts(from TSDoc JSON underspec/reference/). Output lands infeatures/docs/generated/**.build:guides-markdown— runsinternals/generate-guides-markdown.tsovercontent/guides/**/*.mdx. Producespublic/markdown/guides/**.md.build:reference-markdown— runsinternals/generate-reference-markdown.ts. Producespublic/markdown/reference/**.md.build:markdown— shorthand for guides + reference markdown.build:gz-archive— runsinternals/generate-gz-archive.ts. Producespublic/docs.tar.gz(tarball of allpublic/markdown/).
For how agents consume these outputs, see
llm-agent-surface.md.
Deploy vs CI
- Production build for the site is Vercel;
apps/docs/vercel.jsonsetsbuildCommandtopnpm build(the docs app's script chain above). - GitHub Actions mostly run tests (
test:docs→ Turbo), lint, sync jobs, and smoke tests — not a separate full production build graph in the way Turbo does locally. Seeci-and-lint.md.
Local development
From apps/docs:
pnpm dev # http://localhost:3001/docs
predevruns GraphQL and reference codegen plus example copy.- Community contributors: set
NEXT_PUBLIC_IS_PLATFORM=falsein.env. - Supabase employees:
pnpm run dev:secrets:pullfor internal env vars (AWS profile +scripts/getSecrets.js). - In dev mode, the app only builds routes upon request rather than pre-rendering — preview and production environments statically generate routes during build for speed.
Why this shape matters for changes
- Adding a new build step? See
adding-features.md"Reuse pipelines, don't fork them" and check ifprebuildorpostbuildalready has a hook that fits. - New env var? Add it to
apps/docs/turbo.jsonc'senvso Turbo doesn't cache stale. - Touching the markdown export? Read
app-map.md"The two pipelines" first — runtime and export share data, not code paths.
Related
app-map.md— directory layout and runtime / export split.ci-and-lint.md— GitHub Actions workflow surface.federated-docs.md— external content fetched during build.