Skip to content
Structure

How the project is laid out

Four layers. Each one owns a single job, and the build order below is what keeps them honest with each other.

One TypeScript file decides every color in the project
Colors live in two layers: raw ramps with no meaning, and semantic roles that point at a step on a ramp. A build step turns that into CSS and into the registry's theme item, so the scale this site renders and the scale a consumer installs cannot drift apart.
  • lib/tokens.tsSource of truth. 7 ramps x 12 steps, 49 semantic roles, radii, shadows.
  • scripts/build-tokens.tsEmits app/tokens.css from lib/tokens.ts. Run by pnpm tokens:build.
  • app/tokens.cssGenerated. :root and .dark variables, plus the @theme block Tailwind reads.
  • app/globals.cssImports Tailwind, the tokens and fumadocs. Defines the type scale utilities.

Build order

pnpm build runs these three in sequence. The order is the point: each step reads what the previous one wrote.

1pnpm tokens:build

lib/tokens.tsapp/tokens.css

CSS cannot be the source of truth for two schemes at once.

2pnpm registry:build

registry.json + registry/**public/r/*.json

The published JSON must never lag behind the source it inlines.

3next build

app/** + content/**.next

Runs last, so it compiles against fresh tokens and a fresh registry.

One rule holds the whole thing together
A component may only name a role, never a color. That single constraint is why dark mode needs 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.