Skip to content

AxisEndpoints

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

AxisEndpoints is a library for implementing the Request-Endpoint-Response (REPR) pattern in ASP.NET Core.

By providing numerous self-contained API endpoints rather than grouping multiple endpoints into a controller class, it enforces a structure where each endpoint is loosely coupled and easier to scale.

using System.Net;
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, IResult>
{
public void Configure(IEndpointConfiguration config)
{
config
.Get("/hello")
.ProducesSuccess<HelloResponse>()
.ProducesError(HttpStatusCode.BadRequest)
.Summary("Hello")
.Description("This endpoint takes a name as input and returns a greeting message.");
}
public Task<IResult> HandleAsync(HelloRequest request, CancellationToken cancel)
{
if (string.IsNullOrWhiteSpace(request.Name))
{
logger.LogWarning("Rejected request to /hello because the name was missing.");
return Task.FromResult(Results.Problem(
title: "Name is required",
detail: "Provide a non-empty name query parameter.",
statusCode: StatusCodes.Status400BadRequest
));
}
logger.LogInformation("Received request to /hello with name: {Name}", request.Name);
return Task.FromResult(
Results.Json(new HelloResponse
{
Message = $"Hello, {request.Name}!"
})
);
}
}

This is the exact endpoint built in the Quick Start tutorial.

AxisEndpoints is built on the following concepts and is designed for web application backend developers who want to enforce a structure where there are many features that are loosely coupled in terms of their functionality and operation.

  • 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.

Since it is built on ASP.NET Core Minimal APIs, developers who have experience with ASP.NET Core API development can apply their existing knowledge.

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.