ServiceComposer is an ASP.NET Core ViewModel Composition Gateway. It solves the challenge of assembling a unified API response from data owned by multiple independent services. Each service registers a small composition handler that contributes its slice of data; ServiceComposer runs all handlers in parallel and returns a single merged JSON object to the caller — with no service knowing about any other.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ServiceComposer/ServiceComposer.AspNetCore/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Understand the ViewModel Composition pattern and when to use ServiceComposer.
Quickstart
Install, configure, and write your first composition handler in minutes.
Composition Handlers
Learn how handlers from different services contribute data to the same route.
Scatter/Gather
Fan out HTTP requests to downstream services and merge the results automatically.
Events
Coordinate between handlers within a single request using in-process events.
API Reference
Browse the full public API surface — interfaces, extensions, and options.
How it works
ServiceComposer integrates with the ASP.NET Core endpoint routing pipeline. You configure it once inProgram.cs, then let each service define its own handler class library.
Register and map composition handlers
Call
AddViewModelComposition() and MapCompositionHandlers() in Program.cs.Program.cs
Write a composition handler in each service
Implement
ICompositionRequestsHandler and decorate it with an HTTP routing attribute.SalesProductInfo.cs
Key capabilities
Parallel execution
All handlers for a route run concurrently via
Task.WhenAll, keeping latency low even as the number of services grows.Zero service coupling
Handlers never import each other. Each service evolves its handler independently.
Strongly typed view models
Replace dynamic objects with a concrete typed view model using
IViewModelFactory.Model binding
Use ASP.NET Core’s built-in model binding to access body, route, query, and form values inside handlers.
Composition filters
Intercept and short-circuit composition requests before they reach specific handlers.
OpenTelemetry
Built-in ActivitySource tracing for both ViewModel Composition and Scatter/Gather pipelines.