# martinothamar/Mediator

A high performance implementation of Mediator pattern in .NET using source generators.

Repository: https://github.com/martinothamar/Mediator
Canonical: https://ross.abutalabs.com/products/mediator
Language: C#
License: MIT
License Family: permissive
Topics: csharp, dotnet, dotnetcore, dotnet-core, source-generation, source-gen, sourcegenerator, source-generators, dotnet-standard, csharp-sourcegenerator, mediator, mediator-pattern
Last push: 2026-03-22T23:44:12+00:00

## Health v2 (maintenance only)
Score: 68/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 73, release rhythm 43, longevity 100
- inputs: {"age_days": 1981, "days_push": 164, "days_rel": 164, "gap_med": 229, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3697, forks 181 (observed 2026-08-28T04:08:14.905327+00:00)

## What it is
A high-performance .NET implementation of the Mediator pattern built with C# source generators, offering a MediatR-like API. It generates DI registration and monomorphized dispatch code at build time, enabling full Native AOT support without reflection.

## Use cases
- decouple request handlers from controllers in ASP.NET Core apps
- replace MediatR for better performance and Native AOT support
- implement CQRS-style commands and queries in .NET
- avoid fat constructors with many injected services
- catch missing handler configuration at build time instead of runtime
- reduce cold start time in serverless and edge deployments

## When to choose
- you use the Mediator pattern in .NET and want maximum performance
- you need Native AOT compatibility without reflection
- you want compile-time diagnostics for missing handlers
- you want a stable, semver-strict MediatR alternative

## When to avoid
- you need MediatR's extensive ecosystem of pipeline behaviors and integrations
- your project does not use .NET or C#
- you rely on runtime-registered or dynamically discovered handlers
- you need notification/multicast publishing features beyond basic request/response

## Facets
- artifact type: library
- maturity: stable
- function: middleware, developer-tools, plugin-system
- domain: developer-tools, backend, web-development
- platform: dotnet, cross-platform
- tags: mediator-pattern, source-generator, mediatr-alternative, native-aot, dependency-injection, cqrs, in-process-messaging

## Member repositories
- martinothamar/Mediator (main) score 68

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:14.905327+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:31:04.097485+00:00, confidence not recorded.
  - readme: https://github.com/martinothamar/Mediator (fetched 2026-08-28T04:08:14.905327+00:00, sha dd4e4a29ea0b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
