Building Apollo Router from source
If we don't provide a prebuilt executable for your system or architecture, you can build the executable from source.
To compile Apollo Router binary on your machine, you need the following:
- Git. Github provides a tutorial on how to install Git.
- The Rust language. Head over to rustup.rs to install Rust.
From your preferred directory, run the following:
git clone https://github.com/apollographql/router.git cd router git submodule update --init --recursive
⚠️ The Apollo Router project uses submodules. Execute all of these commands to make sure your submodules are initialized and up to date!
From the repository's root directory (
router), you can run the following command to build and run Apollo Router:
cargo run -- --supergraph ./examples/supergraph.graphql
You'll see output similar to the following:
Compiling router-bridge v0.1.0 (https://github.com/apollographql/federation.git) Compiling apollo-router-core v0.1.0-prealpha.3 (/Users/ignition/projects/apollo/router/crates/apollo-router-core) Compiling apollo-router v0.1.0-prealpha.3 (/Users/ignition/projects/apollo/router/crates/apollo-router) Finished dev [unoptimized + debuginfo] target(s) in 5.38s Running `target/debug/router -p ./examples/hello-world` Nov 02 17:08:09.926 INFO router: Starting Apollo Router Nov 02 17:08:10.279 INFO router: Listening on http://127.0.0.1:4000 🚀
That's it! Visit
localhost:4000 to open the Apollo Explorer Sandbox. You can inspect the entire example federated graph and run your first queries against Apollo Router!