Schema Stitching is a GraphQL technique for combining multiple GraphQL schemas into a single unified API gateway. It enables developers to compose distributed GraphQL services, integrate third-party APIs, and build federated data layers by merging types, queries, and mutations from multiple subgraphs into one executable schema.
The primary implementation is provided by The Guild's @graphql-tools/stitch package, which supports type merging, stitching directives, schema delegation, and automated query planning comparable to Apollo Federation.
Human URL: https://the-guild.dev/graphql/stitching
Type Merging — Merges types with the same name from multiple subschemas into a single unified type at the gateway. Keys identify objects for cross-service resolution.
Schema Delegation — The mechanism by which the gateway proxies field resolution to underlying subschemas, forwarding queries to each service's executor.
Stitching Directives — SDL directives (@key, @merge, @computed, @canonical) that let subservices declare their own merging configuration for gateway-reloadable composition.
Schema Transforms — Functions applied to subschemas before stitching: rename types, filter fields, wrap queries, hoist fields, or prune schemas.
| Tool | Purpose |
|---|---|
| GraphQL Mesh | Stitch REST, gRPC, and database sources into GraphQL |
| Hive Gateway | Federated GraphQL router supporting stitching and federation |
| Apollo Federation | Alternative supergraph composition approach |
| GraphQL Yoga | GraphQL server compatible with schema stitching |
- schema-stitching-config-schema.json — JSON Schema for stitching gateway configuration
- schema-stitching-config-structure.json — Document structure for stitching configuration
- schema-stitching-context.jsonld — Linked data context for schema stitching vocabulary
- schema-stitching-basic-gateway-example.json — Basic gateway combining two GraphQL services
- schema-stitching-type-merging-example.json — Type merging with stitching directives
- schema-stitching-vocabulary.yml — Domain vocabulary and taxonomy for schema stitching concepts
Kin Lane — kin@apievangelist.com