Hive Router

The most performant federation router in the ecosystem

Open source and written in Rust. Highest throughput, lowest latency and lowest memory in the open Federation gateway benchmark, with a perfect score on the Federation audit.

Benchmark figures are from our open Federation gateway benchmark on a 4 vCPU Azure VM with 50 virtual users. Rerun it yourself: every gateway, query and subgraph is in the repository.

Why Hive Router

Everything a production federation router needs, in one binary, with no license tiers.

Built in Rust, no garbage collection
Arena allocation, zero-copy JSON and no garbage collector. Latency stays flat under load.
Learn more
Full Apollo Federation compatibility
Point it at your existing supergraph. Every release is checked against our open Federation audit, and features up to progressive @override are supported.
Learn more
Observability built in
OpenTelemetry traces, Prometheus metrics, structured logs and health probes. Send them to Hive Console, Grafana, Datadog or any compatible backend.
Learn more
Security at the edge of your graph
JWT authentication, authorization directives, demand control, persisted documents, CSRF and CORS protection. One YAML file configures all of it.
Learn more
Federated subscriptions
Real-time data over Server-Sent Events, WebSockets or multipart HTTP. Entities are resolved across subgraphs for subscription events too.
Learn more
Works with any registry
Load the supergraph from a file, Hive Console or Apollo GraphOS and reload it on change. Hive Console is optional.
Learn more

From zero to a running supergraph in three steps

No runtime to install, nothing to compile. Bring a supergraph schema and the router serves it on port 4000, with a GraphQL IDE included.

Full getting started guide
  1. 1

    Install

    Downloads the binary for Linux or macOS. For containers, pull ghcr.io/graphql-hive/router.

    curl -o- https://raw.githubusercontent.com/graphql-hive/router/main/install.sh | sh
  2. 2

    Point it at your supergraph

    This is the whole config for a local file. Hive Console and Apollo GraphOS work as sources too.

    supergraph:
      source: file
      path: ./supergraph.graphql
  3. 3

    Run it

    Serves your supergraph on port 4000.

    ./hive_router
100%199 of 199 test cases across 46 suites

Compatible with Apollo Federation, checked on every release

Our open Federation audit runs the same test suite against every gateway in the ecosystem: entities, @interfaceObject, @requires, @provides, @override and the other Federation directives, plus the edge cases our users have hit in production. We run it continuously, so the results page is always current.

Make it yours

Extend the router with your own code and decide how traffic moves through it.

  • Rust Plugin System

    Plugins written in Rust and compiled into the router, with hooks into the HTTP, GraphQL, query planning and execution stages.

    Documentation
  • Coprocessors

    External HTTP services in any language. The router calls them at the same stages, no Rust required.

    Documentation
  • Dynamic Routing

    Route requests to a different subgraph instance per tenant, region or feature flag, and rewrite headers on the way through. A one-line expression in YAML, no code.

    Documentation
  • Traffic Shaping

    Deduplicate in-flight requests, trip a circuit breaker on a failing subgraph, tune timeouts and connection pools per subgraph and compress traffic in both directions.

    Documentation

Explore Hive 360° GraphQL Ecosystem to reach full potential

Learn more

Frequently Asked Questions

Hive Router or Hive Gateway, which one should I pick?

Both are open source and actively maintained. Hive Router is written in Rust for high throughput and low resource usage. Hive Gateway is written in TypeScript and runs on Node.js and other (serverless) JavaScript runtimes. Gateway provides more flexibility for teams that are already familiar with TypeScript. Both can serve a supergraph from a local file or a schema registry, such as Hive Console.

Can I replace Apollo Router without changing my subgraphs?

Yes. Hive Router consumes a standard Apollo Federation supergraph, so you keep your subgraphs and your composition pipeline and only swap the binary, while re-using your existing supergraph from a local file or even GraphOS. See the compatibility overview for the directives and features covered, and the getting started guide.

Does Hive Router support GraphQL subscriptions?

Yes. Federated subscriptions are built in, over Server-Sent Events, WebSockets or multipart HTTP. The protocol between the router and each subgraph can be configured individually. Read more.

How do I extend the router?

There are two ways to extend Hive Router. Plugins are written in Rust and compiled into the router. Coprocessors are external HTTP services in any language that the router calls. Both support hooking into the HTTP, GraphQL, query planning and execution stages of a request.

How does Hive Router integrate with my monitoring stack?

It emits OpenTelemetry traces and Prometheus metrics, which you can send to Hive Console or any compatible backend, such as Datadog or Grafana, alongside structured logs, health and readiness probes. Furthermore, schema usage metrics can be sent to a schema registry such as Hive Console or GraphOS. Read more.

Do I need Hive Console to use Hive Router?

No. Hive Router is a standalone binary that can load a supergraph file and other sources such as Hive Console or Apollo GraphOS. Using Hive Console is fully optional and provides additional features such as a place to manage your supergraph, publish persisted documents and collect metrics. Read more.

Are all Hive Router features open source?

Yes. Hive Router is MIT licensed. Every feature ships in the same binary, with no license tiers. Read more.

Get your
API game right.

  • Built by engineers to improve developer experience
  • Driven by customers
  • No vendor lock-in