Set up your graph
Transform your REST APIs into a graph with GraphOS
Hello! 👋 These guides teach you to build a graph that incorporates a fictional Ecommerce REST API. A graph lets clients fetch exactly what they need in one request, even across multiple endpoints.
Let's start building!
Sign into GraphOS
Sign into GraphOS Studio. If you don't have an account yet, sign up for a Free plan at studio.apollographql.com.
Create a graph
When first accessing Studio, you'll see this screen. Follow its instructions to install Rover and authenticate it with GraphOS.
Under Select your starting point, you'll follow the I'm starting from scratch path.
In your terminal, create an empty directory where you want to set up your graph. In that directory, run
rover init
. If theinit
command is unrecognized, ensure you've installed Rover v0.29 or later. You can check your version by runningrover --version
.Make these selections for the prompts in the wizard:
Prompt Selection Select option Create a new graph Select organization Select the GraphOS organization you want to create your graph in Select use case Start a graph with one or more REST APIs Name your graph Enter a name for your graph, for example, Ecomm example
Confirm or modify your graph ID A graph ID is generated based on your graph name. It may contain additional characters to make it unique. Confirm or modify it. When you confirm you want to proceed, a set of starter files will be created in your current working directory. Rover
init
also generatesAPOLLO_GRAPH_REF
andAPOLLO_KEY
credentials. Store these securely, particularly theAPOLLO_KEY
, as it's a graph API key. You'll need to use these credentials later in this guide. You can also set your key as an environment variable.In the directory with the generated files, run the following command, replacing the
<key>
and<graph-ref>
with your own values:terminalAPOLLO_KEY=<key> \ rover dev --graph-ref <graph-ref> \ --supergraph-config supergraph.yaml
(If you set
APOLLO_KEY
as an environment variable, you don't need to include it in your command.)Once
rover dev
is running, your terminal should look something like this:terminalmerging supergraph schema files supergraph config loaded successfully starting a session with the 'products' subgraph ==> Watching path/to/products.graphql for changes composing supergraph with Federation 2.10.0 ==> Attempting to start router at http://localhost:4000. WARN: setting resource attributes is not allowed for Apollo telemetry ==> Health check exposed at http://127.0.0.1:8088/health WARN: Connector debugging is enabled, this may expose sensitive information. ==> Your supergraph is running! head to http://localhost:4000 to query your supergraph
Running into errors?- If you receive an
Error: Not connected to GraphOS.
, ensure you've included yourAPOLLO_KEY
andGRAPH REF
. See Graph API keys for instructions on how to obtain a new one. - If you receive an
Error: License not found.
, it means you need an Apollo account with a Free or Enterprise plan. Verify your organization's plan by navigating to GraphOS Studio, clicking on Settings, then selecting the Billing tab.
- If you receive an
🎉 Congratulations—you've successfully started a local development session where you can explore and develop your graph! Here's where the fun begins. Jump over to the next guide to start developing your graph.