Everything you need for the Mediator pattern
Built for .NET developers who value clarity, resilience and observability.
CQRS & Mediator
IRequest, INotification, IFireAndForget, IStreamRequest — clean separation of commands, queries and events out of the box.
Pipeline Behaviors
Compose IPipelineBehavior layers — logging, validation, caching, idempotency — without touching your handlers.
Resilience Policies
Retry, CircuitBreaker, Timeout, Bulkhead, Hedge, RateLimiter, Chaos, Fallback — fluent builder, zero extra dependencies.
Result Pattern
Result<T> and Result with Map, Bind, Match, Tap, OnFailure — typed error handling without exceptions.
Caching & Idempotency
ICacheable, IInvalidatesCache, IIdempotent — declarative caching and idempotent requests as pipeline behaviors.
OpenTelemetry Ready
Built-in ActivitySource, IMetricsCollector, IRequestObserver — plug in your tracing backend in one line.
See it in action
Send queries, handle results, compose behaviors — all in a few lines.
services.AddValiMediator(cfg => cfg .AddBehavior<LoggingBehavior>() .AddBehavior<ValidationBehavior>()); // Send a queryvar result = await mediator.Send(new GetUserQuery(userId)); result.Match( onSuccess: user => Ok(user), onFailure: err => Problem(err.Message));6 NuGet packages. Install only what you need.
Each package is independent — add the features your project requires.
Core mediator, CQRS, Result pattern, pipeline, streaming.
dotnet add package Vali-MediatorRetry, CircuitBreaker, Timeout, Bulkhead, Hedge, RateLimiter, Chaos, Fallback.
dotnet add package Vali-Mediator.ResilienceDeclarative pipeline caching with ICacheable and IInvalidatesCache.
dotnet add package Vali-Mediator.CachingOpenTelemetry ActivitySource, metrics collector, request observers.
dotnet add package Vali-Mediator.ObservabilityIdempotent request handling via IIdempotent and IIdempotencyStore.
dotnet add package Vali-Mediator.IdempotencyMaps Result<T> to HTTP responses for controllers and Minimal APIs.
dotnet add package Vali-Mediator.AspNetCore