coldstart

Project structure

Every file and package explained

After coldstart init, you get a Turborepo monorepo. What's inside depends on the platforms and features you selected. Here's a full-stack example (web + API + billing + i18n):

Root

CLAUDE.md
.coldstart.json
turbo.json
biome.json
lefthook.yml
pnpm-workspace.yaml
tsconfig.json
.nvmrc — Node 24

Web app (apps/web/)

Scaffolded by create-next-app, then patched with auth, billing, theming, and i18n.

pricing/page.tsx — plans with checkout buttons
billing/success/page.tsx — post-checkout
billing/cancel/page.tsx — cancelled payment
admin/page.tsx — admin dashboard

Key patterns:

  • [locale]/ structure for i18n (e.g. /en/dashboard, /fr/dashboard)
  • (auth)/ group for public auth pages, (app)/ group for authenticated routes
  • useBilling() hook fetches from /billing/status — returns isPremium, tier, credits
  • <PremiumGate> wraps content that requires a paid plan — shows upgrade prompt if free

API (apps/api/)

Generated from scratch with Hono, Better Auth, Drizzle, and typed middleware.

index.ts — server entry point (port 3001)
app.ts — routes, CORS, auth handler
types.ts — AppEnv for typed c.get('user')

Key patterns:

  • OpenAPIHono<AppEnv> — typed context, c.get("user") returns { id, email, name }
  • Auth routes at /api/auth/* forwarded to Better Auth
  • Billing middleware queries userBilling table — no unsafe casts
  • Webhooks verify signatures and write real DB operations
  • OpenAPI docs at /openapi

Shared packages

packages/db/ — Drizzle ORM with Neon PostgreSQL

client.ts — Neon connection
schema.ts — re-exports all schemas
auth-schema.ts — Better Auth tables (generated)
billing-schema.ts — userBilling table
tenant-schema.ts — orgs, members, invitations (if multi-tenant)
index.ts — exports db + schema
Database commands
pnpm -F @my-saas/db db:generate   # Generate migrations
pnpm -F @my-saas/db db:migrate    # Run migrations
pnpm -F @my-saas/db db:studio     # Open Drizzle Studio

packages/env/ — Zod-validated environment variables

Three entry points, one per platform:

  • ./server — DATABASE_URL, BETTER_AUTH_SECRET, Stripe/Polar keys
  • ./web — NEXT_PUBLIC_API_URL, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
  • ./native — EXPO_PUBLIC_API_URL, RevenueCat keys

If any required variable is missing, the app fails at startup — not at the first request.

packages/email/ — React Email templates

Three templates pre-built:

  • verification.tsx — email verification link
  • reset-password.tsx — password reset link
  • welcome.tsx — welcome email after signup

Preview with: pnpm -F @my-saas/email dev

packages/config/ — shared TypeScript config

tsconfig.base.json extended by all apps and packages. Strict mode, ES2022 target, bundler module resolution.

Key files

FilePurpose
CLAUDE.mdAI context: stack, domain guidelines, conventions, commands, how-to guides, MCP servers
.coldstart.jsonEvery option you selected — use with coldstart replay to reproduce
.claude/settings.jsonMCP servers (Neon, Vercel, Polar, RevenueCat, Resend, Expo)
turbo.jsonBuild pipeline: dev, build, check-types, lint, test
biome.jsonLinter/formatter: tabs, 100 chars, double quotes, semicolons
lefthook.ymlGit hooks: pre-commit (lint), pre-push (check-types + test)
docker-compose.ymlLocal PostgreSQL for development

On this page