TanStack Start, Prisma 7, and Bun fit together cleanly, but there are a handful of small decisions you want to get right before the code lands in production. This post is the list I'd want written down before starting.
Highlights: Prisma 7 moved the runtime datasource into prisma.config.ts (the url = env(...) form in schema.prisma no longer works); @prisma/adapter-pg is the shortest path on Bun and turns connection behaviour into plain pg knowledge; the stash-on-globalThis singleton is non-negotiable under Vite HMR; and @map / @@map give you snake_case in Postgres and camelCase in TypeScript with zero runtime cost.
The trickiest one is keeping Prisma out of the client bundle. createServerFn handles the obvious case, but a shared service module that's transitively reachable from the client graph still needs a dynamic import('./db') to keep Vite from trying to bundle Node built-ins.
Originally published at andreasbergstrom.dev — read the full post there.
Top comments (0)