# Prisma solution docs

- [Prisma types are wrong after a schema edit: generated client drift](https://agenticboilerplate.com/cookbook/prisma/client-drift-after-schema-edit): The Prisma client is generated code. Edit the schema without regenerating and TypeScript describes the old database, locally, in CI-free builds and after a cached deploy.
- [Prisma in dev: "too many clients already" after a few saves](https://agenticboilerplate.com/cookbook/prisma/hot-reload-client-leak): Next.js hot reload re-runs your module and builds a new PrismaClient every time. Cache one instance on globalThis and the connection leak stops.
- [Running Prisma migrations on Vercel without breaking production](https://agenticboilerplate.com/cookbook/prisma/migrate-deploy-on-vercel): Put prisma generate and prisma migrate deploy in the Vercel build command, never db push or migrate dev, and design migrations to survive a rolling deploy.
- [Fixing N+1 queries in Prisma with include, select and groupBy](https://agenticboilerplate.com/cookbook/prisma/n-plus-one-with-include): A loop that queries per row turns one page load into hundreds of round trips. Fetch relations in the parent query, batch by id, and aggregate in the database.
- [Prisma on serverless: why you need a pooler URL and a direct URL](https://agenticboilerplate.com/cookbook/prisma/serverless-connection-pooling): Each serverless instance opens its own Postgres pool, so traffic exhausts connections. Route runtime queries through a pooler and keep a direct URL for migrations.

---

Agentic Boilerplate: A Next.js repo your agent already knows. Free during launch, then $99 once.

- Site map for agents: https://agenticboilerplate.com/llms.txt
- Public API: https://agenticboilerplate.com/openapi.json
- Contact: agenticstudio@gmail.com
