TinyBlueWhale.MiniBus 0.1.0

dotnet add package TinyBlueWhale.MiniBus --version 0.1.0
                    
NuGet\Install-Package TinyBlueWhale.MiniBus -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TinyBlueWhale.MiniBus" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TinyBlueWhale.MiniBus" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TinyBlueWhale.MiniBus" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TinyBlueWhale.MiniBus --version 0.1.0
                    
#r "nuget: TinyBlueWhale.MiniBus, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TinyBlueWhale.MiniBus@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TinyBlueWhale.MiniBus&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TinyBlueWhale.MiniBus&version=0.1.0
                    
Install as a Cake Tool

TinyBlueWhale.MiniBus

Minimal high-performance in-process mediator for .NET.

Focused only on what most applications actually use every day:

  • Send()
  • Publish()

No pipelines. No behaviors. No decorators. No framework ceremony.

Built for:

  • Minimal APIs
  • CQRS-lite architectures
  • Vertical Slice Architecture
  • Fast startup
  • Low allocations
  • Simple codebases

Why?

Most projects use MediatR for:

await mediator.Send(command);
await mediator.Publish(@event);

That is the real-world 80%.

TinyBlueWhale.MiniBus exists to solve exactly that with:

  • fewer allocations
  • faster startup
  • simpler internals
  • zero unnecessary abstractions
  • extremely small codebase

Features

  • Minimal API surface
  • Assembly scanning
  • Request/Response support
  • Multi-handler event publishing
  • Native Dependency Injection support
  • CancellationToken propagation
  • Fast startup time
  • Low memory allocations
  • Zero external mediator dependencies

Installation

Install-Package TinyBlueWhale.MiniBus

or

dotnet add package TinyBlueWhale.MiniBus

Quick Start

1. Register MiniBus

using TinyBlueWhale.MiniBus;

builder.Services.AddMiniBus(typeof(CreateOrderHandler).Assembly);

2. Create a Request

public sealed record CreateOrderCommand(
    string CustomerEmail,
    decimal TotalAmount)
    : IRequest<Guid>;

3. Create a Handler

public sealed class CreateOrderHandler
    : IRequestHandler<CreateOrderCommand, Guid>
{
    public Task<Guid> Handle(
        CreateOrderCommand request,
        CancellationToken cancellationToken = default)
    {
        return Task.FromResult(Guid.NewGuid());
    }
}

4. Send Request

var orderId = await miniBus.Send(
    new CreateOrderCommand(
        "customer@company.com",
        1499.99m));

Events

Create Event

public sealed record OrderCreatedEvent(
    Guid OrderId,
    string CustomerEmail);

Create Event Handler

public sealed class SendConfirmationEmailHandler
    : IEventHandler<OrderCreatedEvent>
{
    public Task Handle(
        OrderCreatedEvent @event,
        CancellationToken cancellationToken = default)
    {
        Console.WriteLine(
            $"Confirmation email sent to '{@event.CustomerEmail}'.");

        return Task.CompletedTask;
    }
}

Publish Event

await miniBus.Publish(
    new OrderCreatedEvent(orderId, customerEmail));

Benchmarks

Environment:

  • .NET 9
  • Intel i7-1185G7
  • BenchmarkDotNet

Startup Registration

Method Mean Allocated
TinyBlueWhale.MiniBus 7.067 ms 2.63 MB
MediatR 565.032 ms 23.56 MB

TinyBlueWhale.MiniBus startup registration is ~80x faster.


Send()

Method Mean Allocated
TinyBlueWhale.MiniBus 54.40 ns 168 B
MediatR 87.32 ns 336 B

TinyBlueWhale.MiniBus executes requests ~1.6x faster with half the allocations.


Publish() with 50 Handlers

Method Mean Allocated
TinyBlueWhale.MiniBus 1.565 μs 1.17 KB
MediatR 1.544 μs 7.55 KB

TinyBlueWhale.MiniBus keeps similar publish throughput with significantly lower memory allocations.


Example Project

Repository includes a complete Minimal API example:

TinyBlueWhale.MiniBus.Example.ECommerce

Includes:

  • Commands
  • Queries
  • Events
  • Multiple event handlers
  • Swagger
  • Vertical Slice Architecture

Philosophy

TinyBlueWhale.MiniBus intentionally avoids:

  • pipelines
  • behaviors
  • middleware chains
  • decorators
  • feature creep
  • enterprise ceremony

If your application needs advanced orchestration frameworks, MediatR is still an excellent choice.

TinyBlueWhale.MiniBus is designed for applications that want:

  • simplicity
  • speed
  • maintainability
  • tiny abstractions

Roadmap

Potential future improvements:

  • source generators
  • compile-time registration
  • analyzers
  • AOT optimizations

Without sacrificing simplicity.


Contributing

Contributions are welcome.

Rules:

  • Keep the core minimal.
  • Avoid unnecessary abstractions.
  • Performance regressions are not accepted.
  • Every feature must justify its complexity.
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 97 5/7/2026