andreidev.ro
← All projects
Prototype2026

Apollo Federation reference

Personal project

Stack

  • GraphQL
  • Apollo
  • Node.js
  • Docker

The idea

Federation lets separate services own separate parts of one graph, so a client asks a single question and never has to know which service answered which part of it. This is a minimal working example of exactly that, with no database and no authentication, so the federation is the only thing left to look at.

How it works

Two Node.js subgraphs sit behind Apollo Router. The users subgraph owns the User entity; the orders subgraph owns Order and extends User with the orders field it is responsible for. Ask for a user together with their orders and the router plans the query, fans it out across both services, and merges the responses into one result before the client sees it.

Rover composes the supergraph schema and the whole thing runs under Docker Compose, so it starts with one command.

Why it exists

Entity resolution across a service boundary is the concept that makes federation click, and it is genuinely hard to see inside a working system with real domains and real data in the way. Stripping it back to two services and a handful of types makes the query planning legible.

Have a similar problem? Tell me about it.