Skip to content

refactor(prisma): export global singleton Prisma client instance in [prisma.ts] #180

Description

@mspandey

Problem

Currently, prisma.ts implements a cached singleton pattern for the PrismaClient instance to prevent exhausting database connection pools during hot reloads in development environments. Ensuring clean ES module exports is essential for reliable database client sharing across backend services and API routes.

Proposed Solution

Verify and maintain clean ES module export for the prisma client instance in prisma.ts.

Acceptance Criteria

  • Export the singleton prisma instance from prisma.ts.
  • Ensure development logging configuration correctly enables warning and error logging when NODE_ENV is set to development.
  • Verify that attaching the client instance to the global scope during non-production environments prevents multiple client instantiations during hot reloads.
  • Confirm that importing the Prisma client into backend database queries passes all integration test suites successfully.

Please assign this issue to me.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions