Field guide · 10 practical articles
Ship Prisma APIs faster. Generate the repetitive parts.
Ten practical guides to shipping Prisma APIs faster with generated CRUD routes, OpenAPI, pagination, hooks, guarded shapes, tenant scope, and SSE.
The reading path
From Prisma schema to working API
Start with generated routes, then add the features your product needs: callers, guards, hooks, pagination, streaming, and writes.
- A1 Architecture A whole product API without writing an endpoint: Prisma + generated RPC routes Build a generated Prisma HTTP API with guarded shapes, caller variants, projection, pagination, and tenant scope.
- A2 Tenant isolation Seven ways to leak a tenant through a query API—and the declarative fix for each Find tenant-isolation failures in query shapes, hooks, variants, nested reads, scope maps, and dropped guards.
- A3 Shape semantics force(), true, and the difference between a default and a boundary Understand forced Prisma values, strict positions, merge behavior, validation, scope limits, and direct shape tests.
- A4 Caller routing One model, five audiences: caller routing with named and parameterized variants Route public and privileged callers to separate declared Prisma contracts without trusting client-selected headers.
- A5 Hooks When configuration runs out: hooks that narrow, hooks that enrich, hooks that must not exist Place generated-route hooks at the correct lifecycle boundary and keep authorization, shapes, scope, and transport behavior separate.
- A6 Projection Projection is a security boundary: select, include, and the relation that carries no scope Protect Prisma projections across reads, mutations, nested relations, caller variants, counts, and unguarded paths.
- A7 Read paths Reads at scale: pagination totals, POST reads, and streaming a page before it is complete Verify generated pagination, count strategies, POST reads, progressive SSE events, fallbacks, and hook behavior.
- A8 Write paths Writes: forced data, upserts, relation writes, and not deleting the table Guard generated Prisma writes across create, update, bulk operations, upsert, relations, projection, and provider limits.
- A9 Error reference Every error this stack throws, and what actually caused it Look up reproduced prisma-guard and prisma-generator-express errors by message, cause, and correction.
- A10 Silent failures Silent semantics and testing traps: when no error tells you the shape is wrong Diagnose successful requests whose forced values, projections, scope, pagination, counts, or test mode behave unexpectedly.
Evidence, not folklore
Every runtime claim has a trail.
Claims trace to the project READMEs, the reproducible guard lab, or the HTTP/PostgreSQL lab. Error text and runtime results are version-pinned.