Company
Date Published
Author
James Baxley III
Word count
1241
Language
English
Hacker News points
None

Summary

Apollo Federation is an open-source architecture for building a distributed graph, allowing teams to access all organization data with a single GraphQL query without committing to a monolithic architecture. It's designed to replace schema stitching and solve pain points such as coordination, separation of concerns, and brittle gateway code. The core principles of Apollo Federation include building a graph declaratively from within the schema, separating code by concern rather than type, making the graph simple for clients to consume, and enabling it to be just GraphQL with spec-compliant features of the language. The architecture consists of federated services that can connect data together using type references and type extensions, which allow services to extend types defined in other services while referencing them declaratively. Apollo Federation provides production-ready features such as multiple primary keys, compound primary keys, and shortcuts for faster data fetching. To implement Apollo Federation, teams need two components: federated services and a gateway that composes the complete graph and executes federated queries. The gateway is set up by passing a list of service URLs to the `ApolloGateway` constructor. With Apollo Federation, teams can build a distributed graph with a single schema, indistinguishable from a hand-written monolith, while maintaining full visibility into what's happening with their composed graph through query plan inspectors.