Project structure
Four layers, and the build order that keeps them honest.
The site renders this same information, with a tab per layer, at /structure. This page is the short version.
The four layers
Design system. lib/tokens.ts is the source of truth for color.
scripts/build-tokens.ts turns it into app/tokens.css. Nothing else decides a
color.
Registry. lib/components.ts is the catalogue.
scripts/build-registry.ts derives dependencies from real imports and writes
public/r/*.json. registry/ holds everything that ships to other projects.
Routes. app/(main) is the public site, app/(dashboard) is the
application shell, app/docs is this documentation. Route groups in
parentheses do not appear in the URL, so two layouts share one URL space with
no prefix.
Content and site. components/ is the site's own furniture and is never
published. content/docs is MDX that renders the real components.
Build order
pnpm build
# 1. tokens:build lib/tokens.ts -> app/tokens.css
# 2. registry:build lib/components.ts -> public/r/*.json
# 3. next build app/** content/** -> .nextThe order is the point: each step reads what the previous one wrote. Running
next build alone would compile against whatever tokens and registry happened
to be on disk.
One rule
A component may only name a role, never a color.
That single constraint is why there is no dark: class anywhere in
registry/ui/, why changing the palette touches one file, and why a block is a
composition rather than new code.