Enterprise-Ready Minimal APIs in .NET: Scaling Simplicity
This repository contains the finished demo code from my presentation Minimal APIs at Scale.
I live-coded parts of the CustomerEndpoints to show how Minimal APIs evolve from a simple Weather example in Program.cs into a structured, enterprise-ready API.
This repo includes the complete, working version of that code.
You’ll see:
- How to structure Minimal APIs with extension methods
- Using DTOs (
CustomerRequest,CustomerResponse) to separate contracts from entities - Built-in validation in .NET 10
- Consistent error handling with endpoint filters
- Returning strong responses with
TypedResultsandCreatedAtRoute - Configuring OpenAPI + Scalar via extension methods
.
├── Endpoints/
│ └── Customer/
│ └── CustomerEndpoints.cs
├── Extensions/
│ └── OpenApiExtensions.cs
├── Filters/
│ └── ExceptionHandlingFilter.cs
├── Models/
│ ├── Customer.cs
│ └── DTO/
│ ├── CustomerRequest.cs
│ └── CustomerResponse.cs
├── Services/
│ ├── ICustomerService.cs
│ └── CustomerService.cs
├── Program.cs
└── <project>.csproj
-
Endpoints/Customer/ – Customer-specific endpoints via extension methods (app.MapCustomerEndpoints()).
-
Extensions/ – Application configuration helpers (e.g., ConfigureOpenApi, MapScalar).
-
Filters/ – Cross-cutting concerns (e.g., exception handling).
-
Models/ – Entities and DTOs (request/response contracts).
-
Services/ - Business logic implementation for ICustomerService.
-
Program.cs – Application entry point (minimal setup, delegates to extensions)
-
Visual Studio 2026 or the .NET CLI
-
.NET 10 SDK RC1 installed.
Check your installed SDKs with:
dotnet --list-sdks
You should see something like:
10.0.xxx [C:\Program Files\dotnet\sdk]
git clone https://github.com/CoderFoundry/commityourcode-minimal-api.git
cd commityourcode-minimal-api
- Open the solution in Visual Studio 2026
- Press F5 or (ctril+F5) to run.
You can also use Visual Studio Code to open the project and use the .NET CLI
To run the app using the CLI
dotnet run
Once running, open Scalar (API reference UI):
http://localhost:7022/
- If you’re running from Visual Studio 2026, it should launch automatically in your browser.
- If not, you may need to adjust your launchSettings.json file under
Properties/to adjust the port settings. - If you’re running from the CLI, open the URL manually (port may vary based on your local environment).
When the app is running, you should see a Customers dropdown with the three endpoints:
GET /customersGET /customers/{id}POST /customers
-
GET /customers → Returns all customers
-
GET /customers/{id} → Returns a customer by ID
-
POST /customers → Creates a new customer (with validation)
Each endpoint delegates business logic to ICustomerService, keeping handlers lean and maintainable.
You can see the full implementation in:
Services/CustomerService.cs
During my talk, I showed:
-
Weather endpoint in Program.cs (simple example from Microsoft).
-
Moving Customers into CustomerEndpoints.cs via extension methods.
-
Adding app.MapCustomerEndpoints(); to keep Program.cs clean.
-
Live-coding the POST /customers endpoint.
This repo contains the finished version so that you can run everything end-to-end without modification.
Want to go deeper into .NET, Blazor, and API patterns? 👉 learn.coderfoundry.com
MIT License – free to use, share, and adapt.
