Schema
Database schema
Postgres schema is defined in Drizzle as packages/server/src/db/schema.ts. Migrations live under the monorepo migration workflow (see root drizzle.config.ts and app db:* scripts).
Design principles
- Multi-tenant — business entities that belong to a customer workspace include
organization_id(or equivalent FK). - Better Auth —
users,sessions,accounts, andverificationsfollow Better Auth conventions (string ids where required).
Enums (Postgres)
Core tables
Product / operator tables
Better Auth tables
TypeScript types
Drizzle infers $inferSelect / $inferInsert types exported next to each table in schema.ts for use in server code.
Related
- Database seeding
- Stripe & billing —
subscriptionssync