Getting started
Project structure
Where code lives, and why every feature looks the same.
01Layout
The top-level folders of a fresh project:
- app/
- (auth)/
- (dashboard)/
- (marketing)/
- admin/
- api/
- features/
- billing/
- components/
- server/
- pages/
- config.ts
- …
- config/
- brand.ts
- fonts.ts
- modules.ts
- plans.ts
- db/
- migrations/
- schema.ts
- emails/
- lib/
- scripts/
- tests/
- e2e/
- unit/
- .agents/
- skills/
- AGENTS.md
- PRODUCT.md
| Folder | Purpose |
|---|---|
app | Routes only. Pages render components from features/*/pages |
features | One folder per part of the product: components, server code, pages, config |
config | Brand, fonts, plans and modules: what you change to make it yours |
db | schema.ts, the only schema file, and generated migrations |
emails | React Email templates |
lib | Validated env, logger, rate limiting, email sending |
scripts | setup, seed, new-feature, db-query, brand-check, sync-agents, e2e-local |
tests | Unit tests (Vitest) and end-to-end tests (Playwright) |
.agents/skills | Agent skills, synced into each tool's folder |
AGENTS.md | The rules your agent reads first |
PRODUCT.md | Your product brief: name, voice, pricing, facts agents may state |
02Feature folders
Each folder in features/ owns one part of the product: account, admin, ai, analytics, api, audit, auth, billing, flags, jobs, marketing, storage, teams and workspaces.
Files that touch the database, secrets or provider SDKs live in server/ and start with import "server-only". Client components import only browser-safe modules and server actions.
03Personal and team routes
Every page that belongs to a workspace exists twice: app/(dashboard)/dashboard/(personal)/x and app/(dashboard)/dashboard/[team]/x. Both render the same component, which calls workspaceFromParams(params) to know which workspace it is in.