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
Web app (apps/web/)
Scaffolded by create-next-app, then patched with auth, billing, theming, and i18n.
Key patterns:
[locale]/structure for i18n (e.g./en/dashboard,/fr/dashboard)(auth)/group for public auth pages,(app)/group for authenticated routesuseBilling()hook fetches from/billing/status— returnsisPremium,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.
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
userBillingtable — no unsafe casts - Webhooks verify signatures and write real DB operations
- OpenAPI docs at
/openapi
Shared packages
packages/db/ — Drizzle ORM with Neon PostgreSQL
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 Studiopackages/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 linkreset-password.tsx— password reset linkwelcome.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
| File | Purpose |
|---|---|
CLAUDE.md | AI context: stack, domain guidelines, conventions, commands, how-to guides, MCP servers |
.coldstart.json | Every option you selected — use with coldstart replay to reproduce |
.claude/settings.json | MCP servers (Neon, Vercel, Polar, RevenueCat, Resend, Expo) |
turbo.json | Build pipeline: dev, build, check-types, lint, test |
biome.json | Linter/formatter: tabs, 100 chars, double quotes, semicolons |
lefthook.yml | Git hooks: pre-commit (lint), pre-push (check-types + test) |
docker-compose.yml | Local PostgreSQL for development |