Project structure
Seven workspaces, and what lives where inside the backend.
Workspaces
| Folder | What it is |
|---|---|
backend | Fastify and tRPC API, Drizzle schema and migrations, Better Auth |
web-app | The auth-gated app — Vite and React |
desktop | The same app in Tauri, with its own routes and build |
web-static | Marketing site — Next.js |
blog | Blog — Next.js static export |
docs | This site — Next.js and Fumadocs |
shared-ui | Components and tokens used by every frontend |
email-templates | React Email templates, built into the backend |
Repo-wide files at the root:
CLAUDE.md— the build rules. Read it before writing UI.COMPONENTS.md— the spec for everyshared-uicomponent.bones-style-guide.html— every token and component, rendered.TODOS.md— the backlog.NOTES.md— decisions and the reasons behind them.
Inside the backend
| Path | What's there |
|---|---|
src/index.ts | Server setup and the non-tRPC routes |
src/auth.ts | Better Auth config and session fields |
src/trpc/trpc.ts | Procedure builders — protectedProcedure, requirePermission, and the rest |
src/trpc/router.ts | The root router, and the AppRouter type the apps import |
src/trpc/routers/ | One file per router, with its test beside it |
src/db/ | One schema file per table |
drizzle/ | Generated SQL migrations. Never edit these |
src/permissions.ts | hasPermission and friends |
src/storage/ | S3 client and presigned URL helpers |
src/email/ | sendEmail |
src/lib/logging/ | Request and database-change logs |
src/lib/chat/ | Chatbot providers |
Related
- Adding a procedure — where a new endpoint goes.
- Schema and migrations — where a new table goes.
- Clients — why there are three frontends.