Complete project scaffold with working auth, REST API, Prisma/SQLite schema, Docker config, and React frontend for both Rack Planner and Service Mapper modules. Both server and client pass TypeScript strict mode with zero errors. Initial migration applied. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
456 B
TypeScript
15 lines
456 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
// Singleton pattern prevents multiple PrismaClient instances in dev (hot reload)
|
|
const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };
|
|
|
|
export const prisma =
|
|
globalForPrisma.prisma ??
|
|
new PrismaClient({
|
|
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
|
|
});
|
|
|
|
if (process.env.NODE_ENV !== 'production') {
|
|
globalForPrisma.prisma = prisma;
|
|
}
|