Understanding graphs
The heart of Apollo GraphOS
As its name suggests, GraphOS is a platform for building and managing graphs. Each graph corresponds to a GraphQL service in your organization.
A GraphQL service usually runs in more than one environment (such as staging or production), so every graph in GraphOS has one or more variants that each correspond to one environment:
Each variant of a graph keeps track of its own separate GraphQL schemas and operation metrics.
Graph types
Every graph in GraphOS is one of these graph types:
Graph type | Description |
---|---|
A supergraph consisting of:
Recommended for all organizations getting started with GraphOS. | |
(Enterprise only) | A supergraph consisting of:
Recommended for enterprise organizations that require full customization of their router, usually for advanced performance or data compliance reasons. |
(Enterprise only) | Not recommended. A single GraphQL service hosted in your infrastructure with no router. |
Cloud supergraphs
Cloud supergraphs require an Apollo organization on the Serverless (free or paid) or Dedicated plan. Learn more about plans.
Cloud supergraphs are recommended for every organization that's getting started with GraphOS. For every variant of a cloud supergraph, GraphOS provisions and manages a router that acts as the variant's public endpoint. Application clients communicate with this endpoint instead of communicating directly with your GraphQL server(s):
The router automatically reports certain operation metrics to GraphOS, so you don't need to configure this reporting in your GraphQL servers.
Cloud supergraphs use an architecture called Apollo Federation. With federation, you can distribute your supergraph's capabilities across multiple GraphQL services, which are known as subgraphs. The router executes client operations across multiple subgraphs as needed:
Even if your API currently uses only one GraphQL server, a cloud supergraph helps you add more subgraphs later as your organization grows.
Self-hosted supergraphs
Self-hosted supergraphs are an Enterprise feature for organizations with advanced performance or compliance requirements.
If your organization doesn't currently have an Enterprise plan, you can test out this functionality by signing up for a free Enterprise trial.
With a self-hosted supergraph, GraphOS does not provision a router for your supergraph. Instead, you host your supergraph's router in your own infrastructure:
Your self-hosted router is an instance of the Apollo Router (cloud supergraphs use the Apollo Router under the hood).
Self-hosted supergraphs provide full control over your router, but they also require handling its deployment and management. Before you adopt this graph type, make sure you have the necessary team structure to properly manage an additional service in your infrastructure.
Monographs
Monographs require an Apollo organization on the Enterprise plan. Learn more about plans.
A monograph is a graph that consists of a single GraphQL server with no router:
⚠️ We strongly recommend against monographs! A monograph introduces significant technical and logistical scaling issues as more teams contribute to your graph and its schema.
Additionally, the router provides essential GraphOS functionality beyond support for multiple subgraphs. It also enables powerful features like @defer
support and straightforward metrics reporting.
Creating graphs
To create a cloud supergraph, see the GraphOS quickstart.
To create a non-cloud graph (a self-hosted supergraph or a monograph), follow these steps:
This feature is only available with a GraphOS Enterprise plan. If your organization doesn't currently have an Enterprise plan, you can test this functionality by signing up for a free Enterprise trial.
Go to your organization's Graphs tab in GraphOS Studio.
Click New Graph in the top right. Studio displays the following dialog:
Specify an organization and title for your graph.
Specify your Graph Architecture:
- To create a self-hosted supergraph, leave this as Supergraph (default).
- To create a monograph, switch this to Monolith.
Click Next. A dialog like the following appears (the details differ depending on which Graph Architecture you're using):
If you're creating a self-hosted supergraph, select the version of Apollo Federation you're using from the Supergraph Pipeline Track dropdown.
Your graph has been created.
Next, you need to publish your graph's schema(s) to Apollo using the Rover CLI. For details, see Publishing schemas to GraphOS.
Variants
To distinguish between instances of the same graph running in different environments (such as staging and production), you define multiple variants of your graph. Each variant has its own schemas, along with its own change history and metrics.
Each of your graph's variants is shown in GraphOS Studio:
Creating a variant
See this section.