The Rover init Command
Initialize a graph locally and on GraphOS
Rover enables you to create a graph with a single interactive command.
Initializing a graph
rover init
Running rover init
starts a short wizard that helps you create a new graph.
rover init
The wizard walks you through a set of questions to help you choose the best option for your use case. When you're done, you'll have:
A new graph in GraphOS
A set of local configuration files and boilerplate code that represent the graph
Credentials to interact with GraphOS
These credentials are necessary for actions like developing your graph locally or publishing graph updates.
Options
You can also pass options directly to rover init
instead of answering prompts in the wizard. The wizard still asks for any information not provided via an option and will always ask for confirmation before creating any files locally.
rover init \
--project-type <PROJECT_TYPE> \
--organization <ORGANIZATION> \
--project-use-case <PROJECT_USE_CASE> \
--project-name <PROJECT_NAME> \
--graph-id <GRAPH_ID>
Available options
Option | Description | Possible Values |
---|---|---|
--project-type | Whether to create a new graph or add a subgraph to an existing graph. | create-new , add-subgraph |
--organization | The ID of the GraphOS organization where the graph should be created. | (your organization ID) |
--project-use-case | Helps preconfigure your graph for specific patterns. | connectors , graph-ql-template |
--project-name | The name for your new graph. | (your graph name) |
--graph-id | The ID for your graph in GraphOS. (This must be a unique identifier.) | (your graph ID) |
Choosing your use case
Once you run rover init
, the wizard prompts you to select your use case.
Start a graph with one or more REST APIs
Select this option to integrate REST APIs into your graph using Apollo Connectors.
Start a graph with recommended libraries
Select this option if you want to integrate data that's not accessible via a REST API. This option helps you set up a graph using the Apollo Server library.
Created credentials
After you've chosen your use case, the wizard prompts you for a project name. It generates the following credentials based on the name you enter:
Graph ID- A unique identifier for your graph. It represents your graph across all of Apollo.
Graph ref- A reference for a specific variant of your graph. It's formatted
graph-id@variant
. To start, GraphOS automatically creates a variant titledcurrent
for you.Graph API key- Once it's generated, store it securely—you won't be able to access it later.
See the configuration docs to learn how to set your API key as an environment variable
Next steps
Once you've completed the wizard, it provides a rover dev
command with prepopulated credentials. Run this command to start developing your graph.
APOLLO_KEY=<key> \
APOLLO_GRAPH_REF=<graph-ref> \
rover dev --supergraph-config supergraph.yaml
(If you set APOLLO_KEY
as an environment variable, you don't need to include it in your command.)
rover dev
:1npm ci
2npm start
rover dev
depends on. Learn more in the getting-started.md
generated when you run rover init
.Additional resources
After running
rover init
, open the generatedgetting-started.md
file for next steps.To go further, check out the Getting started guide to learn what else you can do with Apollo Connectors.
If you learn best with videos and exercises, this interactive course teaches you how to integrate a demo REST API into a graph using Apollo Connectors.