Elysia.js API with session-based auth (email/password + Google OAuth), role system (USER/ADMIN/SUPER_ADMIN), Prisma + PostgreSQL, React 19 with Mantine UI, TanStack Router, dark theme, and comprehensive test suite (unit, integration, E2E with Lightpanda). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
14 lines
369 B
TypeScript
14 lines
369 B
TypeScript
import { PrismaClient } from '../../generated/prisma'
|
|
|
|
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient }
|
|
|
|
export const prisma =
|
|
globalForPrisma.prisma ??
|
|
new PrismaClient({
|
|
log: process.env.NODE_ENV === 'development' ? ['warn', 'error'] : ['error'],
|
|
})
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
globalForPrisma.prisma = prisma
|
|
}
|