On this page

Open Source Alternative to Apollo Router

Hive Router is an MIT-licensed GraphQL Federation router in Rust and an alternative to Apollo Router. See what maps to what and how to try it side by side.

Hive Router is an open-source alternative to Apollo Router. Both are GraphQL Federation routers written in Rust, and both serve the same supergraph schema, so switching does not touch your subgraphs or your composition pipeline.

Why Teams Switch

  • MIT license. Hive Router is MIT licensed. Apollo Router is distributed under the Elastic License 2.0.
  • One edition, all features. Subscriptions, JWT authentication, authorization directives, persisted documents, demand control, coprocessors and telemetry work without a license key.
  • Performance you can verify. The Federation Gateway Performance benchmark compares Hive Router with Apollo Router and other gateways under the same load. The benchmark is open source, so you can rerun it on your own hardware.
  • Compatibility you can verify. The Federation Gateway Audit runs one test suite against every gateway and publishes the results live. Hive Router passes every test case.
  • Any registry. Hive Router loads the supergraph from Hive Console, Apollo GraphOS, a file or an S3-compatible bucket.

What Maps to What

In Apollo RouterIn Hive Router
router.yamlrouter.config.yaml and environment variables
Supergraph from GraphOS Uplink or a fileSupergraph sources: Hive Console, Apollo GraphOS, a file, S3-compatible storage
Rhai scriptsExpressions in configuration
Native Rust pluginsRust plugin system
External coprocessorsCoprocessors
JWT authenticationJWT authentication
@authenticated, @requiresScopesAuthorization directives
@policyCustom authorization policies
Persisted queries and safelistingPersisted documents, with app deployments in Hive Console
Demand controlDemand control with @cost and @listSize
Operation limitsOperation complexity limits
SubscriptionsSubscriptions over SSE, WebSockets, multipart HTTP and HTTP callbacks
Traffic shapingTraffic shaping: deduplication, timeouts, compression, circuit breakers
Header propagationHeader manipulation
Subgraph URL overridesDynamic subgraph routing
Progressive @overrideOverride labels
@context and @fromContextContextual arguments
OpenTelemetry, Prometheus, DatadogTracing, metrics, logging
Health checksHealth and readiness probes
TLSTLS and mutual TLS
CORS and CSRF preventionCORS and CSRF prevention
Usage reporting to GraphOSUsage reporting to Hive Console

The configuration files are not compatible with each other. The concepts are close, so most settings have a direct counterpart in the configuration reference.

Try It Next to Apollo Router

You can run Hive Router against the supergraph you already publish to Apollo GraphOS, without changing how you publish schemas.

1. Install

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

Or pull the Docker image, ghcr.io/graphql-hive/router.

2. Point it at your supergraph

Use the graph ref and an API key of the graph you already have:

router.config.yaml
supergraph:
  source: apollo_graphos
  graph_ref: my-graph@production
  key: service:my-graph:xxxxxxxxxx

Or load the supergraph file your pipeline already produces:

router.config.yaml
supergraph:
  source: file
  path: ./supergraph.graphql

3. Run it and compare

PORT=4001 ./hive_router

Hive Router listens on port 4000 by default, the same as Apollo Router, so this starts it on 4001 and both can run on one machine. Send it the operations your clients send today and compare responses, latency and resource usage with your current router. When you are ready, move the settings you rely on across with the table above, starting with header rules, authentication and telemetry.

Moving the Registry Too

Hive Router does not need Hive Console. If you also want an open-source schema registry with schema checks, usage insights and persisted documents, see Hive as an alternative to Apollo GraphOS.

Frequently Asked Questions

Do I need to change my subgraphs?

No. Hive Router consumes a standard Apollo Federation v2 supergraph. Your subgraphs and your composition step stay as they are.

Can I keep publishing schemas to Apollo GraphOS?

Yes. Set supergraph.source to apollo_graphos and Hive Router polls the same Uplink endpoint that Apollo Router uses. See supergraph sources.

How do I port Rhai scripts and plugins?

Header rules, routing decisions and feature flags that are written as Rhai scripts usually become expressions in the configuration file. Logic that needs code moves to a Rust plugin compiled into the router, or to a coprocessor in any language.

Is there a TypeScript option?

Yes. Hive Gateway is written in TypeScript and can run the Hive Router query planner as a native addon. See Hive Router or Hive Gateway.