6.7 KiB
Supabase Monorepo
pnpm 12 + Turborepo monorepo. Requires Node 26 (see .nvmrc).
Structure
| Directory | Purpose |
|---|---|
apps/studio |
Supabase Studio/Dashboard — has its own apps/studio/AGENTS.md (see below) |
apps/docs |
Documentation site — Next.js app router, MDX (port 3001, served under /docs) — has its own apps/docs/AGENTS.md |
apps/www |
Marketing website — Next.js, app + pages (port 3000) |
apps/design-system |
Component demos — source of truth for Studio UI patterns (port 3003) |
apps/ui-library |
shadcn-style registry site for Supabase UI blocks (port 3004) |
apps/lite-studio |
Lightweight Studio — React Router 7 + Vite + Tailwind v4 |
apps/kb |
Knowledge base — Astro — has its own apps/kb/AGENTS.md |
apps/learn |
Courses site — Next.js + Velite (port 3007), early stage |
packages/ui |
Shared UI components (shadcn/ui based) — import { Button } from 'ui' |
packages/ui-patterns |
Composite components — subpath imports, e.g. ui-patterns/AssistantChat |
packages/common |
Shared utils, telemetry constants, feature flags |
packages/api-types |
Generated platform Management API types |
packages/pg-meta |
SQL builders for Postgres introspection (SafeSqlFragment) |
packages/shared-data |
Static data: pricing, plans, regions, error codes |
e2e/studio, e2e/docs |
Playwright E2E tests |
supabase/ |
Local Supabase project: edge functions, migrations, config.toml |
Common Commands
pnpm dev:studio # run Studio dev server → http://localhost:8082
pnpm dev:docs # run docs dev server
pnpm dev:www # run www dev server
pnpm dev:kb # run knowledge base dev server
pnpm test:studio # Studio unit tests (vitest)
pnpm e2e # Studio E2E tests (playwright)
pnpm build --filter=studio # build Studio
pnpm lint --filter=studio # lint Studio
pnpm typecheck # typecheck all packages
pnpm format # oxfmt write for {apps,packages,blocks,i18n} (check: pnpm format:check; other paths: pnpm exec oxfmt --check <paths>)
pnpm generate:types # local DB types → supabase/functions/common/database-types.ts
pnpm api:codegen # platform Management API types → packages/api-types
CI & Generated Files
Every PR runs typecheck, lint, oxfmt, and typos checks, plus path-filtered test/build workflows, lint ratchets (warning counts cannot increase), and Tailwind token rules (shadcn/*).
Never hand-edit generated files: packages/api-types/types/**, **/routeTree.gen.ts, **/__generated__/**, apps/docs/features/docs/generated/**, apps/www/.generated/**, supabase/functions/common/database-types.ts, apps/docs/content/_partials/access-control/scoped_pat_*.mdx (make -C apps/docs/spec generate.partials.access-control).
Conventions
- UI & styling — Import primitives from
'ui'(Button, not rawButton_Shadcn_; checkpackages/ui/index.tsxfirst) and composed patterns from'ui-patterns'. Use Tailwind semantic tokens (bg-muted,text-foreground-light), never hardcoded colors. - Exports & language — Named exports only (default exports only where a framework requires them; lint-enforced). Use U.S. English everywhere.
- Public surfaces — This repo is world-readable. Keep internal content out of code, comments, PRs, and issues: absolute production metrics (use percentages/ratios), internal vendor/legal/pricing/strategy detail, competitor names (protocol identifiers like user-agents are fine), private repo paths/symbols, and internal teammate names. Link Linear for internal context.
- Comments — Explain non-obvious why (invariants, ordering constraints, or temporary workarounds with a Linear ticket ID) — never what, file headers, change/mock history, or scratchpad narration.
- Dependencies & diff scope — Use
"catalog:"for shared workspace deps (add script tools todevDependencies, update the lockfile, remove unused deps). Keep diffs surgical: stripconsole.logs, isolate major dep bumps, and keep tooling version updates scoped to their own semantic boundary.
Skills
.agents/skills/ is the source of truth for conventions — load the relevant skill before working instead of guessing. (For docs content style, apps/docs/style-guide/ is the source of truth applied by the docs skills.)
code-review— read-only assessments and development-task readiness checkscopywriting— any user-facing text, anywhere in the monoreporeact-hook-form— writing or modifying any form code, anywhere in the monoreposafe-sql-execution— any code building or executing SQL against user databases or analytics logstelemetry-standards— PostHog events,packages/common/telemetry-constants.tsapi-types— regeneratingpackages/api-typesand verifying production OpenAPI driftdev-toolbar-review—packages/dev-tools,packages/common/posthog-client.ts,packages/common/feature-flags.tsxturbo-scripts—package.jsonscripts orturbo.jsonctasks,maybe-turbo, caching, envpm-the-docs/write-the-docs/edit-the-docs/ask-the-docs/review-the-docs/test-the-docs— anything underapps/docs(seeapps/docs/CONTRIBUTING.md)
Studio
Before working on anything in apps/studio, read apps/studio/AGENTS.md — it maps Studio tasks to skills and covers Studio architecture, principles, and repo-specific traps.