ZenStack is a fullstack enhancement layer for Prisma ORM that provides seamless integration from database to UI. It extends Prisma with access policies, automatic API generation (REST and RPC), client-side hooks for React/TanStack Query, Zod schema generation, and more. Current stable version is 3.6.2, with active releases roughly every month. Key differentiators: declarative permission policies similar to Firebase Security Rules, custom types with relations, OpenAPI spec generation, and deep integration with Prisma without replacing it. Requires Prisma 5.0+ and Zod 3.25+ as peer dependencies.
npm install zenstackVerified import paths — ran on the pinned version, not inferred.
Shows how to set up a ZenStack-enhanced Prisma client with a permissive policy for reading users.
Update imports: use @zenstackhq/tanstack-query instead of @zenstackhq/react.
Change 'import { generateZodSchemas } from "zenstack"' to 'import { generateZodSchemas } from "@zenstackhq/zod"'.Replace imports with specific @zenstackhq/* packages.
Use @@allow and @@deny with auth() conditions; test policies thoroughly.
Run 'npm install @zenstackhq/runtime'.
Use 'import { enhance } from "@zenstackhq/runtime"'; then call 'enhance(prisma, { getCurrentUser })'.