Building Your AppScaffolding

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:

  1. A backend route with CRUD endpoints, Zod validation, auth middleware, and placeholders for your database queries.
  2. A frontend page with data fetching, loading and empty states, and test IDs.
  3. Backend wiring — the import and route registration are inserted for you.
  4. 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
ZoneURL patternLayoutUse case
dashboard (default)/{locale}/{name}Sidebar / navProtected pages
public/{locale}/{name}Locale layout onlyMarketing, landing, legal
auth/{locale}/auth/{name}Auth layoutSign-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

FlagDescription
--dry-runPreview without writing files
--zone, -z <zone>Page zone: dashboard, public, or auth
--path, -p <path>Custom sub-path for page nesting
--unprotectedBackend route without auth middleware
--listShow all available generators

Next steps