Use the Readonly Client extension
mainThe Readonly Client extension creates a Prisma Client instance that restricts operations to read-only methods (e.g., findMany, count). It prevents write operations (e.g., create, update) by throwing errors at both runtime and compile time via TypeScript.
Note: This extension is provided as an example only and is not intended for production use. It is built using the query extension mechanism.
// Conceptual usage: The extension restricts the client to read operations
// findMany and count will work
// create and update will fail at compile time and runtime