Adding a feature
The shape of a feature
Section titled “The shape of a feature”Most features touch the same layers, in roughly this order:
- Schema — add/adjust tables or policies in a new
supabase/migrations/file. Remember:org_idstamped onnetworkrows; no cross-schema FKs; index policy columns. - Server function — implement the relevant function in
apps/app/src/server/functions/, declaringauthMiddleware/orgMiddleware. Replace itsNOT_IMPLEMENTEDbody. - Data layer — if it feeds the graph, map results into the shared
GraphDatatype. - UI — wire it into a route under
apps/app/src/routes/. Graph node/edge data reads and writes through the TanStack DB collections inapps/app/src/components/map-editor/lib/collections.ts(see API surface); everything else uses TanStack Query for cache/optimistic updates. - Docs — update this site (see below).
Documentation is part of the change
Section titled “Documentation is part of the change”When making any change to the codebase, check whether the documentation needs updating. A PR that changes user-visible behaviour or architecture without a matching docs update is incomplete.
Specifically:
- User-facing feature → update
apps/docs/src/content/docs/users/. - Architecture, data model, deployment, or workflow → update
apps/docs/src/content/docs/developers/. - New environment variable → update
Environment variables and
.env.example. - Schema change → update Database schema.
Docs updates ship in the same PR as the code. The PR template includes a documentation checkbox.
Quality gates
Section titled “Quality gates”Before opening a PR: pnpm check, pnpm typecheck, and pnpm build should all
pass. CI enforces these plus a frozen-lockfile install and the Socket.dev
supply-chain check.