Let teams own and deploy domain-specific subgraphs independently.
Large organizations
GraphQL · Const
GraphQL federation combines independently managed subgraphs into one schema exposed through a gateway. Clients query the unified schema while the gateway routes work to the responsible services.
Federation divides a GraphQL API across independently managed subgraphs. A gateway composes their schemas into one schema for clients, routes query portions to the relevant services, gathers the results, and returns one response.
A unified GraphQL schema and, at runtime, a single response assembled from results returned by the relevant subgraphs.
type Product @key(fields: "upc") {
upc: String!
name: String!
}A subgraph can define a product entity using a key field so the gateway can connect it with related data from other subgraphs.
Large organizations
Microservice architectures
Cross-domain queries
Schema governance
Federation organizes a GraphQL API as multiple independent subgraphs, each owning part of the data graph. A gateway composes those schemas into a unified schema that clients query.
Follow-up: What happens when a client query spans services? The gateway divides the work among the appropriate subgraphs, collects their results, and assembles one response.
A subgraph is an individual service with its own GraphQL schema and resolvers. Schema composition combines subgraph schemas and resolves the relationships between them.
Follow-up: Why is composition necessary? It detects incompatibilities and ensures types are connected correctly before the gateway exposes the combined schema.
Start by defining service boundaries, designing schemas around those boundaries, implementing the subgraphs, and deploying a gateway. A schema registry can manage composition and validation.
Follow-up: What operational concern does a registry address? It helps verify schema integrity as independently deployed subgraphs change.
subgraphsgatewayschema compositionschema registryunified schema