FastEndpoints 1.6.0-beta5

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

FastEndpoints

An alternative for building RESTful Web APIs with ASP.Net 6 which encourages CQRS and Vertical Slice Architecture.

FastEndpoints offers a more elegant solution than the Minimal APIs and MVC Controllers.

Performance is on par with the Minimal APIs and is faster; uses less memory; and outperforms a traditional MVC Controller by about 34k requests per second on a Ryzen 3700X desktop.

Features

  • Define your endpoints in multiple class files (even in deeply nested folders)
  • Auto discovery and registration of endpoints
  • Attribute-free endpoint definitions (no attribute argument type restrictions)
  • Secure by default and supports most authentication/authorization providers
  • Built-in support for JWT Bearer auth scheme
  • Supports policy/permission/role/claim based security
  • Declarative security policy building (inside each endpoint)
  • Supports any IOC container (compatible with asp.net)
  • Dependencies are automatically property injected
  • Model binding support from route/json body/claims/forms
  • Model validation using FluentValidation rules
  • Convenient business logic validation and error responses
  • Easy access to environment and configuration settings
  • Supports pipeline behaviors like MediatR
  • Supports in-process pub/sub event notifications
  • Auto discovery of event notification handlers
  • Convenient integration testing (route-less and strongly-typed)
  • Plays well with the asp.net middleware pipeline
  • Supports swagger/serilog/etc.
  • Visual studio extension (vsix) for easy vertical slice feature scaffolding
  • Plus anything else the minimal apis can do...

Try it out...

install from nuget: Install-Package FastEndpoints

note: the minimum required sdk version is .net 6.0

Code Sample:

Program.cs

var builder = WebApplication.CreateBuilder();
builder.Services.AddFastEndpoints();
builder.Services.AddAuthenticationJWTBearer("SecretKey");

var app = builder.Build();
app.UseAuthentication();
app.UseAuthorization();
app.UseFastEndpoints();
app.Run();

Request.cs

public class MyRequest
{
    [From(Claim.UserName)]
    public string UserName { get; set; }  //this value will be auto populated from the user claim

    public int Id { get; set; }
    public string Name { get; set; }
    public int Price { get; set; }
}

Validator.cs

public class MyValidator : Validator<MyRequest>
{
    public MyValidator()
    {
        RuleFor(x => x.Id).NotEmpty().WithMessage("Id is required!");
        RuleFor(x => x.Name).NotEmpty().WithMessage("Name is required!");
        RuleFor(x => x.Price).GreaterThan(0).WithMessage("Price is required!");
    }
}

Response.cs

public class MyResponse
{
    public string Name { get; internal set; }
    public int Price { get; set; }
    public string? Message { get; set; }
}

Endpoint.cs

public class MyEndpoint : Endpoint<MyRequest>
{
    public ILogger<MyEndpoint>? Logger { get; set; } //dependency injected

    public MyEndpoint()
    {
        Routes("/api/test/{id}");
        Verbs(Http.POST, Http.PATCH);
        Roles("Admin", "Manager");
        Policies("ManagementTeamCanAccess", "AuditorsCanAccess");
        Permissions(
            Allow.Inventory_Create_Item,
            Allow.Inventory_Retrieve_Item,
            Allow.Inventory_Update_Item);
        Claims(Claim.CustomerID);
    }

    protected override async Task HandleAsync(MyRequest req, CancellationToken ct)
    {
        //can do further validation here in addition to FluentValidation rules
        if (req.Price < 100)
            AddError(r => r.Price, "Price is too low!");

        AddError("This is a general error!");

        ThrowIfAnyErrors(); //breaks the flow and sends a 400 error response containing error details.

        var isProduction = Env.IsProduction(); //read environment
        var smtpServer = Config["SMTP:HostName"]; //read configuration

        var res = new MyResponse //typed response makes integration testing easy
        {
            Message = $"the route parameter value is: {req.Id}",
            Name = req.Name,
            Price = req.Price
        };

        await SendAsync(res);
    }
}

all of your Endpoint definitions are automatically discovered on app startup. no manual mapping is required like with minimal apis.

Documentation

documentation will be available within a few weeks once v1.0 is released. in the meantime have a browse through the Web, Test and Benchmark projects to see more examples.

Benchmark results

Bombardier load test

FastEndpoints (33,772 more requests per second than mvc controller)

Statistics        Avg      Stdev        Max
  Reqs/sec    134251.40   16085.58  190809.19
  Latency        3.68ms     1.35ms   371.64ms
  HTTP codes:
    1xx - 0, 2xx - 1357086, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    68.05MB/s

AspNet Minimal Api

Statistics        Avg      Stdev        Max
  Reqs/sec    136898.40   13732.59  185851.32
  Latency        3.62ms   470.46us    94.99ms
  HTTP codes:
    1xx - 0, 2xx - 1379343, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    69.19MB/s

AspNet MVC Controller

Statistics        Avg      Stdev        Max
  Reqs/sec    100479.98   13649.02  123388.00
  Latency        4.90ms     1.67ms   375.00ms
  HTTP codes:
    1xx - 0, 2xx - 1019171, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    50.91MB/s

Carter Module

Statistics        Avg      Stdev        Max
  Reqs/sec      7592.05    3153.39   18037.17
  Latency       65.45ms    17.77ms   560.62ms
  HTTP codes:
    1xx - 0, 2xx - 76638, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:     3.82MB/s

parameters used: -c 500 -m POST -f "body.json" -H "Content-Type:application/json" -d 10s

BenchmarkDotNet head-to-head results

Method Mean Error StdDev Ratio RatioSD Gen 0 Gen 1 Allocated
FastEndpointsEndpoint 83.03 μs 5.007 μs 3.312 μs 1.00 0.00 2.6000 0.1000 22 KB
MinimalApiEndpoint 83.51 μs 3.781 μs 2.501 μs 1.01 0.03 2.5000 - 21 KB
AspNetCoreMVC 114.20 μs 3.806 μs 2.518 μs 1.38 0.06 3.4000 0.2000 28 KB
CarterModule 607.48 μs 1.455 μs 0.962 μs 7.33 0.29 5.9000 2.9000 48 KB
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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 (135)

Showing the top 5 NuGet packages that depend on FastEndpoints:

Package Downloads
FastEndpoints.Swagger

Swagger support for FastEndpoints.

FastEndpoints.Security

Security library for FastEndpoints.

Elsa.Api.Common

Provides common features to modules that expose API endpoints.

Elsa.JavaScript

Provides a JavaScript expression provider.

Elsa.EntityFrameworkCore

Provides Entity Framework Core implementations of various abstractions from various modules.

GitHub repositories (20)

Showing the top 20 popular GitHub repositories that depend on FastEndpoints:

Repository Stars
ardalis/CleanArchitecture
Clean Architecture Solution Template: A proven Clean Architecture Template for ASP.NET Core 10
elsa-workflows/elsa-core
The Workflow Engine for .NET
RRQM/TouchSocket
TouchSocket is an integrated .NET networking framework that includes modules for socket, TCP, UDP, SSL, named pipes, HTTP, WebSocket, RPC, and more. It offers a one-stop solution for TCP packet issues and enables quick implementation of custom data message parsing using protocol templates.
CodeMazeBlog/CodeMazeGuides
The main repository for all the Code Maze guides
Elfocrash/clean-minimal-api
A project showcasing how you can build a clean Minimal API using FastEndpoints
Reaparr/Reaparr
Plex downloader that brings content from any server to yours!
NimblePros/eShopOnWeb
Sample ASP.NET Core 10.0 reference application, powered by Microsoft, demonstrating a domain-centric application architecture with monolithic deployment model.
CircumSpector/DS4Windows
A reimagination of DS4Windows.
netcorepal/netcorepal-cloud-framework
一个基于ASP.NET Core实现的整洁领域驱动设计落地战术框架。 A tactical framework for Clean Domain-Driven Design based on ASP.NET Core.
ikyriak/IdempotentAPI
A .NET library that handles the HTTP write operations (POST and PATCH) that can affect only once for the given request data and idempotency-key by using an ASP.NET Core attribute (filter).
Elfocrash/aws-videos
dj-nitehawk/MongoWebApiStarter
A full-featured starter template for `dotnet new` to quickly scaffold an Asp.Net 8 Web-Api project with MongoDB as the data store.
ardalis/modulith
Modulith is a dotnet new template for Modular Monoliths. It streamlines the creation of new .Net solutions and the addition of modules to existing ones.
ardalis/WebApiBestPractices
Resources related to my Pluralsight course on this topic.
leosperry/ha-kafka-net
Integration that uses Home Assistant Kafka integration for creating home automations in .NET and C#
bingbing-gui/dotnet-platform
这是一个围绕 新一代 .NET 应用模型 的实践型仓库,覆盖 Web、云原生、AI、微服务等多种应用形态。
dj-nitehawk/MiniDevTo
Source code of the Dev.To article "Building REST APIs In .Net 8 The Easy Way!"
Hona/VerticalSliceArchitecture
Spend less time over-engineering, and more time coding. The template has a focus on convenience, and developer confidence. Vertical Slice Architecture 🎈
dr-marek-jaskula/DomainDrivenDesignUniversity
This project was made for tutorial purpose - to clearly present the domain driven design concept.
dj-nitehawk/Hybrid-Inverter-Monitor
Monitoring application for hybrid inverters using the Voltronic communication protocol & JK BMS via USB port.
Version Downloads Last Updated
8.0.0-beta.9 76 2/11/2026
8.0.0-beta.8 41 2/11/2026
8.0.0-beta.7 39 2/11/2026
8.0.0-beta.6 41 2/11/2026
8.0.0-beta.5 48 2/10/2026
8.0.0-beta.4 53 2/10/2026
8.0.0-beta.3 56 2/10/2026
8.0.0-beta.2 263 2/5/2026
8.0.0-beta.1 61 2/5/2026
7.3.0-beta.14 71 2/4/2026
7.3.0-beta.13 48 2/4/2026
7.3.0-beta.12 88 2/3/2026
7.3.0-beta.11 135 2/1/2026
7.3.0-beta.10 69 1/31/2026
7.3.0-beta.9 139 1/29/2026
7.3.0-beta.8 68 1/27/2026
7.3.0-beta.7 149 1/26/2026
7.3.0-beta.6 173 1/21/2026
7.2.0 96,415 1/13/2026
1.6.0-beta5 793 10/6/2021
Loading failed

- add SendForbiddenAsync() method
     - add SendUnauthorizedAsync() method
     - add SendFileAsync() method
     - add SendStreamAsync() method
     - add AllowFileUploads() method
     - add model binding support from forms
     - add more overloads for httpclient extensions
     - show log warning if duplicate routes are registered