Join us for GraphQL Summit, October 10-12 in San Diego. Use promo code ODYSSEY for $400 off your pass.
Launch GraphOS Studio

Developing your supergraph locally

With the Rover CLI

While you're working on changes to one of your s, you can run a version of your entire locally in your development environment! To do this, you use the rover dev command.

Install the Rover CLI.

The rover dev command monitors each of your s (either via server or by watching a .graphql file). Whenever it detects a change, it automatically recomposes your 's and raises any errors that might occur. This enables you iterate quickly on schema changes.

Starting your router

You run rover dev once for each subgraph in your . The first time you run it, spins up a on your local machine.

Try running rover dev with an example like so:

rover dev --url --name locations

You'll see output like the following:

WARN: could not detect a schema in the current working directory. to watch a schema, pass the `--schema <PATH>` argument
👂 polling every 1 second
⚠️ Do not run this command in production! ⚠️ It is intended for local development.
🛫 starting a session with the 'locations' subgraph
🎶 composing supergraph with Federation v2.1.2
🚀 your supergraph is running! head to http://localhost:3000 to query your supergraph

You can now open http://localhost:3000 in your browser and run test queries against your local using the !

You can replace the example URL and name in the above command with the details for your own subgraph. You can provide a remote URL or a localhost URL.

Adding a subgraph

To add a to your local , run rover dev again in a separate terminal window.

You can add a to this article's example with the following command:

rover dev --url --name reviews

This command's output is similar to the output for the initial execution, but it includes a line like the following:

🐤 adding the 'reviews' subgraph to the session

This indicates that rover dev has identified your existing session and is adding this to it.

Now if you run test queries in the , you'll see that they can include s from both the locations and reviews s!

Ending a rover dev session

To shut down your local , use CTRL+C to terminate the first rover dev process you started. This automatically terminates all secondary rover dev processes that are part of the same session.

If you terminate a secondary rover dev process, your session remains active, and the 's is automatically updated to reflect the removed .

Command options

For more details on rover dev options, see the Rover documentation.

Creating a new subgraph
Updating your graph
Edit on GitHubEditForumsDiscord