Launch Apollo Studio

Apollo Router quickstart

Run the Apollo Router with Apollo-hosted subgraphs

Hello! This tutorial walks you through installing Apollo Router and running it in front of some Apollo-hosted example subgraphs.

1. Download and extract the Apollo Router binary

Go to the Apollo Router's GitHub Releases page and download the latest .tar.gz file that matches your system. Currently, tarballs are available for the following:

  • Linux (x86_64)
  • macOS (x86_64)
  • Windows (x86_64)

If a tarball for your system or architecture isn't available, you can build and run Apollo Router from source.

After downloading, extract the file by running the following from a new project directory, substituting the path to the tarball:

tar -xf path/to/file.tar.gz

You can now try running Apollo Router from your project's root directory with the following command:


If you do, you'll get the following error:

๐Ÿ’ซ Apollo Router requires a supergraph to be set using '--supergraph':

    $ ./router --supergraph <file>`

๐Ÿช The supergraph can be built or downloaded from the Apollo Registry
   using the Rover CLI. To find out how, see:

๐Ÿงช If you're just experimenting, you can download and use an example
   supergraph with pre-deployed subgraphs:

    $ curl -L > starstuff.graphql

   Then run Apollo Router with that supergraph:

    $ ./router --supergraph starstuff.graphql

This is because Apollo Router requires a supergraph schema as input! Let's obtain one.

2. Download the example supergraph schema

For this quickstart, we're using example Apollo-hosted subgraphs, along with an example supergraph schema that's composed from their schemas.

From your project's root directory, run the following:

curl -sSL > supergraph-schema.graphql

This saves a supergraph-schema.graphql file with the following contents:

This file is all that Apollo Router needs to communicate with our subgraphs!

3. Run Apollo Router with the default configuration

Now from your project root, run the following:

./dist/router --supergraph supergraph-schema.graphql

The console output should look like the following:

Nov 02 17:08:09.926  INFO router: Starting Apollo Router
Nov 02 17:08:10.279  INFO router: Listening on ๐Ÿš€

That's it! Visit localhost:4000 to open the Apollo Sandbox Explorer. You can inspect the entire federated graph and run your first queries against Apollo Router!

Next steps

Now that you know how to run Apollo Router with a supergraph schema, you can:

Edit on GitHub