Interview Questions/System Design/Design a GraphQL Gateway at Scale
IntermediateSystem-Design
30 min

Design a GraphQL Gateway at Scale

APIsGraphQLCachingSecurity
Advertisement
Interview Question

Design a federated GraphQL gateway that composes multiple subgraphs, with caching, authorization, and schema evolution.

Key Points to Cover
  • Schema federation, composition, and versioning
  • Resolver performance, batching (DataLoader), N+1 mitigation
  • Edge caching for query result subsets and persisted queries
  • AuthN/Z directives and field-level enforcement
  • Observability: per-field latency, error budgets
Evaluation Rubric
Sound federation & schema evolution25% weight
Mitigates N+1 and latency hotspots25% weight
Effective GraphQL caching & persisted queries25% weight
Auth patterns at field level25% weight
Hints
  • 💡Persisted queries reduce parse/validation overhead.
Common Pitfalls to Avoid
  • ⚠️Over-reliance on a single caching layer, neglecting edge caching or in-memory solutions.
  • ⚠️Implementing authorization solely at the gateway, leading to inefficient or insecure subgraph interactions.
  • ⚠️Neglecting N+1 problem mitigation, resulting in severe performance issues as query complexity grows.
  • ⚠️Lack of a clear schema evolution strategy, leading to breaking changes for clients without proper notice or migration paths.
  • ⚠️Insufficient monitoring of gateway performance and cache effectiveness, hindering proactive issue identification and resolution.
Potential Follow-up Questions
  • How do you deprecate fields safely?
  • How to rate-limit queries?
Advertisement