Breaking changes in Prisma Client v6.14

Prisma Client v6.14 migration guide in NestJS: stop extending PrismaClient. Declare a client property and initialize it in the constructor; update calls to this.prisma.client. Contact Q2BSTUDIO for advice and migration.

lunes, 18 de agosto de 2025 • 3 min read • Q2BSTUDIO Team

Artificial-Intelligence-

Summary of breaking changes in Prisma Client v6.14 and how to adapt your custom Prisma service in NestJS

If you use Prisma ORM in a NestJS project and created a custom Prisma service that extends the generated client, pay attention to a relevant change in Prisma version 6.14. Until Prisma v6.13 it was common to define a service that extended PrismaClient, but starting from v6.14 that approach causes compilation errors and must be modified.

Pattern prior to v6.14: many projects had a service that extended PrismaClient and added module initialization and other hooks. A conceptual example was declaring the PrismaService class extends PrismaClient and implementing OnModuleInit to manage connection and disconnection.

New recommendation in v6.14: do not extend PrismaClient anymore. Instead, declare a public property of type PrismaClient and create the instance in the constructor. This way the client will be accessible from other parts of the code to perform database queries. Conceptual implementation example: readonly client: PrismaClient; constructor() { this.client = new PrismaClient() }

Updated usage in other services: where you previously called this.prisma.user.findMany, you must now use this.prisma.client.user.findMany. This simple substitution resolves the compilation error and keeps it clear that the PrismaClient instance is a property of the service and not the base class.

Practical steps to migrate: 1 Update your Prisma service to remove extends PrismaClient and instead declare the client property and create the instance in the constructor. 2 Ensure proper initialization and shutdown by calling client.$connect and client.$disconnect in NestJS hooks such as OnModuleInit and OnModuleDestroy. 3 Replace all this.prisma.entity calls with this.prisma.client.entity or create getters/proxies if you want to minimize changes across the entire codebase. 4 Run tests and compile to verify that no references to extending the client remain.

Additional tips: if you want to avoid touching many references in the code, you can add methods or getters in PrismaService that delegate to this.client, for example get user() { return this.client.user } so that continuing to use this.prisma.user is possible without extending the class. Another option is to create helpers or wrappers to encapsulate data access logic and maintain a stable contract for the rest of the application.

Impact on lifecycle and best practices: maintaining explicit control of the PrismaClient instance makes it easier to manage the connection in serverless environments and in processes with restarts. Make sure to call client.$connect at startup and client.$disconnect at shutdown, and consider using centralized error handling for reconnections and logs.

About Q2BSTUDIO: at Q2BSTUDIO we are a software development company specialized in custom applications and custom software. We offer complete solutions that include artificial intelligence integration and AI for businesses, development of AI agents and dashboards with power bi for business intelligence. We also provide cybersecurity services, aws and azure cloud services and consulting for business intelligence services. If you need to migrate Node and NestJS applications with Prisma, optimize databases or integrate AI and analytics solutions, our team can help you adapt your architecture and ensure compatibility and security.

Keywords and positioning: custom applications, custom software, artificial intelligence, cybersecurity, aws and azure cloud services, business intelligence services, AI for businesses, AI agents, power bi.

Contact and next step: if you want Q2BSTUDIO to review your project and carry out the migration or implement best practices with Prisma Client v6.14, contact our team for technical evaluation, proposal and custom quote.

OUR SERVICES

How we can help you

Do you have a project in mind?

Tell us your vision and we'll turn it into a software solution. Whatever the scope, we make your idea real.