Skip to main content
Codebase

Database

Configure PostgreSQL and Prisma in the TanStack Start edition.

Open MarkdownFull AI corpusFeedback

Set DATABASE_URL in .env to a PostgreSQL connection string. Authentication, organizations, billing and application data use the same database.

The schema is in prisma/schema.prisma; committed migrations are in prisma/migrations. Use npm run db:migrate:dev to create and apply a migration during development. npm run db:generate regenerates the Prisma client; it does not create a migration. Use npm run db:migrate to apply committed migrations in a fresh environment or deployment.

npm run db:migrate:dev
npm run db:studio

npm run db:push is only for disposable local prototyping because it changes the database without producing migration history. Commit and review migration SQL before deploying schema changes. Keep tenant-owned queries scoped by organization ID: route-level membership checks do not replace authorization inside mutations or background work.