Composition
Scaffolding
Generate a project containing only the surfaces you asked for.scripts/scaffold.mjs reads the manifests in composition/ and writes a new
project directory: the shell, the chosen surfaces, the union of the slices
those surfaces require, a generated package.json and a filtered
.env.example.
--dry-run --json prints the resolved plan: the surfaces, the slices pulled
in through requires, every file that would be copied, the merged
dependency list and the environment variables. It is the fastest way to
confirm that a composition really excludes what you think it does.
Dependencies are the shell's plus the chosen slices' — nothing else. A
docs project has no @supabase/ssr and no @upstash/redis entry, so
npm install never fetches them.
Run it clean to prove the composition is real:
Installing from the generated package.json rather than reusing the
template's node_modules is deliberate: an undeclared dependency fails
immediately instead of resolving by accident.
Last updated August 27, 2026Usage
- --surfaces — comma-separated surface ids. Required.
- --out — output directory. Required.
- --name — package name for the generated project.
- --dry-run — print the resolved plan and exit without writing.
- --json — machine-readable output.
- --force — overwrite an existing output directory.
Inspect before you write
What the generated project contains
Adding a surface
- Create the route group under src/app/.
- Add composition/surfaces/<id>.json listing its files and requires.
- If the shell references the surface, add absentTransforms with exact anchors so the references are removed when the surface is left out.
- Scaffold both with and without it, and build both.
Edit this page on GitHub