Folder Structure
A high-level map of the repo layout and the files you'll touch most.
├── actions/ # Server actions — billing, team, workspace, projects, notifications
├── app/
│ ├── (auth)/ # Sign-in, sign-up, password reset, accept invitation
│ ├── (dashboard)/ # All protected routes (dashboard, settings, team, pricing…)
│ ├── (onboarding)/ # Post sign-up onboarding flow
│ └── api/ # Auth handler, upload handler, Stripe webhooks
├── components/
│ ├── auth/ # Auth form components
│ ├── dashboard/ # Sidebar, org switcher, notifications, pricing cards, settings tabs
│ ├── documents/ # Documents table, form, dialogs
│ ├── projects/ # Projects table, form, dialogs
│ ├── team/ # Team table, invite sheet, remove dialog
│ └── ui/ # All shadcn/ui components
├── db/
│ ├── schema/ # Drizzle table definitions — add new tables here
│ └── index.ts # Drizzle client
├── emails/ # React Email templates (invite, verify, reset password)
├── hooks/ # TanStack Query client hooks
├── lib/ # Core utilities — auth, env, plans, permissions, stripe, notify
├── store/ # Zustand global store
├── __tests__/ # Vitest unit tests
├── e2e/ # Playwright E2E tests
├── proxy.ts # Edge middleware (route protection + redirects)
└── docker-compose.yml # Local services — Postgres, MinIO, MailpitFiles you'll touch most
| File | What it's for |
|---|---|
lib/env.ts | All env vars — import env or clientEnv, never process.env directly |
lib/plans.ts | Billing plan definitions — prices, limits, Stripe Price IDs |
lib/permissions.ts | RBAC roles and permissions — extend to add new resources |
lib/notify.ts | Notification helpers — fire from any server action |
constants/routes.ts | Add new protected or auth routes here |
db/schema/ | Add new tables here, then run pnpm db:push |
proxy.ts | Runs before every request — add redirect or auth logic here |