A simple, in-process mediator implementation for .NET that supports request/response, commands, queries, notifications, and events.
MediatR is a simple mediator implementation for .NET that facilitates in-process messaging between components without requiring direct dependencies. It supports request/response patterns, commands, queries, notifications, and events, enabling clean separation of concerns in applications. The library uses C# generic variance for intelligent dispatching and works seamlessly with dependency injection containers like Microsoft.Extensions.DependencyInjection.
.NET developers building applications that benefit from decoupled architecture, such as those following clean architecture, CQRS, or domain-driven design patterns.
Developers choose MediatR for its simplicity, zero dependencies, and robust support for modern .NET patterns. It reduces coupling between components while providing powerful features like behaviors, pipelines, and streaming requests out of the box.
Simple, unambitious mediator implementation in .NET
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
MediatR has no dependencies beyond .NET, making it lightweight and easy to integrate without adding bloat, as emphasized in the README's 'no dependencies' claim.
It handles requests, commands, queries, notifications, and streaming requests out of the box, enabling clean CQRS and event-driven architectures without extra libraries.
The library includes built-in support for Microsoft.Extensions.DependencyInjection, with simple registration methods like AddMediatR that automatically scan and register handlers.
Behaviors and processors allow adding cross-cutting concerns like validation or logging via a clean pipeline, reducing code duplication in handler logic.
Setting a license key is required for certain uses, adding administrative complexity and potential cost, as noted in the README's license key section.
Being intentionally unambitious, it lacks advanced messaging features such as automatic retry, dead-letter queues, or built-in monitoring, forcing developers to implement these manually.
The use of reflection and generic variance for dispatching can introduce overhead compared to direct method calls, which may impact high-throughput scenarios.