Templates
| Template | Use case |
|---|---|
saas-b2b | Multi-tenant SaaS with Next.js 16 + tRPC + Postgres + Drizzle + Better-Auth |
api-only | Pure backend service: NestJS + Fastify + Drizzle |
lib | TypeScript library: Hono (optional) + tsup + Changesets, ESM-only |
saas-b2b
Section titled “saas-b2b”The flagship template. Layout:
apps/web/ Next.js 16 (App Router, RSC)packages/db/ Drizzle schema (auth + tenants), client, migrationspackages/auth/ Better-Auth server + clientpackages/trpc/ Routers, context, public/protected/tenant procedurespackages/shared/ Zod schemaspackages/ui/ shadcn-based components, cn helperdocker-compose.yml Postgres 16 + Redis 7Highlights:
- Multi-tenant pool + Postgres RLS via
tenantProcedure(setsapp.tenant_idper request). - End-to-end type safety: Drizzle → Zod → tRPC → React Query.
- Auth handler at
app/api/auth/[...all]/route.ts, tRPC handler atapp/api/trpc/[trpc]/route.ts. - Sign-in / sign-up / dashboard scaffolded.
api-only
Section titled “api-only”Minimal NestJS service with Fastify and Pino logging. Use when the team needs a pure backend without the Next.js footprint.
Library template with tsup, Vitest, and Changesets pre-wired. ESM only. Includes an optional Hono server factory in src/index.ts for projects that want to ship both a library and a small server.
Authoring a new template
Section titled “Authoring a new template”- Create
templates/<name>/manifest.json(name,displayName,description,features[],postInit). - Add files. Any file ending in
.hbsis rendered through Handlebars; the.hbsextension is stripped. - The CLI passes
{ projectName, features }into the render context. Use the case helpers (pascalCase,kebabCase, …). - Add a smoke test in
packages/cli/tests/<name>-smoke.test.tsthat asserts critical files render without leftover{{markers.