import { PrismaClient } from "@prisma/client/edge"; import { withAccelerate } from "@prisma/extension-accelerate"; // creating PrismaClient here prevents next.js from starting too many concurrent prisma instances and exhausting the // number of connection pools available (especially when hot reloading from `next dev`). // https://www.prisma.io/docs/guides/other/troubleshooting-orm/help-articles/nextjs-prisma-client-dev-practices const globalForPrisma = global as unknown as { prisma: PrismaClient }; export const prisma = globalForPrisma.prisma || new PrismaClient().$extends(withAccelerate()); if (process.env.NODE_ENV !== "production") globalForPrisma.prisma = prisma;