Skip to content

Introduction

ImmediatePlatform is a suite of source-generated .NET libraries for Vertical Slice Architecture, CQRS, validation, minimal APIs, caching and dependency injection.

4 min read

ImmediatePlatform offers libraries that make implementing the Vertical Slice Architecture, CQRS pattern and Validation in .NET easier. You can think of the ImmediatePlatform suite as an alternative to MediatR/Mediator, FluentValidation and ASP.NET Core Minimal APIs/Controllers.

What “source generated” buys you

Every package in the suite is a Roslyn source generator. None of them scan assemblies, build expression trees, or look types up by name at runtime — they read your code at compile time and write ordinary C# next to it. That has four practical consequences:

  • No reflection and no startup scanning. The generated registration methods are literal lists of services.Add(...) calls. Startup cost is the cost of running them.
  • AOT- and trimming-friendly. There are no dynamic type lookups for the trimmer to fail on.
  • Mistakes are build errors. A behavior whose constraints don’t match, a handler with the wrong return type, a validator missing a required method — all of these fail the build with a specific diagnostic instead of surfacing at runtime.
  • You can read and debug the output. The generated pipeline is C# you can step through.

See How source generation works for the details, including how to inspect the generated files.

You don’t have to adopt all of it

The libraries are opt-in and mix freely with things you already use. All of these are supported combinations:

  • Immediate.Handlers behind ASP.NET Core Controllers, with no Immediate.Apis
  • Immediate.Handlers + FluentValidation, with no Immediate.Validations
  • Immediate.Injections alone, with no mediator anywhere in the project
  • Immediate.Apis + Immediate.Handlers + DataAnnotations

Please see our full cookbook for all integration examples.

Which package do I want?

I want to…Package
Decouple callers from handlers without a runtime mediatorImmediate.Handlers
Add logging, telemetry or transactions around every requestImmediate.Handlers — behaviors
Stream results back as they are producedImmediate.Handlers — streaming handlers
Validate requests without writing validator classes by handImmediate.Validations
Turn a handler into an HTTP endpointImmediate.Apis
Cache a query’s response in memoryImmediate.Cache
Register ordinary services with DI by attributeImmediate.Injections
Run work in the background on a scheduleImmediate.Jobs

The libraries

Immediate.Handlers

Immediate.Handlers GitHub repository Immediate.Handlers NuGet version Immediate.Handlers latest GitHub release Immediate.Handlers license
  • Implementation of the mediator pattern in .NET using source-generation.
  • Support for implementing the Command and Query Responsibility Segregation (CQRS) pattern with minimal boilerplate.
  • Support for addressing cross-cutting concerns via behaviors.
  • All pipeline behaviors are determined and the call-tree built at compile-time; meaning that all dependencies are enforced via compile-time safety checks.
  • Behaviors and dependencies are obtained via DI at runtime based on compile-time determined dependencies.
  • Implementation that does not rely on the service locator anti-pattern.

Immediate.Apis

Immediate.Apis GitHub repository Immediate.Apis NuGet version Immediate.Apis latest GitHub release Immediate.Apis license
  • Source generator for Minimal APIs for Immediate.Handlers
  • Allows for easily mapping handlers to endpoints, individually or in route groups

Immediate.Validations

Immediate.Validations GitHub repository Immediate.Validations NuGet version Immediate.Validations latest GitHub release Immediate.Validations license

Immediate.Cache

Immediate.Cache GitHub repository Immediate.Cache NuGet version Immediate.Cache latest GitHub release Immediate.Cache license
  • Collection of classes that simplify caching responses from Immediate.Handlers handlers.
  • Backed by IMemoryCache; concurrent requests for one key coalesce onto a single handler execution.

Immediate.Injections

Immediate.Injections GitHub repository Immediate.Injections NuGet version Immediate.Injections latest GitHub release Immediate.Injections license
  • Source generator for registering non-IH handler classes with MSDI.
  • Supports keyed services, open generics, factories and proxies.

Immediate.Jobs

Immediate.Jobs GitHub repository
  • Reflection-free background job scheduler for .NET built on Immediate.Handlers.
  • Generates typed schedulers, payload metadata, and dependency-injection registrations at compile time.
  • See the Immediate.Jobs manual for scheduling, workflows, storage, operations and testing.