ByteByteGo Newsletter

ByteByteGo Newsletter

A Detailed Guide to API Composition Techniques

ByteByteGo's avatar
ByteByteGo
Aug 13, 2026
∙ Paid

In a service-based architecture, a single product screen showing a user profile, that user’s five most recent orders, the delivery status of each order, and a short list of recommendations requires data from four separate services. Each service stores only its own data, so none of the four services returns the full set on its own. In other words, the caller issues four separate calls, and merges the resulting four responses in the structure needed for the user interface. This merging step is API composition, and it exists in every system where data is split across more than one service.

The code that performs this merging can run in several places. It can run inside the mobile application, on a server in the datacenter, at a CDN edge location, or inside one of the four services. Putting a server between the mobile application and the four services adds a network hop, which sounds like it should cost extra time. However, it usually reduces total load time instead, because a round trip between a phone and a server on a weak mobile connection can take a few hundred milliseconds, while a round trip between two services inside the same datacenter takes a fraction of a millisecond. To put it simply, trading four expensive round trips for one expensive round trip plus four cheap ones is often a large net saving.

However, latency is only the first tradeoff. The place where the merge operation runs also determines what happens when one of the four services is unavailable, how much of the response can be cached, and which team has to approve a change before the screen ships.

In this article, we are going to dive deep into the area of the API composition problem and the patterns associated with it. Here’s what we will cover:

  • The API composition problem

  • Client-side composition

  • Over-fetching and under-fetching

  • Composition, aggregation, and orchestration

  • API gateways

  • Backends for Frontends

  • GraphQL as a composition layer

  • Edge composition

  • Availability and caching tradeoffs

  • Versioning across multiple frontends

  • Ownership of the composition layer

The API Composition Problem

User's avatar

Continue reading this post for free, courtesy of Alex Xu.

Or purchase a paid subscription.
© 2026 ByteByteGo · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture