The more microservices you have, the harder it is to observe and connect them.

Use Federation to connect, observe and collaborate on your microservices

Compose independently owned microservices into one GraphQL API. Cosmo gives you the open-source router, a schema registry that checks changes before you publish them, and the metrics and traces to run it.

Read Cosmo docs
Definition

What is a microservice federation platform?

A microservice federation platform is the tooling that composes the APIs of independently owned microservices into one GraphQL API, called a federated graph or supergraph. It includes a router that plans and runs queries across services, a schema registry that checks changes before they ship, and observability that traces each request across the services it touches.

Router

Plans each query across subgraphs and merges the responses. Cosmo Router is Apache 2.0 and written in Go.

Schema registry

Composes subgraphs into one federated graph. wgc subgraph check tests a change for composition errors and breaking changes before you publish it.

Observability

Metrics and traces per operation and client in Cosmo Studio. Router metrics carry the subgraph name, so you can also break them down by subgraph in your own OpenTelemetry or Prometheus stack.

Ownership and review

In WunderGraph Hub you assign owners to types and subgraphs, and Hub adds them as required reviewers on proposals that touch their part of the graph.

New to federation? Start with what GraphQL Federation is, or see how to migrate from a GraphQL monolith.

Setup

Set up federation in five steps

  1. 1

    Start with the graph you have

    Register your existing GraphQL service in Cosmo. You can start it as a monograph (federation off, one subgraph) and convert it with wgc monograph migrate, then update its label matchers and labels so the second subgraph composes in. Or create a federated graph from day one.

    npx wgc federated-graph create production -r https://router.example.com/graphql --label-matcher graph=shop
  2. 2

    Draw boundaries by team and domain

    Give each subgraph to the team that owns its domain. Mark shared types as entities with @key, so each subgraph can add fields to a type without owning all of it.

  3. 3

    Publish subgraphs

    Publish each subgraph schema to the registry. Subgraphs whose labels match the federated graph are composed into it.

    npx wgc subgraph publish products --schema ./products.graphql --routing-url http://products:4001/graphql --label graph=shop
  4. 4

    Check every change in CI

    Run wgc subgraph check on every pull request. It reports composition errors and breaking changes, and checks breaking changes against client operations seen in production.

    npx wgc subgraph check products --schema ./products.graphql
  5. 5

    Run the router and move fields safely

    Create a router token and start Cosmo Router with it. The router pulls the composed config from the CDN and reloads it without downtime. Move fields between subgraphs with @override, and send selected traffic to a new version of a subgraph with feature flags.

    npx wgc router token create prod-router -g production
The common objection

Won't this become a distributed monolith?

It can. A distributed monolith is a set of services that still have to change and deploy together, so you pay for the network hops without getting the independence. Federation does not prevent that. Bad boundaries survive the move to subgraphs.

Watch for these signs:

  • Two subgraphs that always ship in the same release.
  • Subgraphs that read from the same database tables.
  • Long @requires chains, where one field waits on a second subgraph, which waits on a third.

Once the boundaries are right, federation keeps teams apart. Each subgraph is checked on its own before it is published. @override moves a field between subgraphs without a coordinated release. Feature flags let a new version of a subgraph serve selected traffic first. If you still have to coordinate every deploy, the fix is usually the boundary, not the tooling. Microservice Dependencies: How @requires Makes Them Explicit covers the hidden coupling to look for.

People, not just services

Who owns what

After the split, one change can touch a type the catalog team owns, resolved by a subgraph the reviews team runs. Both teams need to see it before it ships, and someone has to be the source of truth for each type.

WunderGraph Hub assigns two kinds of owners. Type owners review any change to their type, whichever subgraph resolves it. Subgraph owners review changes that add, remove, or modify fields in their subgraph. When a proposal touches owned types or subgraphs, those owners become required reviewers. It can't be approved until they sign off, every check passes, and every discussion thread is resolved.

Proposals need the graph connected to the Cosmo schema registry. Approval doesn't deploy anything: each team still publishes its own subgraph, in its own order.

Performance

What federation costs, and how the router keeps it low

Federation adds a network hop from the router to each subgraph, plus query planning. How much that matters depends on how many subgraph fetches a query needs and how fast each subgraph answers.

  • Query plans are cached, so repeat operations skip planning.
  • Identical in-flight subgraph requests are deduplicated (enable_single_flight, on by default), and so are identical in-flight client queries.
  • Subgraph fetches that do not depend on each other run in parallel. Fetches that do still run in order.
  • The cache warmer can rewarm query plans after a config reload, so slow-to-plan operations spike less after a schema publish. CDN-based cache warming is an Enterprise feature.

More in Cosmo performance.

Case study

eBay: 80% fewer router nodes for the same traffic

eBay moved its federated GraphQL traffic to Cosmo Router. Handling the same production traffic, it runs 80% fewer router nodes, with about 50% lower router memory use.

Read the eBay case study
Security

Security at the router

With federation, the router is the single entry point for clients, so it is where you enforce access. Cosmo Router supports:

  • JWT authentication with JWKS at the router.
  • Authorization on types and fields: @authenticated requires a valid token, and @requiresScopes checks its scopes.
  • Persisted operations (Scale and Enterprise on Cosmo Cloud), with block_non_persisted_operations to reject anything not on the list.
  • Introspection control, TLS, and signed router configs.

A stock router config is permissive: introspection is on and CORS allows all origins. The security hardening guide lists what to change before production. See also Cosmo security.

Observability across all connected services

You can't scale federation without understanding graph usage

Observability for federated graphs

Once requests fan out across services, you need to see where time goes. Cosmo Studio shows analytics and metrics for the federated graph, and distributed tracing tracks a request through every subgraph it touches. If you already run an analytics stack, the router serves Prometheus metrics and its OpenTelemetry exporters are configurable (see pricing for plan details).
  • See how the federated graph is used: which clients call which operations, and how often.

  • Field usage shows which clients still depend on a field before you change or remove it.

  • Distributed tracing follows a request from the router through every subgraph it touches.

  • The router serves Prometheus metrics, and its OpenTelemetry exporters are configurable, so you can use your own stack. See pricing for plan details.

Router, registry, Studio, and CLI

The Cosmo platform runs GraphQL Federation

The Cosmo platform

Cosmo is the open-source platform behind every step above. The router is the runtime: it plans and routes requests to your microservice APIs. The control plane and the wgc CLI run composition and checks, so they fit into CI/CD. Cosmo Studio is the UI for your graphs, subgraphs, analytics, and traces.
You can run every component yourself, which keeps telemetry in your network and avoids vendor lock-in, or use Cosmo Cloud for the control plane, registry, and Studio.
  • Cosmo Router implements GraphQL Federation v1 and v2. Apache 2.0, written in Go, with a GraphQL Playground included.

  • The wgc CLI talks to the control plane, so you can create graphs, publish subgraphs, and run checks from CI/CD.

  • Cosmo Studio is the UI to explore and manage your subgraphs and federated graphs, with analytics, traces, and schema check results.

  • The changelog shows how your schemas change, the schema explorer shows each type and its usage, and the audit log records who did what, and when.

  • Schema checks catch composition errors and breaking changes before a subgraph is published.

  • Self-host the whole platform, open source, or use Cosmo Cloud. You run the router either way.

Built for developers and platform teams

Cosmo Studio

Stay up to date on all the latest schema changes with the changelog

cosmo
cosmo
cosmo
cosmo
cosmo

Built-in compliance and full flexibilityFeatures that help you
focus on things that matter

Maximized compliance

You have complete autonomy over where to run all the components, including Studio, Control Plane, and Router. This empowers you to adopt GraphQL while adhering to strict data regulation policies.

Schema checks

Detect breaking changes before they affect your federated graph. Run wgc subgraph check in GitHub Actions or any CI on every pull request.

OTEL compatibility

Use your existing OTEL stack and push data from your subgraphs and services to Cosmo. Combined with distributed tracing, it allows you to build a unified view on the entire request / response journey.

ClickHouse and PostgreSQL

Cosmo stores analytics in ClickHouse, state in PostgreSQL, and router configs in S3-compatible storage. When you self-host, you can run these yourself or use managed services.

Go custom modules

Customize your router by writing Go code and compiling it into your own router build. You debug it with standard Go tooling rather than a scripting layer.

Kubernetes ready

A Helm chart deploys the Cosmo platform to Kubernetes. A Terraform provider manages namespaces, graphs, and subgraphs as code.

Analytics, scale, and one open-source stack.

Analytics

Understand how and by whom your graph is consumed, monitor usage and track down performance and latency issues. On Cosmo Cloud, data retention depends on your plan.

Graphs and labels

Self-hosted Cosmo has no plan limits on graphs or subgraphs; Cosmo Cloud plans set them. Use labels to choose which subgraphs compose into each graph, and namespaces to keep environments apart.

One open-source stack

Router, control plane, Studio, and CLI are developed together in one open-source repository, so they are built to work with each other.

FAQ

Federation for microservices

Want to talk it through?

Get in touch

Tell us about your microservices and how your teams work, and we'll help you plan the move to federation.