Codebase
Database
Configure PostgreSQL and Drizzle in the TanStack Start edition.
Set DATABASE_URL in .env to a PostgreSQL connection string. Authentication, organizations, billing and application data use the same database.
The schema is in lib/db/schema; committed SQL migrations are in lib/db/migrations. After changing the schema, run npm run db:generate, review the generated SQL and run npm run db:migrate. Apply those same committed migrations in production.
npm run db:generate
npm run db:migrate
npm run db:studionpm run db:push is only for disposable local prototyping because it changes the database without producing migration history. Keep tenant-owned queries scoped by organization ID: route-level membership checks do not replace authorization inside mutations or background work.