The problem
With a database per service, no single query can join across services. A page that shows an order plus its customer plus its shipping status needs data from three owners.
The composer
The API composition pattern uses a composer, often an API gateway or a dedicated service, to:
- Call each owning service for its piece.
- Join the results in memory.
- Return one combined response.
Trade offs
- It is simple and needs no shared database.
- But it does in memory joins, which are costly for large sets.
- It is chatty, since one request fans out to many calls.
When to avoid
For complex reporting or huge joins, prefer CQRS with a precomputed read model instead of composing on every request. Composition shines for small, bounded lookups.
Key idea
API composition gathers pieces from several services and joins them in memory, ideal for small lookups but weak for large joins.