FlowT 1.3.0

dotnet add package FlowT --version 1.3.0
                    
NuGet\Install-Package FlowT -Version 1.3.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="FlowT" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FlowT" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="FlowT" />
                    
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 FlowT --version 1.3.0
                    
#r "nuget: FlowT, 1.3.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 FlowT@1.3.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=FlowT&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=FlowT&version=1.3.0
                    
Install as a Cake Tool

FlowT - High-Performance Orchestration Library for .NET

FlowT is a high-performance orchestration library for .NET that implements the Chain of Responsibility pattern with a fluent API. Build maintainable, testable, and ultra-fast pipelines with specifications, policies, and handlers.

๐Ÿ“š Full Documentation: https://github.com/vlasta81/FlowT


๐Ÿ“ฆ Package Information

Property Value
Package FlowT
NuGet https://www.nuget.org/packages/FlowT/
Targets .NET 10.0 (Primary), .NET Standard 2.0 (Compatibility)
Dependencies None (zero external dependencies)
Built-in plugins 10 (AuditPlugin, TenantPlugin, IdempotencyPlugin, PerformancePlugin, FlowScopePlugin, FeatureFlagPlugin, CorrelationPlugin, UserIdentityPlugin, RetryStatePlugin, TransactionPlugin)
License MIT

โœจ Key Features

๐Ÿš€ Performance

  • โšก 2.7ร— faster than DispatchR - The fastest .NET orchestration library
  • โšก 9ร— faster than MediatR - Singleton architecture with cached pipelines
  • ๐Ÿ’พ 84% less memory than MediatR - Zero-allocation fast paths
  • ๐Ÿ”ฅ Thread-safe - Lock-free operations with compile-time safety

๐ŸŽฏ Developer Experience

  • ๐Ÿงฉ Modular Architecture - IFlowModule for clean feature organization
  • ๐Ÿ”„ Chain of Responsibility - Composable pipeline with specs, policies, handlers
  • ๐ŸŽจ Fluent API - Intuitive pipeline configuration
  • ๐Ÿ“ Automatic Context - No manual FlowContext creation needed
  • ๐Ÿ›ก๏ธ 27 Roslyn Analyzers - Compile-time safety for threading & DI

๐Ÿ’ก Advanced Features

  • ๐Ÿ” FlowInterrupt - Type-safe error handling without exceptions
  • ๐Ÿงฉ FlowSpecification<TRequest> - Optional abstract base class: Continue(), Fail(), Stop() helpers (zero-allocation cached path)
  • ๐Ÿ”Œ Plugin System - PerFlow services with 8.7ร— warm-path speedup, 10 built-in plugins
  • ๐Ÿ“Š Named Keys - Store multiple values of same type
  • ๐ŸŽญ Scoped Services - Safe ctx.Service<T>() in singleton handlers
  • ๐Ÿท๏ธ Feature Flags - FeatureFlagPlugin wraps IVariantFeatureManager with per-flow cache
  • ๐Ÿ“ Audit Trail - AuditPlugin accumulates structured events per flow execution
  • โฑ๏ธ Performance Metrics - PerformancePlugin measures named code sections with Stopwatch
  • ๐Ÿข Multi-tenancy - TenantPlugin resolves tenant from claim โ†’ header โ†’ route โ†’ default
  • ๐Ÿ”‘ Idempotency - IdempotencyPlugin reads X-Idempotency-Key header once per flow
  • ๐Ÿ”ญ DI Scope Control - FlowScopePlugin for explicit scopes in background/non-HTTP flows

๐Ÿš€ Quick Start

Installation

dotnet add package FlowT

Basic Example

// 1. Define request/response
public record CreateUserRequest(string Email, string Name);
public record CreateUserResponse(Guid Id, string Email);

// 2. Create handler
public class CreateUserHandler : IFlowHandler<CreateUserRequest, CreateUserResponse>
{
    public async ValueTask<CreateUserResponse> HandleAsync(
        CreateUserRequest request, FlowContext context)
    {
        var db = context.Service<AppDbContext>();
        var user = new User { Email = request.Email, Name = request.Name };
        db.Users.Add(user);
        await db.SaveChangesAsync(context.CancellationToken);
        return new CreateUserResponse(user.Id, user.Email);
    }
}

// 3. Define flow with pipeline
[FlowDefinition]
public class CreateUserFlow : FlowDefinition<CreateUserRequest, CreateUserResponse>
{
    protected override void Configure(IFlowBuilder<CreateUserRequest, CreateUserResponse> flow)
    {
        flow
            .Check<ValidateEmailSpecification>()
            .Use<LoggingPolicy>()
            .OnInterrupt(interrupt => 
                new CreateUserResponse(Guid.Empty, interrupt.Message))
            .Handle<CreateUserHandler>();
    }
}

// 4. Register module
[FlowModule]
public class UserModule : IFlowModule
{
    public void Register(IServiceCollection services)
    {
        services.AddFlow<CreateUserFlow, CreateUserRequest, CreateUserResponse>();
    }

    public void MapEndpoints(IEndpointRouteBuilder app)
    {
        app.MapPost("/api/users", async (
            CreateUserRequest request,
            CreateUserFlow flow,
            HttpContext httpContext) =>
        {
            return await flow.ExecuteAsync(request, httpContext);
        });
    }
}

// 5. In Program.cs
builder.Services.AddFlowModules(typeof(Program).Assembly);
app.MapFlowModules();

๐Ÿ“Š Performance

Metric Result
Speed vs DispatchR 1.6-2.8ร— faster
Speed vs MediatR 9ร— faster
Memory vs MediatR 84% less

๐Ÿ“Š Detailed Benchmarks: https://github.com/vlasta81/FlowT/tree/main/benchmarks/FlowT.Benchmarks


๐Ÿ“š Core Concepts

Modules (IFlowModule)

Organize features into cohesive modules with [FlowModule] attribute for auto-discovery.

Flows (FlowDefinition<TRequest, TResponse>)

Define reusable orchestration pipelines with [FlowDefinition] attribute.

Context (FlowContext)

Per-request execution context with scoped service resolution, storage, and events.

Specifications (IFlowSpecification<TRequest> / FlowSpecification<TRequest>)

Reusable validation and business rules that can interrupt flow with FlowInterrupt. Inherit from FlowSpecification<TRequest> for Continue(), Fail(), and Stop() helpers.

Policies (FlowPolicy<TRequest, TResponse>)

Cross-cutting concerns as reusable middleware (logging, caching, transactions).

Plugins (Plugin<T>())

PerFlow services shared across all pipeline stages with automatic caching. Register with services.AddFlowPlugin<IMyPlugin, MyPlugin>(), resolve with context.Plugin<IMyPlugin>().

Built-in Plugins
Plugin Interface Description
AuditPlugin IAuditPlugin Accumulates structured AuditEntry records per flow execution
TenantPlugin ITenantPlugin Resolves tenant from claim tid โ†’ X-Tenant-Id header โ†’ route โ†’ "default"
IdempotencyPlugin IIdempotencyPlugin Reads X-Idempotency-Key header once per flow
PerformancePlugin IPerformancePlugin Measures named sections with Stopwatch; results in Elapsed dictionary
FlowScopePlugin IFlowScopePlugin Creates an explicit IServiceScope โ€” useful in non-HTTP/background flows
FeatureFlagPlugin IFeatureFlagPlugin Evaluates feature flags via IVariantFeatureManager with per-flow caching
CorrelationPlugin ICorrelationPlugin Reads X-Correlation-Id header; falls back to FlowId
UserIdentityPlugin IUserIdentityPlugin Exposes ClaimsPrincipal, UserId, Email, IsAuthenticated, IsInRole
RetryStatePlugin IRetryStatePlugin Tracks retry attempt counter for retry policies
TransactionPlugin ITransactionPlugin (abstract) Base for custom transaction implementations (BeginAsync, CommitAsync, RollbackAsync)
Example โ€” FeatureFlagPlugin + AuditPlugin
// appsettings.json
{
  "FeatureManagement": {
    "NewCheckout": true
  }
}

// Program.cs
builder.Services.AddFeatureManagement();
builder.Services.AddFlowPlugin<IFeatureFlagPlugin, FeatureFlagPlugin>();
builder.Services.AddFlowPlugin<IAuditPlugin, AuditPlugin>();

// Handler
public async ValueTask<Response> HandleAsync(Request req, FlowContext ctx)
{
    var ff = ctx.Plugin<IFeatureFlagPlugin>();
    if (!await ff.IsEnabledAsync("NewCheckout", ctx.CancellationToken))
        return new Response { Skipped = true };

    var audit = ctx.Plugin<IAuditPlugin>();
    audit.Record("CheckoutStarted", new { req.UserId });

    // ... business logic ...

    audit.Record("CheckoutCompleted", new { req.UserId, OrderId = order.Id });
    return new Response { OrderId = order.Id };
}

๐Ÿ“– Complete Guide: https://github.com/vlasta81/FlowT/blob/main/README.md#-core-concepts


๐Ÿ›ก๏ธ Compile-Time Safety

FlowT includes 27 Roslyn analyzers that catch issues at compile-time:

๐Ÿ”ด Errors (Build fails - must fix!)

  • FlowT002: Non-thread-safe collections (List, Dictionary, etc.)
  • FlowT003: Captive scoped dependencies (DbContext in constructor)
  • FlowT004: Static mutable state
  • FlowT006: FlowContext stored in field
  • FlowT007: Request/Response objects in fields
  • FlowT010: Thread.Sleep() in async methods
  • FlowT011: Missing .Handle<T>() in FlowDefinition.Configure()
  • FlowT012: IServiceProvider stored in field
  • FlowT013: CancellationTokenSource stored in field
  • FlowT015: Mutable public/internal properties
  • FlowT018: Lazy<T> without thread-safety mode
  • FlowT019: State leak types (StringBuilder, Stream, Stopwatch, arrays)
  • FlowT021: FlowPlugin stored in singleton field
  • FlowT022: Multiple .Handle<T>() calls in Configure()
  • FlowT026: Thread.Sleep() in synchronous flow methods

โš ๏ธ Warnings

  • FlowT001: Mutable instance fields
  • FlowT005: Async void methods
  • FlowT008: Lock on this or typeof(T)
  • FlowT010: Synchronous blocking (.Result, .Wait())
  • FlowT016: Task/ValueTask storage
  • FlowT017: Manual Thread creation
  • FlowT020: ConfigureAwait(false) loses HttpContext/FlowContext
  • FlowT023: new HttpClient() in flow component (socket exhaustion)
  • FlowT024: Synchronous file I/O in async flow method

โ„น๏ธ Info (Suggestions)

  • FlowT009: Missing CancellationToken propagation
  • FlowT014: Empty catch blocks
  • FlowT025: Direct IServiceProvider access (prefer context.Service<T>())

๐Ÿ“– All Analyzer Rules: https://github.com/vlasta81/FlowT/blob/main/src/FlowT.Analyzers/README.md

Example:

// โŒ FlowT003: Build fails!
public class BadHandler : IFlowHandler<Request, Response>
{
    private readonly AppDbContext _db; // Captive dependency!
    public BadHandler(AppDbContext db) { _db = db; }
}

// โœ… Correct pattern
public class GoodHandler : IFlowHandler<Request, Response>
{
    public async ValueTask<Response> HandleAsync(Request req, FlowContext ctx)
    {
        var db = ctx.Service<AppDbContext>(); // Safe!
        return await db.ProcessAsync(req);
    }
}

๐Ÿ”„ Migration Guides

UserIdentityPlugin Removal (v1.2.0)

The UserIdentityPlugin and IUserIdentityPlugin interface have been removed. User identity functionality is now provided by built-in methods on FlowContext:

Old Plugin Method New Built-in Method
context.Plugin<IUserIdentityPlugin>().UserId context.GetUserId()
context.Plugin<IUserIdentityPlugin>().Email context.GetUser()?.Email
context.Plugin<IUserIdentityPlugin>().IsAuthenticated context.IsAuthenticated()
context.Plugin<IUserIdentityPlugin>().IsInRole("Admin") context.IsInRole("Admin")
context.Plugin<IUserIdentityPlugin>().Principal context.GetUser()

๐Ÿ“– Migration Guide: https://github.com/vlasta81/FlowT/blob/main/docs/MIGRATION_UserIdentityPlugin.md


๐Ÿ“– Documentation

Resource Link
Full README https://github.com/vlasta81/FlowT
API Reference https://github.com/vlasta81/FlowT/tree/main/docs/api
Best Practices https://github.com/vlasta81/FlowT/blob/main/docs/BEST_PRACTICES.md
FlowContext Guide https://github.com/vlasta81/FlowT/blob/main/docs/FLOWCONTEXT.md
Plugin System https://github.com/vlasta81/FlowT/blob/main/docs/PLUGINS.md
Benchmarks https://github.com/vlasta81/FlowT/tree/main/benchmarks/FlowT.Benchmarks
Sample App https://github.com/vlasta81/FlowT/tree/main/samples/FlowT.SampleApp
Analyzers https://github.com/vlasta81/FlowT/tree/main/src/FlowT.Analyzers

๐Ÿงช Testing

  • 277+ unit tests with full coverage
  • xUnit test framework
  • Thread-safety and concurrency tests
  • Analyzer verification tests

๐Ÿ“– Test Suite: https://github.com/vlasta81/FlowT/tree/main/tests/FlowT.Tests


๐Ÿค Contributing

Found a bug or have a feature request? Please open an issue: https://github.com/vlasta81/FlowT/issues

Deprecation Policy

For future breaking changes, FlowT follows a deprecation-first approach:

  1. Features are marked [Obsolete] with migration guidance in a minor version
  2. Deprecated features are removed in the next major version
  3. Migration guides are provided in docs/MIGRATION_*.md

๐Ÿ“„ License

MIT License - see LICENSE file for details.


Made with โค๏ธ by vlasta81

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

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
1.3.0 86 4/23/2026
1.2.0 137 3/28/2026
1.1.2 69 3/22/2026
1.1.1-dev.0 72 3/22/2026
1.0.0 87 3/15/2026

See CHANGELOG.md for detailed release notes.