FastEndpoints 1.0.0-beta3

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.0.0-beta3
                    
NuGet\Install-Package FastEndpoints -Version 1.0.0-beta3
                    
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.0.0-beta3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FastEndpoints" Version="1.0.0-beta3" />
                    
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.0.0-beta3
                    
#r "nuget: FastEndpoints, 1.0.0-beta3"
                    
#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.0.0-beta3
                    
#: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.0.0-beta3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FastEndpoints&version=1.0.0-beta3&prerelease
                    
Install as a Cake Tool

FastEndpoints

An easy to use Web-Api framework (which encourages CQRS and Vertical Slice Architecture) built as an extension to the Asp.Net pipeline. Performance is on par with .net 6 minimal apis and is 2X faster; uses only half the memory; and outperforms a traditional MVC controller by about 73k requests per second on a Ryzen 3700X desktop.

Try it out...

install from nuget: Install-Package FastEndpoints (currently beta)

note: the minimum required sdk version is .net 6.0 (preview atm)

Code Sample:

Program.cs

using FastEndpoints;

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

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

Request DTO

public class MyRequest : IRequest
{
    [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; }
}

Response DTO

public class Response : IResponse
{
    public string? Name { get; internal set; }
    public int Price { get; set; }
    public string? Message { get; set; }
}

Endpoint Definition

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

    public MyEndpoint()
    {
        //no longer hindered by attribute limitations
        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); //declarative permission based authentication
    }

    protected override async Task ExecuteAsync(MyRequest req, CancellationToken ct)
    {
        //can do further validation here in addition to FluentValidations 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.

        Logger.LogInformation("this is your first endpoint!"); //dependency injected logger

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

        var res = new MyResponse //typed response to make integration tests convenient
        {
            Message = $"the route parameter value is: {req.Id}",
            Name = req.Name,
            Price = req.Price
        };

        await SendAsync(res);
    }
}

that's mostly it. all of your Endpoint definitions are automatically discovered on app startup and routes automatically mapped.

Documentation

proper 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 (72,920 more requests per second than mvc controller)

Statistics        Avg      Stdev        Max
  Reqs/sec    144989.43   13594.10  199851.96
  Latency        3.41ms   378.95us    65.00ms
  HTTP codes:
    1xx - 0, 2xx - 1462226, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    73.34MB/s

AspNet Minimal Api

Statistics        Avg      Stdev        Max
  Reqs/sec    144416.77   14313.21  171576.65
  Latency        3.43ms     1.37ms   347.00ms
  HTTP codes:
    1xx - 0, 2xx - 1456040, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    73.02MB/s

AspNet MapControllers

Statistics        Avg      Stdev        Max
  Reqs/sec     74056.92   19197.47  372446.94
  Latency        6.71ms     1.89ms   416.00ms
  HTTP codes:
    1xx - 0, 2xx - 745069, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    37.37MB/s

AspNet MVC Controller

Statistics        Avg      Stdev        Max
  Reqs/sec     72069.51   14094.86   96234.73
  Latency        6.83ms   712.49us    89.01ms
  HTTP codes:
    1xx - 0, 2xx - 731659, 3xx - 0, 4xx - 0, 5xx - 0
    others - 0
  Throughput:    36.56MB/s

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

BenchmarkDotNet head-to-head results

Method Mean Error StdDev Ratio RatioSD Gen 0 Allocated
FastEndpointsEndpoint 78.47 μs 1.522 μs 1.753 μs 1.00 0.00 2.4414 21 KB
MinimalApiEndpoint 77.05 μs 1.519 μs 2.496 μs 0.97 0.04 2.4414 21 KB
AspNetMapControllers 148.36 μs 2.922 μs 5.270 μs 1.88 0.07 5.3711 44 KB
AspNetCoreMVC 150.66 μs 2.984 μs 6.550 μs 1.90 0.09 5.3711 45 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 (140)

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 (1)

Showing the top 1 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
Version Downloads Last Updated
8.2.0-beta.23 32 4/26/2026
8.2.0-beta.22 39 4/25/2026
8.2.0-beta.21 75 4/23/2026
8.2.0-beta.20 47 4/23/2026
8.2.0-beta.19 54 4/23/2026
8.2.0-beta.18 48 4/23/2026
8.2.0-beta.17 55 4/22/2026
8.2.0-beta.16 52 4/21/2026
8.2.0-beta.15 78 4/20/2026
8.2.0-beta.14 63 4/20/2026
8.2.0-beta.13 132 4/20/2026
8.2.0-beta.12 58 4/20/2026
8.2.0-beta.11 60 4/19/2026
8.2.0-beta.10 58 4/18/2026
8.2.0-beta.9 69 4/17/2026
8.2.0-beta.8 100 4/14/2026
8.2.0-beta.7 63 4/14/2026
8.2.0-beta.6 64 4/13/2026
8.1.0 111,438 3/25/2026
1.0.0-beta3 842 9/25/2021
Loading failed

WARNING: this is a beta release. do not use in production!