Back to browse
GitHub Repository

go-graphql-federation-gateway is GraphQL Federation Gateway written in go based on n9te9/graphql-parser.

14 starsGo

Stateless Go GraphQL Federation Gateway, 1.58x Faster Than ApolloRouter

by n9te9·Mar 6, 2026·1 point·0 comments

AI Analysis

●●SolidSlickSolve My Problem

Stateless Go alternative to Apollo Router with nested @key, @provides optimization, and 1.58x benchmarked throughput.

Strengths
  • Complete Federation v2 compliance: nested keys, multiple @key per type, @provides optimization, @interfaceObject all verified with 135+ integration tests.
  • Performance-tuned: sync.Pool request buffering, configurable connection pool settings eliminate Apollo's default `MaxIdleConnsPerHost: 2` bottleneck.
  • Pure Go implementation is easier to read and extend than Rust Apollo Router for Go-native teams.
Weaknesses
  • Benchmarks only show throughput at concurrency 50; no latency, memory, or real-world load curve data published.
  • No WebSocket/subscription support mentioned—HTTP-only means mutation-heavy apps lose subscription capabilities vs Apollo Router.
Target Audience

Backend engineers managing federated GraphQL services, teams evaluating Apollo Router replacements

Similar To

Apollo Router · Tailcall · GraphQL Mesh

Post Description

I built a GraphQL Federation v2 gateway in pure Go.

What's supported

All core Federation v2 directives work out of the box:

- @key — simple, composite, nested ("coord { lat lng }"), multiple @key per type, @key(resolvable: false) - @external — correct ownership filtering; stub references (e.g. a service that declares a type only to satisfy a key) are never mistaken for entity owners - @requires — chained dependency injection resolved in topological order - @provides — skips unnecessary _entities fetches when the parent service already covers all requested child fields - @shareable — prefers the parent subgraph to avoid extra entity fetches - @override — field ownership migration between subgraphs - @inaccessible — enforced at both schema composition and query validation - @interfaceObject — interface types as entities with inline fragment resolution - @composeDirective — custom directive preservation with consistency validation - @tag, @link

Operations: query and mutation. Independent subgraph fetches run in parallel; mutations execute sequentially per the GraphQL spec. Partial responses are supported — a failed subgraph sets that field to null and appends an error, but execution continues for unaffected fields.

What's intentionally not supported

- Subscription — requires stateful WebSocket connections, which contradicts the stateless design. Every request is fully self-contained. - @authenticated / @requiresScopes / @policy — authorization belongs outside the gateway layer. - @defer / @stream — requires long-lived streaming connections. - Federated Tracing (ftv1) — Apollo Studio-specific protocol. - @override(label) — progressive override; planned for a future release.

Performance

Go's http.DefaultTransport caps MaxIdleConnsPerHost at 2, which was a hard throughput ceiling. The gateway defaults to 32 (configurable via gateway.yaml). Query plans are cached per query string.

Go Gateway: ~4,380 req/s Apollo Router: ~2,771 req/s (concurrency 50, 10k requests, Docker networking)

135+ integration tests across 8 domain scenarios (EC, Fintech, SaaS, Social, Travel, nested @key, multiple @key, @provides).

GitHub: https://github.com/n9te9/go-graphql-federation-gateway

Happy to hear about Federation v2 edge cases you've hit in production.

Similar Projects

AI/ML●●Solid

AnythingMCP – source-available gateway turning REST/SOAP/SQL into MCP

Turns legacy SOAP and REST APIs into MCP servers without writing glue code.

Ship ItSolve My Problem
helpcodeai
2023d ago
AI/ML●●Solid

Facebook Marketplace MCP

Uses internal GraphQL protocol directly instead of slow browser automation.

Big BrainNiche Gem
rpst
121mo ago

Email but for Your OpenClaws

Agent federation over AMTP, but relies entirely on Agentry adoption and OpenClaw ecosystem.

Bold Bet
wang_cong
103mo ago