An example .NET 10 Minimal Api application with OpenAPI, Swashbuckle, and API versioning using clean architecture.
It also include the following:
- KeyCloak IDP
- Aspire
- ExceptionHandlers
- Redis OutputCaching
- CorrelationId handling using HeaderPropagation
- OpenTelemetry with custom metrics
- Integration tests using TestContainers
- Pub Sub using Rebus
- API versioning
- Auditing using Audit.Net
This template was initially based on Jason Tyler's Template, but changed as I implement and review new .NET features
-
Git Clone the repo to your device
-
(Docker Compose only) If you run the solution via Docker Compose, set up the local HTTPS development certificate. This step is not required when running via .NET Aspire (the AppHost), which manages certificates for you. The certificate is not committed to the repo (it contains a private key); each developer generates their own locally. From the root of the repo run:
- Windows (PowerShell):
./scripts/certs/setup-dev-certs.ps1 - macOS/Linux:
./scripts/certs/setup-dev-certs.sh
This exports a dev cert into your user profile (
%APPDATA%\ASP.NET\Httpson Windows,~/.aspnet/httpson macOS/Linux), whichdocker-compose.override.ymlmounts into the API container. The password must matchKestrel__Certificates__Default__Passwordindocker-compose.override.yml(default:devpassword). - Windows (PowerShell):
-
Open command prompt and set the current folder to the root of the repo
-
Execute 'dotnet new install .' command in the command prompt
-
While in command prompt create a folder in the location you want the template code to be created
-
Execute 'dotnet new ca-template -o "New Micro Service Name here"' command in the command prompt
-
If you need to uninstall the template
- Open command prompt and set the current folder to the root of the repo
- Execute 'dotnet new uninstall .' command in the command prompt
KeyCloak is setup as IDP with some defaults:
Groups
- Admin
- Standard
Roles
- standard-user-role
- Can Create, Update and View
- admin-user-role
- Can Create, Update,View and Delete
Users (Password is password)
- AdminUser
- StandardUser
Management UI (Password is admin)
- admin