A lightweight, high-performance mediator for implementing Command Query Separation (CQS) and Domain-Driven Design (DDD) in .NET applications.
LiteBus is a lightweight, high-performance in-process mediator library for .NET that helps developers implement Command Query Separation (CQS) and Domain-Driven Design (DDD) patterns. It provides a clean, decoupled architecture by separating commands, queries, and events, enabling scalable and testable application design. The library minimizes reflection usage and leverages covariance and contravariance for core functionality.
.NET developers building enterprise applications who need a structured way to separate business logic, enforce CQS/DDD patterns, and manage cross-cutting concerns like validation, logging, and error handling.
Developers choose LiteBus for its semantic messaging, granular pipeline control, and high performance as a free, open-source alternative to MediatR. Its DI-agnostic design, open generic handlers, and advanced event concurrency features provide greater flexibility and maintainability.
LiteBus is an easy-to-use and ambitious in-process mediator providing the foundation to implement Command Query Separation (CQS). It is implemented with minimal reflection and instead utilizes covariance and contravariance to provide its core functionality.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
First-class contracts like ICommand<TResult> and IQuery<TResult> enforce Command Query Separation, making code self-documenting and intentions explicit, as shown in the quick start examples with separate command, query, and event definitions.
Distinct pre-handlers, post-handlers, and error-handlers for each message type allow fine-grained processing stages, enabling validation, logging, and error handling at specific points without monolithic behaviors.
A single handler can apply to all matching message types via generic constraints, automatically discovered during assembly registration, simplifying cross-cutting concerns like logging and metrics without per-message boilerplate.
Configurable sequential or parallel execution for event priority groups and handlers fine-tunes throughput, useful for managing complex workflows with dependent or independent side-effects.
The library is split into numerous NuGet packages (e.g., separate extensions for commands, queries, events), complicating installation and dependency management compared to all-in-one alternatives like MediatR.
While DI-agnostic, first-class integration is only for Microsoft DI and Autofac; other containers require implementing the adapter pattern, adding development and maintenance overhead.
As a newer alternative to MediatR, LiteBus has fewer community resources, third-party integrations, and examples, which can slow adoption and troubleshooting for teams reliant on extensive support.
LiteBus is an open-source alternative to the following products: