PATTERN Cited by 2 sources
Federated GraphQL subgraph per domain¶
When to use¶
You have:
- A GraphQL supergraph that many teams share.
- Multiple product domains (search, billing, content, notifications, …) each owned by a different team.
- Pressure to ship per-domain schema changes without coordinating across all teams.
- A supergraph router (Apollo Federation or equivalent) that can compose schemas.
The pattern¶
One subgraph per domain, owned by the domain team. Each subgraph:
- Declares the types and fields the domain owns.
- Runs as its own service with its own deploy cadence.
- Implements its own resolvers, authenticated at the router or inside the subgraph.
- Can have arbitrarily different backends behind it (REST APIs, databases, message queues) — the GraphQL shape is a facade.
The supergraph router composes the subgraph schemas into a single schema, dispatches fields to owning subgraphs, and presents one endpoint to clients.
Canonical wiki instance: Yelp CHAOS¶
Yelp's CHAOS server-driven-UI framework is one subgraph in Yelp's Apollo Federation supergraph:
- Subgraph: a Python service built on
Strawberry, owning the
chaosConfigurationquery and theChaosView,ChaosJsonComponent,ChaosJsonActiontypes. - Backends behind the subgraph: "multiple CHAOS backends that implement a CHAOS REST API" — one REST backend per owning team, not one Python service. The subgraph routes the request to the right backend based on the requested view name.
clients (iOS / Android / web)
│
▼
┌──────────────────────┐
│ Apollo Federation │
│ router (supergraph) │
└──────┬──────┬────────┘
▼ ▼
┌─────────────┐ ┌─────────────┐
│ CHAOS │ │ other │
│ subgraph │ │ subgraphs │
│ (Python, │ │ (search, │
│ Strawberry) │ │ billing…) │
└─────┬───────┘ └─────────────┘
│ CHAOS REST API
▼
┌───────────────────────┐
│ N CHAOS backends │ ← one per owning team
│ (team-owned services) │
└───────────────────────┘
Verbatim (2025-07-08): "This federated architecture allows us to manage our CHAOS-specific GraphQL schema independently while seamlessly integrating it into Yelp's broader Supergraph. Behind the GraphQL layer, we support multiple CHAOS backends that implement a CHAOS REST API to serve CHAOS content … This architecture allows different teams to manage their CHAOS content independently on their own services, while the GraphQL layer provides a unified interface for client requests."
This is one level deeper than the older unified GraphQL API platform pattern — the subgraph itself is a thin facade that fans out to multiple team-owned REST backends, rather than being the single owner of its domain's data.
Contrast with adjacent patterns¶
- Single-owner subgraph — one team owns the subgraph and the backend. Simpler; doesn't scale to product areas like CHAOS where many teams contribute content.
- Schema stitching / API gateway — the router merges multiple upstream schemas without the Federation directives; works but has well-documented composition issues at scale.
- Backend-for-frontend — a client-specific facade, not a domain-specific one. Different axis.
Hard problems this pattern introduces¶
- Two-level ownership. The subgraph is owned by one framework team (CHAOS), but the content lives in many team-owned backends. Latency, error handling, and deploys cross this boundary on every request.
- Cross-backend cross-feature queries. When a view combines features from multiple backends, the subgraph must orchestrate the fan-out; see patterns/two-loop-parallel-async-build.
- Schema stability is load-bearing. Frequent schema changes ripple to the router, tooling, and every client. Systems built on this pattern often also adopt concepts/json-string-parameters-for-schema-stability to decouple payload evolution from schema evolution.
Seen in¶
- sources/2025-07-08-yelp-exploring-chaos-building-a-backend-for-server-driven-ui — Yelp CHAOS subgraph + multi-backend REST fan-out; first wiki instance.
- sources/2021-03-03-zalando-how-we-use-graphql-at-europes-largest-fashion-e-commerce-company — Zalando's UBFF names this pattern as the explicit not-chosen alternative: "instead of having multiple Graphs connected via a library and gateway we have a single service at Zalando which connects all the domains in a single schema Graph." First on-wiki counter- example; see patterns/unified-graphql-backend-for-frontend for the single-service sibling.
Related¶
- systems/apollo-federation
- systems/strawberry-graphql
- systems/yelp-chaos
- systems/zalando-graphql-ubff — the explicit single-service counter-example
- patterns/graphql-unified-api-platform — the earlier parent pattern this refines
- patterns/unified-graphql-backend-for-frontend — the single-service sibling of this pattern
- patterns/two-loop-parallel-async-build — the multi-backend orchestration pattern at request time
- concepts/json-string-parameters-for-schema-stability — the payload-decoupling trick that keeps the schema stable