Skip to main content
Version: v3.x beta

Subgraphs

Introduction

For a multi-team organization working on a Hasura project, it can make sense for any one team to not have access to all metadata objects. Subgraphs introduces the notion of a module system for your Hasura metadata.

A project can have a collection of subgraphs and the project becomes the 'union' of metadata objects across all subgraphs of the project. Each subgraph can then be accessed and updated independently.

A manifest file with subgraphs looks something like the following:

kind: SupergraphManifest
version: v1
definition:
name: base
envfile: base.env.yaml
subgraphs:
- app
- chinook

Subgraph Lifecycle

Create

You can create a subgraph for a project on Hasura DDN using the CLI:

ddn create subgraph

This will launch a wizard allowing you to create and configure your subgraph. You'll so need to create a connector manifest locally in the subgraph's metadata directory. To do so, run the following command:

ddn add connector-manifest <NAME_FOR_CONNECTOR> --subgraph <SUBGRAPH_NAME_FROM_PREVIOUS_STEP>

Manage

You can easily list all the available subgraphs for a project using the CLI:

ddn get subgraph

You can connect new data sources, add new types, etc. to a subgraph. Any files you add to the subgraph directory will be picked up by the metadata build and associated with the subgraph.

Delete

Delete a subgraph by running:

ddn delete subgraph <SUBGRAPH_NAME>
Loading...
Loading...