What a GraphQL gateway does
A GraphQL gateway exposes one typed schema that stitches together many backend services. Clients ask for exactly the fields they need in a single query.
- It resolves each field by calling the owning service.
- It composes subschemas into one supergraph, often via federation.
- Clients avoid overfetching and underfetching by shaping the response themselves.
How a query resolves
One client query fans out to several services, then the gateway assembles the result.
Benefits
- A single round trip can gather data that REST would need many calls for.
- The typed schema documents the API and catches errors early.
- Each team owns its subgraph independently.
Hard parts
- The N plus one problem appears when a field resolves per item; batch with a loader.
- Caching is harder than REST because queries vary in shape.
- A complex query can be expensive, so enforce depth and cost limits.
Key idea
A GraphQL gateway federates services into one typed graph so clients fetch exactly what they need, but you must guard against N plus one and costly queries.