Namespacing for GraphQL: Conflict-Free merging of any number of APIs - WunderGraph
State of GraphQL Federation 2026
Jens Neuse
CEO & Co-Founder at WunderGraph
November 28, 2021·10min read
Last updated on July 19, 2026
This article is archived and no longer maintained. It describes an earlier version of WunderGraph's namespacing feature, which is no longer part of the current product. The examples and setup steps may not work as described. For current documentation and guidance, see WunderGraph Documentation.
Namespacing is an essential concept in programming, allowing us to group things and prevent naming collisions. This post shows you how we apply the concept to APIs to make composition and integration of different services easier.
We'll show you how to integrate 8 services: SpaceX GraphQL, 4x GraphQL using Apollo Federation, a REST API using OpenAPI Specification, a PostgreSQL-based API and a Planetscale-Vitess-based (MySQL) API with just a couple of lines of code, fully automatic, without any conflicts.
The Problem - How to merge APIs conflict free
To get there, we have to solve a number of problems.
- We need to settle on a common language, a universal language to unify all our APIs
- We need to figure out a way to "namespace" our APIs to resolve conflicts
- We need a runtime to execute the "namespaced" Operations
GraphQL: The universal API integration language
GraphQL comes with two very powerful features that are essential for our use case:
- It allows us to query exactly the data we need.
- It lets us easily build and follow links between types.
However, GraphQL doesn't have a concept of namespaces, making it complex for API integration. This leads us to the concepts of Schema Stitching and Federation.
With Schema Stitching, you combine GraphQL services that are not aware of the stitching. Federation distributes integration logic across all GraphQL Microservices, known as Subgraphs.
Why the One Graph principle doesn't make sense
The One Graph principle fails the reality check. Instead, we need a simple way to compose multiple Graphs. The world is indeed diverse, with many great companies offering remarkable products via APIs.
GraphQL Namespacing: Conflict-free merging of any number of APIs
Using namespaces to solve naming collisions can be accomplished by suffixing types and fields appropriately (e.g., Customer_stripe, Customer_mailchimp).
WunderGraph: A runtime to facilitate namespaced GraphQL
By renaming types and fields, you can avoid conflicts across various APIs. The command yarn global add @wundergraph/wunderctl can be used to get started with integrating multiple services seamlessly.
Summary
Namespacing facilitates writing and sharing code efficiently. We explored how to merge GraphQL, Federation, REST, PostgreSQL, and Planetscale APIs in just a few lines of code. If you're interested in seeing all this in action, here's a video demonstrating the entire flow.