MIT licensed
Free for any use, forever. No commercial tier, no seat counting.
dotnet add package Mediant// 1. Registerbuilder.Services.AddMediant(cfg => cfg.RegisterServicesFromAssembly(typeof(Program).Assembly));
// 2. Define a command — explicit CQRS, not just IRequestpublic record CreateOrder(string UserId) : ICommand<Result<Guid>>;
// 3. Handle it — ValueTask + Result, no exceptions for control flowpublic class CreateOrderHandler : ICommandHandler<CreateOrder, Result<Guid>>{ public ValueTask<Result<Guid>> Handle(CreateOrder cmd, CancellationToken ct) => new(Result<Guid>.Success(Guid.NewGuid()));}
// 4. Send itvar result = await mediator.Send(new CreateOrder("user-1"));result.Match(id => Ok(id), error => Problem(error.Description));Measured with BenchmarkDotNet against MediatR v12.4.1 on .NET 10 (Apple M5). These isolate framework dispatch overhead with no-op handlers — see the full method and results.
Publish (notification dispatch)
| Handlers | Mediant | MediatR v12 | |
|---|---|---|---|
| 1 | 24 ns / 88 B | 44 ns / 288 B | 46% faster · 3.3× less memory |
| 10 | 69 ns / 376 B | 184 ns / 1,656 B | 63% faster · 4.4× less memory |
| 100 | 527 ns / 3,256 B | 1,521 ns / 15,336 B | 65% faster · 4.7× less memory |
Send (pipeline) is within noise up to 4 behaviors, then Mediant pulls ahead — and allocates less in every scenario.
MIT licensed
Free for any use, forever. No commercial tier, no seat counting.
Result pattern built in
Result<T> and typed Errors — no throwing exceptions for control flow. Map, Bind, Match.
Explicit CQRS
ICommand<T> and IQuery<T> instead of one IRequest. Streaming via IStreamRequest<T>.
11 built-in behaviors
Audit, logging, validation, authorization, idempotency, transactions, retry, caching, cache invalidation, performance — attribute-driven, explicitly ordered.
Native AOT & trimming
A source generator precomputes handler registration and dispatch at compile time — no assembly scanning, no runtime codegen.
OpenTelemetry
Traces and metrics from System.Diagnostics primitives, with zero cost when nothing listens.
HTTP endpoints
[HttpEndpoint] maps a command straight to a route — no controller boilerplate. Result maps to
the right status code.
300 tests
Unit, integration, load (50K concurrent) and E2E. Roslyn analyzers catch attribute misuse at compile time.
Mediant is the CQRS layer inside Mockifyr, an API mock engine whose correctness is proven differentially against a reference oracle. Dogfooded, not demoware.