UnambitiousFx.Synapse 1.0.0-beta6

This is a prerelease version of UnambitiousFx.Synapse.
There is a newer version of this package available.
See the version list below for details.
dotnet add package UnambitiousFx.Synapse --version 1.0.0-beta6
                    
NuGet\Install-Package UnambitiousFx.Synapse -Version 1.0.0-beta6
                    
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="UnambitiousFx.Synapse" Version="1.0.0-beta6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="UnambitiousFx.Synapse" Version="1.0.0-beta6" />
                    
Directory.Packages.props
<PackageReference Include="UnambitiousFx.Synapse" />
                    
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 UnambitiousFx.Synapse --version 1.0.0-beta6
                    
#r "nuget: UnambitiousFx.Synapse, 1.0.0-beta6"
                    
#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 UnambitiousFx.Synapse@1.0.0-beta6
                    
#: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=UnambitiousFx.Synapse&version=1.0.0-beta6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=UnambitiousFx.Synapse&version=1.0.0-beta6&prerelease
                    
Install as a Cake Tool

Synapse

Build Status NuGet NuGet Downloads codecov License: MIT .NET

A lightweight, high-performance mediator implementation for .NET with first-class integration with Result types.


๐Ÿ”ง Compatibility & support

  • Dependency-free at runtime: No external runtime dependencies.
  • Native AOT-compatible: Designed to work well in Native AOT scenarios (see the examples/WebApiAot).
  • Supported .NET versions: Supports Microsoft LTS releases and the latest non-LTS release. See CI matrix for exact versions.

๐ŸŽฏ Features

  • Lightweight Mediator โ€” Requests, commands, queries, and notifications with minimal allocations.
  • Result-first โ€” Uses UnambitiousFx.Functional Result for explicit error handling.
  • Streaming requests โ€” Built-in support for streaming request/response patterns.
  • Pipeline Behaviors โ€” Typed, untyped and conditional pipeline behaviors for requests and events.
  • Dependency injection friendly โ€” Register handlers and behaviours via a fluent configuration API (AddSynapse).
  • Outbox support โ€” Interfaces and helpers to implement the outbox pattern and reliable event publishing.
  • Observability hooks โ€” Metrics and tracing integration points to capture latency and publish metrics.
  • Source generator โ€” Optional code-generation to reduce allocations and simplify registration.
  • Examples & benchmarks โ€” Real-world examples and performance benchmarks included.

๐Ÿ“ฆ Installation

dotnet add package UnambitiousFx.Synapse

๐Ÿš€ Quick Start

Register mediator services

Register the synapse and your handlers in Program.cs:

builder.Services.AddSynapse(cfg =>
{
    cfg.AddRegisterGroup(new ManualRegisterGroup());

    // Request handlers
    cfg.RegisterRequestHandler<CreateTodoCommandHandler, CreateTodoCommand, Guid>()
        .RegisterRequestHandler<ListTodoQueryHandler, ListTodoQuery, IEnumerable<Todo>>();

    // Event handlers
    cfg.RegisterEventHandler<TodoUpdatedHandler, TodoUpdated>();

    // Pipeline behaviors
    cfg.RegisterRequestPipelineBehavior<SimpleLoggingBehavior>();
    cfg.RegisterEventPipelineBehavior<SimpleLoggingBehavior>();
});

Send requests

Use ISender to dispatch requests to handlers:

// Send a command that returns a value
var result = await sender.SendAsync<CreateTodoCommand, Guid>(command);

// Send a command without a response
var result = await sender.SendAsync<UpdateTodoCommand>(command);

// Stream results from an IStreamRequest
await foreach (var itemResult in sender.SendStreamAsync<ListItemsRequest, Item>(request))
{
    // itemResult is Result<Item>
}

Use handlers directly

You can also resolve IRequestHandler<TRequest, TResponse> or IRequestHandler<TRequest> from DI and call HandleAsync directly when appropriate.

๐Ÿ“Š Observability & Metrics

Synapse exposes hooks for recording metrics and integrates with OpenTelemetry tracing through dedicated activity sources and metric interfaces. Consumers can provide their own ISynapseMetrics implementation or use the default which integrates with IMeterFactory.

๐Ÿงช Examples & Benchmarks

  • Examples are under the examples/ folder (Web API, Console, Native AOT example).
  • Benchmarks are available in benchmarks/SynapseBenchmark to measure throughput and compare against alternatives.

๐Ÿงฉ Extensibility

  • Pipeline behaviors: implement IRequestPipelineBehavior, IEventPipelineBehavior, or the typed/stream variants.
  • Registration groups: implement IRegisterGroup to modularize and share handler registration logic.
  • Outbox & commits: implement IOutboxStorage, IOutboxCommit for transactional event persistence.

Note: Transport/distributed messaging APIs are intentionally not documented here โ€” they may change prior to the first stable release.

๐Ÿค Contributing

We welcome contributions! Please read CONTRIBUTING.md for standards, development setup, and the PR process.

๐Ÿ“ Release notes

See releases on GitHub for detailed changelogs and version history: https://github.com/UnambitiousFx/Synapse/releases

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Made with โค๏ธ by the UnambitiousFx team

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on UnambitiousFx.Synapse:

Package Downloads
UnambitiousFx.Synapse.AspNetCore

A lightweight, performance-oriented library for building message-driven applications and in-process mediators. Provides composable primitives for Commands, Queries, Events, and Pipelines with a focus on low latency and minimal allocations.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 99 5/3/2026
1.0.0-beta6 129 2/5/2026
1.0.0-beta5 104 2/5/2026
1.0.0-beta4 106 2/4/2026
1.0.0-beta3 116 1/8/2026
1.0.0-beta2 114 1/6/2026
1.0.0-beta1 108 1/6/2026