Skip to content

AxisEndpoints

Provides "Axis" for your ASP.NET Core Web API projects!

AxisEndpoints is a DSL for implementing the Request-Endpoint-Response (REPR) pattern in ASP.NET Core. It consolidates each API endpoint into a self-contained class with a clear, explicit programming interface.

using AxisEndpoints;
namespace AxisEndpoints.Tutorial.Features.Hello;
public record HelloRequest
{
public required string Name { get; set; } = string.Empty;
}
public record HelloResponse
{
public required string Message { get; set; } = string.Empty;
}
public class HelloEndpoint(ILogger<HelloEndpoint> logger)
: IEndpoint<HelloRequest, Response<HelloResponse>>
{
public void Configure(IEndpointConfiguration config)
{
config
.Get("/hello")
.Summary("Hello")
.Description("This endpoint takes a name as input and returns a greeting message.");
}
public Task<Response<HelloResponse>> HandleAsync(
HelloRequest request,
CancellationToken cancel)
{
logger.LogInformation("Received request to /hello with name: {Name}", request.Name);
return Task.FromResult(
new Response<HelloResponse>
{
Body = new HelloResponse { Message = $"Hello, {request.Name}!" },
}
);
}
}
  • Clear and explicit programming interface: each endpoint declares its request type, result type, route, and metadata in one place.
  • Type-safe and OpenAPI-first design: request and response types are enforced by the interface, and OpenAPI output is generated automatically without requiring TypedResults or ActionResult<T> annotations.
  • Gentle learning curve: AxisEndpoints is a lightweight wrapper around the Minimal API. Developers familiar with Minimal API should find it easy to adopt.
  • Well-suited for Vertical Slice Architecture: the REPR pattern is a natural fit for Vertical Slice Architecture, where each feature is a self-contained unit with loose coupling between slices.
  • Modular package structure: extensions are provided as separate packages so you can include only the features you need.

ASP.NET Core offers three approaches to building Web APIs. Each involves different trade-offs:

Minimal APIControllerREPR Pattern (AxisEndpoints)
StructureFunctions registered inlineMethods grouped in a classOne class per endpoint
Scalability⚠ Can become hard to manage as endpoints grow⚠ Controllers can grow bloated over time✅ Each endpoint stays self-contained
CouplingLow — but no enforced structureMedium — CRUD operations share a controllerLow — slices are independent by design
Learning curveLowMedium (MVC conventions)Medium (built on Minimal API)
Best suited forSmall services, prototypesCRUD-heavy APIs familiar to MVC developersFeature-rich APIs, Vertical Slice Architecture

The REPR pattern is a good choice when:

  • Your API has many endpoints that grow independently of each other.
  • You are applying Vertical Slice Architecture and want each feature to be self-contained.
  • You want the compiler to enforce that every endpoint declares its request and response types.
  • You want OpenAPI documentation to stay accurate without manual annotations.

To implement the REPR pattern in ASP.NET Core, you can either write a thin wrapper around the Minimal API yourself, or use a library such as FastEndpoints. FastEndpoints is powerful, but its abstractions diverge noticeably from standard ASP.NET Core conventions, which steepens the learning curve. AxisEndpoints takes a different approach: it stays close to the Minimal API surface, so the concepts you already know continue to apply.

Guides

Learn how to define endpoints, bind requests, handle responses, and more. See the Guides.

CSV Extension

Add typed CSV import and export to your endpoints with the optional CsvHelper extension. See the CSV Helper extension.

FAQ

Find answers to common questions in the FAQ.