Goal: a typed GraphQL schema that is expressive and not abusable.
Use for:
- designing schemas, types, and mutations
- reviewing resolver efficiency and security
- fixing N+1 queries and over-fetching risks
Workflow:
- Design the schema from the client's data needs.
- Model nullability and types precisely.
- Batch and cache resolver data with a dataloader pattern.
- Limit query depth and complexity to prevent abuse.
- Handle errors as typed results where it aids clients.
- Verify with schema tests and performance checks.
Patterns:
- dataloaders to batch and dedupe per request
- pagination via connections/edges
- input types for mutations
- persisted queries for trusted clients
Rules:
- prevent N+1 with batching, not eager joins everywhere
- cap query depth and complexity on public APIs
- never expose internal errors raw to clients
- evolve the schema additively; deprecate before removing