VOOZH about

URL: https://thenewstack.io/graphql-is-built-for-federation-but-dont-do-it-wrong/

⇱ GraphQL Is Built for Federation, But Don’t Do It Wrong - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2021-11-09 07:07:14
GraphQL Is Built for Federation, But Don’t Do It Wrong
contributed,sponsor-stepzen,sponsored,sponsored-post-contributed,
API Management / DevOps / Software Development

GraphQL Is Built for Federation, But Don’t Do It Wrong

A declarative approach is the better strategy and should be used for both the functional APIs and the GraphQL layer.
Nov 9th, 2021 7:07am by Anant Jhingran and Dan Debrunner
👁 Featued image for: GraphQL Is Built for Federation, But Don’t Do It Wrong
Lead image via Pexels.
StepZen sponsored this post.
Anant Jhingran
Anant is the founder and CEO of StepZen, a startup with a new approach for simplifying the way developers access the data they need to power digital experiences. With a career that spans IBM Fellow, CTO of IBM’s Information Management Division, CTO of Apigee and product leader at Google Cloud, Anant has spent his career at the forefront of innovation in databases, machine learning and APIs.

When organizations get to a certain size, they get organized around teams. Teams typically have functional responsibilities — marketing, finance, engineering and so on. APIs follow similar functional alignments; we see sets of APIs that offer up marketing functions (promotions, product descriptions, etc.), e-commerce functions (shopping carts, etc.), finance functions (order to cash, etc.). These APIs are typically independently developed by dedicated developer teams, even if organizationally they might be in the same engineering organization.

As organizations mature in their API journeys, and as GraphQL is adopted as the next wave of API technology, they realize that their REST investments must be leveraged into GraphQL APIs. The decisions on what to expose as GraphQL can either be centralized or happen on the functional teams. As teams and organizations get larger, a common pattern is for these decisions to be decentralized. So an enterprise might have a marketing GraphQL endpoint, an e-commerce GraphQL endpoint and a finance GraphQL endpoint, with each being taken care of by the respective teams.

Considerations for a Unified GraphQL Layer

Dan Debrunner
Dan is a software engineer at StepZen and was a senior technical staff member (STSM) with IBM's Data Management division and the architect for the Cloudscape database engine. Dan guided Cloudscape from a startup company through deployment in IBM's products and middleware, and ultimately IBM’s contribution of Cloudscape code to Apache as Derby in 2004.

However, modern digital experiences are not built on only one functional GraphQL API. An e-commerce website, for example, might combine marketing, e-commerce and logistics GraphQL APIs to name just a few. How do these different GraphQL APIs come together in one unified GraphQL layer, against which these digital experiences can be built?

There are various terms for how these functional GraphQL APIs combine into a unified layer: schema stitching and federation are the most common. Some of these terms have become associated with specific implementations, such as Apollo’s Federation. Let’s first articulate what’s needed for this unified GraphQL API to be built, and then we will talk about the various approaches.

  • There should be no business logic in this layer. It should primarily be a routing and assembly layer. In other words, and in terms of computer science, this layer has the responsibility to scatter the request to the right functional GraphQL APIs and gather the results back to return the answers.
  • The GraphQL layer must call a functional GraphQL API with the right authentication and authorization. After all, different functions can choose to implement their own mechanisms.
  • It must be able to handle common errors, including non-responsiveness.

When you look at the above considerations, there is only one difference between what this layer needs and what is needed to build any one of the functional GraphQL APIs. Which is that while the backends for the functional GraphQL APIs can be anything — REST, SOAP, databases — the backends for this layer are exclusively GraphQL. That’s it! Both the functional APIs and the unified GraphQL layer need the ability to connect multiple backends together. Both need to handle authentication and authorizations in the front and the back. Both need to handle errors and performance issues.

Now ask yourself: If a declarative approach is right for this layer, why is it not right for the functional APIs? And if it is right for the functional APIs, why is the same approach not right for this layer?

StepZen enables developers to easily build and deploy a single GraphQL API that gets the data they need from multiple backends. The API delivers the right data reliably, irrespective of backend protocols, schemas and authentications. We manage the API so that developers manage zero infrastructure.
Learn More
The latest from StepZen

The Same Approach for Functional APIs and the GraphQL Layer

You will likely come to the conclusion that programming your way out of the functional GraphQL APIs and yet using a declarative approach for this layer, as is proposed by Apollo, is fundamentally complicated from a skills and maintenance perspective. It is our belief that a declarative approach is better and should be used for both the functional APIs and this layer.

In StepZen, for example, any developer — whether building functional GraphQL APIs or in this layer — uses four concepts:

  • Each backend exposes a mini GraphQL subgraph. This subgraph can be automatically generated by introspection, selected from some prefabricated public endpoints, and/or authored by adding @rest, @dbquery, and @graphql constructs to hand-authored GraphQL schema files (SDL).
  • These subgraphs can be joined together by connecting a query/mutation in one subgraph with the data produced in another subgraph, using the @materializer construct.
  • A YAML configuration file that includes access control for both the API and the backend data sources. This file stays separated from the graphs above.
  • The API and the configuration are given to StepZen to run, and the system takes care of a standard way of optimizing, caching, error handling, etc. There is no infrastructure to run or manage, and we guarantee 99.99% availability for your API.

Using these four concepts, developers can leverage all the previous investments in existing APIs and infrastructure. At the same time, organizations and frontend teams get all the added benefits of having one GraphQL API for all their APIs.

StepZen enables developers to easily build and deploy a single GraphQL API that gets the data they need from multiple backends. The API delivers the right data reliably, irrespective of backend protocols, schemas and authentications. We manage the API so that developers manage zero infrastructure.
Learn More
The latest from StepZen
TRENDING STORIES
Anant is the founder and CEO of StepZen, a startup with a new approach for simplifying the way developers access the data they need to power digital experiences. With a career that spans IBM Fellow, CTO of IBM’s Information Management...
Read more from Anant Jhingran
Dan is a software engineer at StepZen and was a senior technical staff member (STSM) with IBM's Data Management division and the architect for the Cloudscape database engine. Dan guided Cloudscape from a startup company through deployment in IBM's products...
Read more from Dan Debrunner
StepZen sponsored this post.
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: Pragma.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.