Skip to main content
Goal: /graphql (or custom path) + PrismaService inside QueryRoot / MutationRoot. MdBook anchor: Recipe C.

Cargo.toml

Minimal schema build

CRUD resolvers (production-shaped)

Combine SimpleObject types with prisma_model!—same queries as REST, different transport. Clamp take / skip server-side so public GraphQL cannot scan the whole table.

Operating GraphQL like a product API

Adjust delete_many vs single delete to match your macro-generated client (prisma_model_client.rs).

Global prefix + GraphQL URL

If you call .set_global_prefix("platform"), POST GraphQL to /platform/graphql, not /graphql alone.

Batch POST

Chain .enable_openapi() on the same NestFactory when you feature-gate openapi—REST controllers and GraphQL coexist on one router.