The Next Generation of GraphQL Federation Speaks gRPC
Blog post from Wundergraph
The text discusses a new approach to implementing GraphQL Federation by replacing Apollo's Subgraph model with a Subgraph to gRPC Compiler, thereby enhancing type safety and performance. This method compiles Subgraph SDLs to gRPC services, eliminating the N+1 problem and offering out-of-the-box support for data loading, thereby facilitating backend engineers to focus on business logic instead of data fetching complexities. gRPC, preferred by backend engineers for its mature technology, allows for strict typing and easier reasoning, while GraphQL remains suitable for frontend operations. The approach includes a gRPC to GraphQL adapter in the Router to translate between the two API styles, maintaining schema-first principles and addressing challenges like expressiveness loss and strict typing. Additionally, a "proto lock file" is introduced to manage field numbers in Protobuf, preventing breaking changes by ensuring field numbers are reserved and tracked over time. This innovative strategy aims to streamline the Federation experience, reduce dependency on GraphQL, and improve the overall API architecture.