2026-05-21backend

Prisma introduced alongside raw postgres (dual DB clients)

  • Change: Prisma Client (with @prisma/adapter-pg driver adapter over a pg.Pool) added in lib/prisma.ts exclusively for Better Auth's Prisma adapter. prisma/schema.prisma defines auth models (user, session, account, verification) plus a mirror posts model. A postinstall script runs prisma generate.
  • Why: Better Auth's Prisma adapter requires a Prisma client; replacing the raw postgres client for post queries would have been a larger scope change.
  • Affected Modules: lib/prisma.ts, prisma/schema.prisma, prisma.config.ts, app/lib/auth.ts, package.json, pnpm-workspace.yaml
  • Trade-offs:
    • Pro: Unlocks Better Auth's full relational adapter; auth tables are now schema-managed.
    • Con: Two database clients now coexist (lib/db.ts for posts, lib/prisma.ts for auth). They must never be swapped — post queries must stay on the raw sql client; auth queries must go through Prisma.