Prisma Client extensions are now available in Preview, enabling developers to add custom functionality to Prisma Client in a type-safe way. Extensions support four component types: Model (add methods to models), Client (add top-level methods), Query (hook into query lifecycle), and Result (add computed fields/methods to results). The post walks through 15 practical use cases including computed fields, field obfuscation, input validation with Zod, query logging, retry transactions with exponential backoff, callback-free interactive transactions, audit log context, and row-level security for multi-tenant apps. Extensions can be composed, applied to separate client instances, and published to npm using the prisma-extension-* naming convention.

9m read timeFrom prisma.io
Post cover image
Table of contents
Table Of ContentsIntroductionUsing Prisma Client extensionsSample use casesTell us what you think