Many schemas, one API
Automatically stitch multiple GraphQL schemas together into one larger API in a simple, fast and powerful way, with type merging to join the pieces. Part of the Hive ecosystem by The Guild.
- Type merging
- Transforms
- Works with Federation subgraphs
How stitching works
- Type mergingLet several services contribute fields to the same type; the gateway resolves each part from the service that owns it.
- TransformsRename, filter, wrap and prune subschemas before they join the gateway, without touching the services.
- Stitching directivesDescribe merges in the subgraph SDL itself and let the gateway compose the configuration.
Stitch two services
Point stitchSchemas at your subschemas and describe how their shared types merge. The result is a regular executable schema.
See the basic exampleimport { stitchSchemas } from '@graphql-tools/stitch';
export const gatewaySchema = stitchSchemas({
subschemas: [
{
schema: usersSchema,
merge: {
User: {
selectionSet: '{ id }',
fieldName: 'user',
args: ({ id }) => ({ id }),
},
},
},
{ schema: postsSchema },
],
});Learn more
Getting started
A basic gateway, remote subschemas, duplicate types, and error handling.
Getting started →Handbook
Guided, runnable examples: from the foundation to architecture patterns and other integrations.
Open the handbook →Hive Gateway
A production gateway built on the same tooling, with a schema registry, observability and more.
Hive Gateway docs →
Discover the complete ecosystem of tools and libraries
Complete GraphQL Federation Stack
Our libraries to support all your GraphQL needs
Explore the Ecosystem