Koto.Api.FastEndpoints 0.1.0-preview.5

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

Koto.Api.FastEndpoints

FastEndpoints integration for Koto DDD building blocks.

What's included

Type Purpose
CommandEndpoint<TCommand> Dispatches void command → 204 on success, Problem Details on failure
CommandEndpoint<TCommand, TResult> Dispatches result command → 200 on success
QueryEndpoint<TQuery, TResult> Dispatches query → 200 / 404 / 400
KotoProblemDetails RFC 7807 factory from Error with errorCode + correlationId extensions
CorrelationIdMiddleware Reads/generates X-Correlation-ID, echoes in response
ICorrelationIdAccessor Access current correlation ID from anywhere in the request scope
GlobalExceptionHandler Catches unhandled exceptions → 500 Problem Details

Setup

// Program.cs
builder.Services.AddKotoApi();
builder.Services.AddFastEndpoints();
// ... other services

var app = builder.Build();
app.UseKotoApi(); // CorrelationId middleware + exception handler
app.UseFastEndpoints();
app.Run();

Implementing an endpoint

// Void command (204 on success)
public class DeleteOrderEndpoint : CommandEndpoint<DeleteOrderCommand>
{
    public override void Configure()
    {
        Delete("/orders/{id}");
        AllowAnonymous();
    }

    public override async Task HandleAsync(DeleteOrderCommand req, CancellationToken ct)
        => await SendCommandAsync(req, ct);
}

// Command with result (200 on success)
public class PlaceOrderEndpoint : CommandEndpoint<PlaceOrderCommand, OrderId>
{
    public override void Configure()
    {
        Post("/orders");
        AllowAnonymous();
    }

    public override async Task HandleAsync(PlaceOrderCommand req, CancellationToken ct)
        => await SendCommandAsync(req, ct);
}

// Query (GET, 200/404)
public class GetOrderEndpoint : QueryEndpoint<GetOrderQuery, OrderDto>
{
    public override void Configure()
    {
        Get("/orders/{id}");
        AllowAnonymous();
    }

    public override async Task HandleAsync(GetOrderQuery req, CancellationToken ct)
        => await SendQueryAsync(req, ct);
}

Error code → HTTP status mapping

Error code pattern Status
*.not-found 404 Not Found
*.already-* 409 Conflict
general.value.* 400 Bad Request
anything else 500 Internal Server Error
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
0.1.0-preview.5 32 5/13/2026
0.1.0-preview.4 35 5/13/2026