Graph Types

Learn about monographs and supergraphs and their use cases


GraphQL APIs are often referred to simply as graphs. This article explains the different graphs you can build and their typical use cases.

Monographs

A monograph is a graph consisting of a single GraphQL service that clients query directly.

Monographs have a single GraphQL schema that represents the API's entire dataset.

Use case

When you're just getting started with GraphQL, a monograph is the fastest way to begin. A monograph can continue to meet your needs if you have a small team or a relatively simple domain. Monographs introduce technical and logistical scaling issues as more teams contribute to your graph and its schema.

Supergraphs

Supergraphs contain one or more subgraphs. Subgraphs are separate underlying services, each responsible for a different portion of the supergraph's available data. Clients makes requests to the federated graph's single entry point called the router.

The router intelligently orchestrates and distributes the request across subgraphs and returns a unified response. For a client, the request and response cycle of querying the router looks the same as querying any GraphQL server.

Here's a basic supergraph that includes two subgraphs (Products and Users):

Because the GraphOS Router provides advantages beyond support for multiple subgraphs, you may choose to start a supergraph with just one subgraph and a router. For example, the router enables powerful features like support for @defered queries and straightforward metrics reporting. Learn more about GraphOS Router capabilities.

note
Though this graph has only one subgraph, it's still considered a supergraph rather than a monograph because of the presence of the router.

Use case

When you have a large system with multiple domains and different teams responsible for each, federated supergraphs allow each team to own and manage their part of the schema. Federation makes it easier to scale both your organization since teams can work independently, and your system because you can scale services individually.

Next steps

Learn how the GraphOS Platform helps you build and scale graphs of any kind. If you learn best by doing, jump into building a supergraph with the quickstart.

Feedback

Forums