3. Registering our schema
2m

📝 Let's register our schema!

The first step of getting our app into production is registering our schema with Apollo.

Let's go to Apollo Studio in the browser. You'll need an Apollo account set up with an organization.

Note: If you don't have an account yet, now is the perfect time to create yours here.

In previous courses, we've tested our locally running graph using Sandbox. This helped us easily prototype and iterate on our schema changes. To register a schema deployed in production, we need to create a deployed graph, which integrates with the schema registry. A deployed graph is visible to all members of your organization.

Graphs!

Sandbox is a
 
environment where we can explore and test a GraphQL schema. To register a
 
schema and track our changes over time, we can create a
 
in Apollo Studio, which is visible to
 
.

Drag items from the box to the blanks above

production
destructible graph
the whole organization
the whole world
development
deployed graph

📈 Creating a deployed graph

Let's click on New Graph. Give it a title and select Deployed as the graph type. Select Monolith as the graph architecture, then click Next.

https://studio.apollographql.com
Screenshot of the modal for creating a new graph with the correct inputs

From here, we have a few ways to register our schema, but we'll focus on the first option: Apollo Server. This method uses a protocol called schema reporting, where our GraphQL server automatically registers its latest schema every time it starts up! To enable this, we need to set up the three environment variables shown on the page:

APOLLO_KEY=service:xxxxx
APOLLO_GRAPH_REF=xxxxxx
APOLLO_SCHEMA_REPORTING=true

Note: We used to have separate variables for APOLLO_GRAPH_ID and APOLLO_GRAPH_VARIANT, but those have now been combined into a single environment variable: APOLLO_GRAPH_REF. (Under the hood, the structure of the graph reference variable is really <APOLLO_GRAPH_ID>@<APOLLO_GRAPH_VARIANT>.)

How does Apollo Server automatically register its schema in production?

We'll use these environment variables when we get our GraphQL server into production!

Previous
Next