2026-05-21backend
Prisma introduced alongside raw postgres (dual DB clients)
- Change: Prisma Client (with
@prisma/adapter-pgdriver adapter over apg.Pool) added inlib/prisma.tsexclusively for Better Auth's Prisma adapter.prisma/schema.prismadefines auth models (user,session,account,verification) plus a mirrorpostsmodel. Apostinstallscript runsprisma generate. - Why: Better Auth's Prisma adapter requires a Prisma client; replacing the raw
postgresclient 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.tsfor posts,lib/prisma.tsfor auth). They must never be swapped — post queries must stay on the rawsqlclient; auth queries must go through Prisma.