FastEndpoints 1.0.0-beta3
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 |
Showing the top 20 packages that depend on FastEndpoints.
| Packages | Downloads |
|---|---|
|
FastEndpoints.Swagger
Swagger support for FastEndpoints.
|
115 |
|
FastEndpoints.Security
Security library for FastEndpoints.
|
2 |
|
FastEndpoints.Swagger
Swagger support for FastEndpoints.
|
2 |
|
FastEndpoints.Security
Security library for FastEndpoints.
|
1 |
|
FastEndpoints.Swagger
Swagger support for FastEndpoints.
|
1 |
WARNING: this is a beta release. do not use in production!
.NET 6.0
- FluentValidation (>= 10.3.3)
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 5.0.10)
| Version | Downloads | Last updated |
|---|---|---|
| 7.2.0-beta.6 | 1 | 12/20/2025 |
| 7.1.1 | 118 | 12/20/2025 |
| 7.1.0-beta.15 | 1 | 12/20/2025 |
| 7.1.0-beta.12 | 1 | 12/20/2025 |
| 7.1.0-beta.10 | 1 | 12/19/2025 |
| 7.1.0-beta.5 | 1 | 12/19/2025 |
| 7.1.0-beta.1 | 1 | 12/19/2025 |
| 6.3.0-beta.10 | 1 | 12/19/2025 |
| 6.2.0-beta.2 | 1 | 12/19/2025 |
| 6.1.0-beta.12 | 1 | 12/20/2025 |
| 6.0.0-beta.8 | 1 | 12/19/2025 |
| 6.0.0-beta.2 | 1 | 12/19/2025 |
| 5.35.0.602-beta | 1 | 12/19/2025 |
| 5.34.0.12-beta | 1 | 12/20/2025 |
| 5.34.0.11-beta | 1 | 12/20/2025 |
| 5.33.0.2-beta | 1 | 12/19/2025 |
| 5.33.0.1-beta | 1 | 12/19/2025 |
| 5.32.0.15-beta | 1 | 12/20/2025 |
| 5.32.0.11-beta | 1 | 12/20/2025 |
| 5.32.0.8-beta | 1 | 12/19/2025 |
| 5.32.0.1-beta | 1 | 12/19/2025 |
| 5.31.0.12-beta | 1 | 12/20/2025 |
| 5.31.0.8-beta | 1 | 12/20/2025 |
| 5.31.0.7-beta | 1 | 12/19/2025 |
| 5.30.0.16-beta | 1 | 12/19/2025 |
| 5.30.0.12-beta | 1 | 12/20/2025 |
| 5.30.0.7-beta | 1 | 12/19/2025 |
| 5.29.0.12-beta | 1 | 12/19/2025 |
| 5.29.0.6-beta | 1 | 12/19/2025 |
| 5.27.0.9-beta | 1 | 12/20/2025 |
| 5.26.0.14-beta | 2 | 12/19/2025 |
| 5.26.0.9-beta | 1 | 12/19/2025 |
| 5.25.0.12-beta | 1 | 12/20/2025 |
| 5.25.0.9-beta | 1 | 12/20/2025 |
| 5.25.0.6-beta | 1 | 12/19/2025 |
| 5.25.0.1-beta | 1 | 12/20/2025 |
| 5.23.0 | 1 | 12/19/2025 |
| 5.22.0.18-beta | 1 | 12/20/2025 |
| 5.22.0.15-beta | 1 | 12/19/2025 |
| 5.22.0.14-beta | 1 | 12/20/2025 |
| 5.22.0.12-beta | 1 | 12/19/2025 |
| 5.22.0.2-beta | 1 | 12/19/2025 |
| 5.21.2.19-beta | 1 | 12/19/2025 |
| 5.21.2.15-beta | 1 | 12/19/2025 |
| 5.21.2.4-beta | 1 | 12/20/2025 |
| 5.21.2 | 1 | 12/20/2025 |
| 5.21.1.1-beta | 1 | 12/19/2025 |
| 5.20.1.7-beta | 1 | 12/19/2025 |
| 5.20.1.5-beta | 1 | 12/20/2025 |
| 5.20.1.3-beta | 1 | 12/20/2025 |
| 5.19.1 | 1 | 12/19/2025 |
| 5.19.0.9-beta | 1 | 12/19/2025 |
| 5.19.0.1-beta | 1 | 12/19/2025 |
| 5.19.0 | 1 | 12/20/2025 |
| 5.18.0.8-beta | 1 | 12/19/2025 |
| 5.17.1.29-beta | 1 | 12/19/2025 |
| 5.17.1.27-beta | 1 | 12/19/2025 |
| 5.17.1.25-beta | 1 | 12/20/2025 |
| 5.17.1.20-beta | 1 | 12/19/2025 |
| 5.17.1.17-beta | 1 | 12/20/2025 |
| 5.17.1.14-beta | 1 | 12/20/2025 |
| 5.17.1.11-beta | 1 | 12/20/2025 |
| 5.17.1.10-beta | 1 | 12/20/2025 |
| 5.17.1.8-beta | 1 | 12/19/2025 |
| 5.17.1.6-beta | 1 | 12/20/2025 |
| 5.15.0.17-beta | 1 | 12/19/2025 |
| 5.15.0.12-beta | 1 | 12/20/2025 |
| 5.8.1.4-beta | 1 | 12/20/2025 |
| 5.8.1 | 1 | 12/19/2025 |
| 5.7.2.10-beta | 1 | 12/20/2025 |
| 5.7.2.3-beta | 1 | 12/19/2025 |
| 5.7.2 | 1 | 12/20/2025 |
| 5.7.0.1-beta | 1 | 12/20/2025 |
| 5.4.1.2-beta | 1 | 12/20/2025 |
| 5.3.2.13-beta | 1 | 12/19/2025 |
| 5.3.2.9-beta | 1 | 12/19/2025 |
| 5.3.1 | 1 | 12/20/2025 |
| 5.2.1.12-beta | 1 | 12/19/2025 |
| 5.2.1.10-beta | 1 | 12/20/2025 |
| 5.2.1.9-beta | 0 | 12/19/2025 |
| 5.2.1.5-beta | 1 | 12/20/2025 |
| 5.2.1.1-beta | 1 | 12/20/2025 |
| 5.2.0-beta24 | 1 | 12/19/2025 |
| 5.2.0-beta19 | 1 | 12/20/2025 |
| 5.1.1-beta5 | 1 | 12/19/2025 |
| 5.1.1-beta4 | 1 | 12/20/2025 |
| 5.1.0 | 1 | 12/19/2025 |
| 5.1.0-beta15 | 1 | 12/20/2025 |
| 5.1.0-beta12 | 1 | 12/19/2025 |
| 5.0.0-beta7 | 1 | 12/19/2025 |
| 4.4.0-beta8 | 1 | 12/19/2025 |
| 4.4.0-beta6 | 1 | 12/19/2025 |
| 4.3.1 | 1 | 12/19/2025 |
| 4.3.1-beta1 | 1 | 12/19/2025 |
| 4.3.0-beta7 | 1 | 12/19/2025 |
| 4.3.0-beta1 | 2 | 12/19/2025 |
| 4.2.0-beta10 | 1 | 12/19/2025 |
| 4.1.0-beta5 | 1 | 12/19/2025 |
| 4.1.0-beta4 | 1 | 12/20/2025 |
| 4.0.0-beta6 | 1 | 12/20/2025 |
| 3.12.1-beta1 | 1 | 12/20/2025 |
| 3.11.0-beta5 | 1 | 12/20/2025 |
| 3.11.0-beta4 | 1 | 12/19/2025 |
| 3.11.0-beta3 | 1 | 12/20/2025 |
| 3.11.0-beta11 | 1 | 12/20/2025 |
| 3.10.0-beta4 | 1 | 12/20/2025 |
| 3.9.0-beta6 | 1 | 12/19/2025 |
| 3.9.0-beta5 | 1 | 12/20/2025 |
| 3.9.0-beta4 | 1 | 12/20/2025 |
| 3.9.0-beta12 | 0 | 12/20/2025 |
| 3.9.0-beta10 | 1 | 12/19/2025 |
| 3.7.1-beta1 | 1 | 12/20/2025 |
| 3.5.0-beta9 | 1 | 12/20/2025 |
| 3.5.0-beta5 | 1 | 12/20/2025 |
| 3.5.0-beta1 | 1 | 12/20/2025 |
| 3.4.0-beta2 | 1 | 12/20/2025 |
| 3.3.0-beta3 | 1 | 12/19/2025 |
| 2.21.0-beta9 | 1 | 12/20/2025 |
| 2.21.0-beta3 | 1 | 12/20/2025 |
| 2.20.0 | 1 | 12/19/2025 |
| 2.18.1 | 1 | 12/20/2025 |
| 1.6.0-beta1 | 1 | 12/19/2025 |
| 1.5.0 | 1 | 12/20/2025 |
| 1.0.0-beta3 | 1 | 12/19/2025 |