Skip to main content
Version: v3.x

Create a Subgraph

What's about to happen?

You're about to create a subgraph on Hasura DDN.

Subgraphs can be rebuilt at any point to reflect changes made in connectors or other metadata related to models, commands, relationships, or permissions. To do so, you'll need complete the first two steps once and then, for each additional cloud build, you'll only need to complete the third step.

Required

For each subgraph you're deploying, run the following to create it on Hasura DDN, replacing my_subgraph with your desired name. The name should match the subgraph name from your supergraph.yaml file in your local metadata.

Step 1. Create a subgraph

From any project directory, run:
ddn project subgraph create my_subgraph

Step 2. Create the globals subgraph

Here we need to take a moment to explain the role of supergraph global metadata. This information, which consists of AuthConfig, GraphQLConfig and CompatibilityConfig can be located in any subgraph. On supergraph init though, we create this for you in a dedicated subgraph called globals, just for the sake of organization.

So when deploying our supergraph to the cloud, we also need to create a project subgraph for the globals subgraph, unless you have since moved or created these objects in another location.

From any project directory, run:
ddn project subgraph create globals
Project set in context

Remember that because we set the project context, we don't need to pass the project name as a flag in the command.

What did this do?

Seemingly, this was an unimpressive step. However, subgraphs in your local metadata will map to resources on Hasura DDN. Thus, for each subgraph you have in local metadata, you'll create the companion on Hasura DDN.

Next steps

With a subgraph provisioned on Hasura DDN, you can now begin building and deploying your connectors to Hasura DDN.

Loading...