![]() |
VOOZH | about |
dotnet add package LiteBus --version 2.2.2
NuGet\Install-Package LiteBus -Version 2.2.2
<PackageReference Include="LiteBus" Version="2.2.2" />
<PackageVersion Include="LiteBus" Version="2.2.2" />Directory.Packages.props
<PackageReference Include="LiteBus" />Project file
paket add LiteBus --version 2.2.2
#r "nuget: LiteBus, 2.2.2"
#:package LiteBus@2.2.2
#addin nuget:?package=LiteBus&version=2.2.2Install as a Cake Addin
#tool nuget:?package=LiteBus&version=2.2.2Install as a Cake Tool
<h1 align="center"><br> <a href="https://github.com/litenova/LiteBus"> <img src="assets/logo/icon.png"> </a> <br> LiteBus <br> </h1> <h4 align="center">A lightweight, flexible in-process mediator for implementing Command Query Separation (CQS)</h4> <p align="center"> <a href="https://github.com/litenova/LiteBus/actions/workflows/release.yml"> <img src="https://github.com/litenova/LiteBus/actions/workflows/release.yml/badge.svg" alt="CI/CD Badge" /> </a> <a href="https://codecov.io/gh/litenova/LiteBus" > <img src="https://codecov.io/gh/litenova/LiteBus/graph/badge.svg?token=XBNYITSV5A" alt="Code Coverage Badge" /> </a> <a href="https://www.nuget.org/packages/LiteBus"> <img src="https://img.shields.io/nuget/vpre/LiteBus.svg" alt="LiteBus Nuget Version" /> </a> </p> <p align="center"> For detailed documentation and examples, please visit the <a href="https://github.com/litenova/LiteBus/wiki"><b>Wiki</b></a>. </p>
Built for .NET 8 and .NET 9 - Multi-targeting support for maximum compatibility
Zero external dependencies - Completely standalone with no third-party dependencies
Reduced reflection usage - Optimized for performance with minimal reflection
DDD-friendly design - Support for plain domain events without library dependencies, keeping your domain model clean
Comprehensive messaging types:
ICommand / ICommand<TResult> - For state-changing operationsIQuery<TResult> - For data retrieval operationsIStreamQuery<TResult> - For streaming large datasets via IAsyncEnumerable<T>IEvent - For notifications and event-driven architectureRich handler ecosystem:
Advanced features:
// Define the command result
public record CreateProductCommandResult(Guid Id);
// Define a command with a result
public record CreateProductCommand(string Title) : ICommand<CreateProductCommandResult>;
// Implement a command validator
public class CreateProductCommandValidator : ICommandValidator<CreateProductCommand>
{
public Task ValidateAsync(CreateProductCommand command, CancellationToken cancellationToken = default)
{
if (string.IsNullOrWhiteSpace(command.Title))
throw new ValidationException("Product title cannot be empty");
return Task.CompletedTask;
}
}
// Implement a command handler
public class CreateProductCommandHandler : ICommandHandler<CreateProductCommand, CreateProductCommandResult>
{
private readonly IProductRepository _repository;
public CreateProductCommandHandler(IProductRepository repository)
{
_repository = repository;
}
public async Task<CreateProductCommandResult> HandleAsync(CreateProductCommand command, CancellationToken cancellationToken = default)
{
var product = new Product(Guid.NewGuid(), command.Title);
await _repository.SaveAsync(product, cancellationToken);
return new CreateProductCommandResult(product.Id);
}
}
// Configure in ASP.NET Core
services.AddLiteBus(liteBus =>
{
liteBus.AddCommandModule(module =>
{
module.RegisterFromAssembly(typeof(CreateProductCommand).Assembly);
});
});
// Use in a controller or service
public class ProductsController : ControllerBase
{
private readonly ICommandMediator _commandMediator;
public ProductsController(ICommandMediator commandMediator)
{
_commandMediator = commandMediator;
}
[HttpPost]
public async Task<ActionResult<CreateProductCommandResult>> CreateProduct(CreateProductCommand command)
{
var result = await _commandMediator.SendAsync(command);
return Ok(result);
}
}
For comprehensive documentation, including detailed explanations, advanced features, and best practices, please visit the Wiki.
LiteBus is available as NuGet packages:
dotnet add package LiteBus
dotnet add package LiteBus.Extensions.MicrosoftDependencyInjection
Or specific modules:
dotnet add package LiteBus.Commands
dotnet add package LiteBus.Queries
dotnet add package LiteBus.Events
LiteBus is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 4 NuGet packages that depend on LiteBus:
| Package | Downloads |
|---|---|
|
VaultForce.Application
shared resources |
|
|
Ramsha.LocalMessaging
Modular extensible framework built on top of ASP.NET Core. |
|
|
VaultForce.Sdk
shared sdk |
|
|
ACleanAPI
ACleanAPI is a .NET library that provides a clean architecture implementation for building APIs. It offers a structured approach to organizing code, separating concerns, and promoting maintainability and testability in API development. |
Showing the top 1 popular GitHub repositories that depend on LiteBus:
| Repository | Stars |
|---|---|
|
EdiWang/Moonglade
Blog system of https://edi.wang, runs on Microsoft Azure
|
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 1,708 | 5/29/2026 |
| 4.4.0 | 1,386 | 5/19/2026 |
| 4.3.0 | 18,566 | 2/17/2026 |
| 4.2.0 | 31,434 | 11/11/2025 |
| 4.1.0 | 1,397 | 10/30/2025 |
| 4.0.0 | 4,001 | 9/18/2025 |
| 3.1.0 | 16,249 | 8/5/2025 |
| 3.0.0 | 9,366 | 7/21/2025 |
| 2.2.3 | 231 | 7/18/2025 |
| 2.2.2 | 216 | 7/18/2025 |
| 2.2.1 | 13,474 | 7/8/2025 |
| 2.2.0 | 273 | 7/8/2025 |
| 2.1.0 | 280 | 7/1/2025 |
| 2.0.0 | 1,658 | 4/29/2025 |
| 1.1.0 | 274 | 4/24/2025 |
| 1.0.0 | 214 | 4/19/2025 |
| 0.25.1 | 292 | 4/17/2025 |
| 0.25.0 | 294 | 4/13/2025 |
| 0.24.4 | 257 | 4/10/2025 |