
Microservices Federation (GraphQL, Python and Apollo)
graphql #python #fastapi #docker When building microservices, one of the hardest challenges is exposing a single, unified API to the client without coupling your services together. Apollo Federation 2 solves this: each service owns its slice of the graph, and a Gateway composes them into one supergraph — transparently. This is the architecture we'll be building: Client └─► Gateway :4000 ├─► User Service :5001 /graphql ├─► Product Service :5002 /graphql └─► Order Service :5003 /graphql └─► Postgres :5432 ├── users DB ├── products DB └── orders DB The full source code is here: https://github.com/nietzscheson/microservices-federation Stack Gateway : Node.js + @apollo/gateway / Apollo Router (Rust) Services : Python 3.13 + FastAPI + Strawberry GraphQL ORM : SQLAlchemy 2 + Alembic DB : PostgreSQL 17 Packages : uv DI : dependency-injector Infra : Docker Compose Database: one Postgres, three databases We use the same trick from my previous article : a single Postgres container that initialize
Continue reading on Dev.to
Opens in a new tab



