A fully open-source MIT-licensed GraphQL API router that can act as a GraphQL federation Router, built with Rust for maximum performance and robustness.
Tip
🚀 Blog post: Welcome Hive Router
Interested in the benchmark results? Check out the Federation Gateway Performance comparison
It can be run as a standalone binary or a Docker Image. The query planner is bundled into the hive-router crate, which can also be used as a library.
Binary Releases | Docker Releases | Documentation
Download Hive Router using the following install script:
curl -o- https://raw.githubusercontent.com/graphql-hive/router/main/install.sh | sh
At the moment, only Linux runtimes are supported using a binary, see Docker option below if you are using a different OS.
Create a simple configuration file that points to your supergraph schema file:
# router.config.yaml
supergraph:
source: file
path: ./supergraph.graphqlAlternatively, you can use environment variables to configure the router:
SUPERGRAPH_FILE_PATH=./supergraph.graphqlThen, run the router:
# By default, "router.config.yaml" is used for configuration. Override it by setting "ROUTER_CONFIG_FILE_PATH=some-custom-file.yaml"
# If you are using env vars, make sure to set the variables before running the router.
./hive_routerSee GitHub Releases to the full list of release and versions.
The router image is published to the GitHub Container Registry. You may use it directly using the following command:
docker run \
-p 4000:4000 \
-e SUPERGRAPH_FILE_PATH="/app/supergraph.graphql" \
-v ./my-supergraph.graphql:/app/supergraph.graphql \
ghcr.io/graphql-hive/router:latestReplace
my-supergraph.graphqlwith a local supergraph file.
Alternatively, you can mount the configuration file using -v and pass all other configurations there:
docker run \
-p 4000:4000 \
-v ./router.config.yaml:/app/router.config.yaml \
ghcr.io/graphql-hive/router:latestReplace
latestwith a specific version tag, or a pre-release for one of the PRs (pr-<number>orsha-<commit-sha>).
To try the query planner, see bin/dev-cli/README.md for instructions to quickly use the qp-dev-cli for seeing the QP in action.
- Run
cargo test_allto execute all unit tests. - Run
cargo test_e2eto execute all e2e tests. - Run
cargo test_qpto execute all query planner tests. - Run
cargo test_qpeto execute all plan executor tests.
