Choose an ORM
SetDATABASE_ORM in apps/api/.env:
Prisma (default)
- Uses
prisma/schema.prismaand Prisma migrations. db:generate,db:migrate, anddb:pushrun Prisma commands whenDATABASE_ORM=prisma.
Drizzle + Neon
- Uses Drizzle ORM with the Neon serverless driver (and
pgfor local Postgres). - You can reuse the same Postgres schema; the adapter targets the same tables.
- Drizzle is code-first: the
schema.tsfile defines tables, and Drizzle Kit generates SQL migrations from it.
Drizzle workflow
- Edit
apps/api/src/lib/db/schema.ts - Generate SQL migrations:
pnpm --filter api db:generate - Apply to the database:
pnpm --filter api db:push
Remove the ORM you don’t use
After you pick one ORM, delete the other to avoid confusion and remove the unused dependencies fromapps/api/package.json.
If you choose Prisma, remove Drizzle
- Delete Drizzle files:
apps/api/src/lib/db/drizzle-adapter.tsapps/api/src/lib/db/schema.tsapps/api/drizzle.config.tsapps/api/drizzle/
- Remove Drizzle dependencies from
apps/api/package.json:drizzle-ormdrizzle-kit@neondatabase/serverlessws+@types/ws
- Update
apps/api/src/lib/db/index.tsto only load Prisma.
If you choose Drizzle, remove Prisma
- Delete Prisma files:
apps/api/prisma/apps/api/src/lib/db/prisma-adapter.tsapps/api/src/generated/
- Remove Prisma dependencies from
apps/api/package.json:prisma@prisma/client@prisma/adapter-pg
- Update
apps/api/src/lib/db/index.tsto only load Drizzle. - Update the build script to remove
prisma generate.
Notes
db:generate,db:migrate, anddb:pushauto-select Prisma or Drizzle based onDATABASE_ORMinapps/api/.env.db:resetruns Prisma reset. For Drizzle, use manual SQL or a dedicated reset workflow.- For Neon setup and safe migration guidance, see Neon Database.
- Prisma and Drizzle migrations are separate workflows. Pick one toolchain per project and keep it consistent.
- Switching the ORM does not change your database; it only changes the client.