Federation Basics
Introduction
Federation in Hasura DDN is the process of combining multiple subgraphs with one or more data sources into a single supergraph to create a unified GraphQL API that provides access to all your data domains through a single endpoint.
With Hasura DDN's collaboration features, you can add collaborators to either the supergraph or subgraph level.
A supergraph API build is a collection of one or more subgraph builds.
Add a subgraph to a supergraph
To add a subgraph to a supergraph, you need to have a supergraph project initialized.
By running ddn supergraph init .
you would have both an app
and globals
subgraph by default.
Additional subgraphs can be added with:
ddn subgraph init my_new_subgraph --dir ./my_new_subgraph --target-supergraph ./supergraph.yaml
You can read more about adding a new subgraph to a supergraph in the Getting Started guide.
Once a subgraph has been added and built on Hasura DDN, subgraph collaborators can be added to it.
Add collaborators
As a project owner, or supergraph admin, you can invite collaborators to either the supergraph or subgraph level.
As a subgraph admin, you can invite collaborators to your subgraph.
Read more about collaboration and the available roles in Hasura DDN.
Next steps
- Independent Subgraph Development enables teams to independently develop, test, and deploy their code without impacting the functionality of other subgraphs.
- Subgraph Prefixing prevents conflicts in the schema when multiple subgraphs expose GraphQL fields and types with the same name.
- Cross-repo Relationships allows teams to build data relationships between subgraphs that are in separate repositories.