Stitching

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.

How stitching works

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 example
import { 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

Discover the complete ecosystem of tools and libraries

Complete GraphQL Federation Stack

Our libraries to support all your GraphQL needs

Explore the Ecosystem