Skip to content

Foundatio MediatorBuild Loosely Coupled .NET Apps β€” Without the Tradeoffs

Easy to maintain, easy to test, and blazingly fast β€” a convention-based mediator powered by source generators and interceptors

Foundatio Mediator

Quick Example ​

Create a simple handler by following naming conventions:

csharp
public record Ping(string Text);

public class PingHandler
{
    public string Handle(Ping msg) => $"Pong: {msg.Text}";
}

Register the mediator and use it:

csharp
// Program.cs
services.AddMediator();

// Usage
var reply = await mediator.InvokeAsync<string>(new Ping("Hello"));
// Output: "Pong: Hello"

Turn your message handlers into API endpoints automatically:

csharp
app.MapMediatorEndpoints();
// That's it β€” routes, methods, and parameter binding are all generated for you.

Released under the MIT License.