Scaffolding
Generate full-stack features, frontend pages, backend routes, and locales that follow every SiteKnock convention.
Overview
SiteKnock's scaffolding tool generates code that already follows the kit's conventions — ESM, Zod validation, data-testid on interactive elements, i18n for all text, and full TypeScript types. You fill in the business logic; the boilerplate is done.
pnpm sk:scaffold feature <name> # Full-stack: backend route + frontend page + i18n
pnpm sk:scaffold page <name> # Frontend page + i18n
pnpm sk:scaffold route <name> # Backend API route with Zod validation
pnpm sk:scaffold locale <code> # New locale from the English template
Features
A feature generates a backend route, a frontend page, and the i18n keys to tie them together:
pnpm sk:scaffold feature analytics
pnpm sk:scaffold feature pricing --zone public
pnpm sk:scaffold feature webhooks --unprotected
pnpm sk:scaffold feature reports --dry-run
It creates:
- A backend route with CRUD endpoints, Zod validation, auth middleware, and placeholders for your database queries.
- A frontend page with data fetching, loading and empty states, and test IDs.
- Backend wiring — the import and route registration are inserted for you.
- i18n keys added to every configured locale.
Pages
Generate a frontend page (no backend route). Pages belong to a zone that determines their route group and layout:
pnpm sk:scaffold page reports
pnpm sk:scaffold page pricing --zone public
pnpm sk:scaffold page onboarding --zone auth
| Zone | URL pattern | Layout | Use case |
|---|---|---|---|
dashboard (default) | /{locale}/{name} | Sidebar / nav | Protected pages |
public | /{locale}/{name} | Locale layout only | Marketing, landing, legal |
auth | /{locale}/auth/{name} | Auth layout | Sign-in flow extensions |
Routes
Generate a backend API route with Zod validation and CRUD stubs:
pnpm sk:scaffold route notifications
pnpm sk:scaffold route webhooks --unprotected
After creating a route, add a model to your .prisma.part file, generate the client and migrate, then replace the TODO stubs with real queries.
Options
| Flag | Description |
|---|---|
--dry-run | Preview without writing files |
--zone, -z <zone> | Page zone: dashboard, public, or auth |
--path, -p <path> | Custom sub-path for page nesting |
--unprotected | Backend route without auth middleware |
--list | Show all available generators |