What is GraphQL Federation?
Answer
GraphQL Federation (by Apollo) is an architecture for building a distributed GraphQL API where multiple independent services (subgraphs) each own part of the schema, and a gateway/router composes them into a single unified supergraph. Each subgraph defines its own types and resolvers; the router merges schemas and routes query fields to the appropriate service. Key concepts: @key directive (entity primary key for cross-service references), @external (field defined in another service), @requires (depends on a field from the same entity), @extends (extend a type from another service). Example: a User type defined in the Users service can be extended by the Orders service to add orders field. This enables teams to work independently while clients see one unified graph. Federation v2 removed many of the v1 limitations.
Previous
What are custom scalars in GraphQL?
Next
What is the difference between query, mutation, and subscription operations?