Patterns
API Composition

API Composition

Problem

Implementing the API Aggregator / API Composer pattern to manually aggregate multiple services into a single, aggregated API, which is secured behind an API Gateway. While this approach can provide a unified interface to various services, it does not scale well due to the extensive infrastructure and automation required. Furthermore, the lack of a type-safe abstraction framework on top of the APIs being aggregated leads to increased complexity and potential errors when upstream APIs change.

Solution

To address the issues present in the legacy API Aggregator / API Composer pattern, we propose a new solution using a Virtual Graph . By employing a Virtual Graph to introspect all upstream APIs into a unified API, you can benefit from the following advantages:

  1. Enhanced type-safety, simplifying the process of composing APIs and minimizing the risk of errors.
  2. Immediate visibility of errors at compile/deployment time, streamlining the debugging process.
  3. Effortless identification of affected compositions when upstream services introduce changes, allowing for swift adjustments in the composition layer.

Note: By adopting WunderGraph (opens in a new tab), you can create a more scalable, maintainable, and error-resistant API composition solution, significantly improving your system's ability to adapt to changes in upstream services.