DKNet API Solution Template

dotnet new solution template for an ASP.NET Core microservice built as vertical slices over
DDD/CQRS — for a team starting a new .NET 10 service that wants the layering, the hardening and the
CRUD plumbing decided before the first feature is written.
📖 Overview
A scaffolded solution is a running HTTP API that ships with two worked features, each the same shape
of slice built a different way:
- Products — create, price, approve, discontinue and list
the products in a caller's own catalogue; most of it is declared by attribute and generated.
- Purchase Orders — create, correct, cancel and look
up a customer's purchase orders, with a safe-to-retry create call; every layer is written by hand.
The API is called over HTTP by front-ends and other services, directly or through the typed
Minimal.Client package the solution also scaffolds. Which sample to copy for a feature of your own:
Manual vs. Automated.
🏗️ Runtime architecture

Everything inside the trust boundary runs in the one Minimal.Api process. PostgreSQL is required:
with FeatureManagement:RunDbMigrationWhenAppStart on (the Development overlay) the start-up
migration throws without ConnectionStrings:AppDb; with it off (the base file) the first database
call fails instead. Redis is optional: without
ConnectionStrings:Redis the cache and the idempotency store fall back to in-process stores, correct
for a single instance only. Azure Service Bus is used only with FeatureManagement:EnableServiceBus
and ConnectionStrings:AzureBus both set. With FeatureManagement:RequireAuthorization on, tokens are
validated against your OIDC tenant; with it off and FeatureManagement:EnableDemoAuthentication on
(the Development overlay), a built-in demonstration identity is attached to every request. On local runs Minimal.AppHost (.NET Aspire) provisions the Redis and PostgreSQL containers
and injects both connection strings.
🌐 Downstream systems
| System | Direction | How | What for | When it is down |
|---|
| PostgreSQL | we call it | Npgsql through CoreDbContext | every stored aggregate, the start-up migration, the static seed rows | Without a connection string the start-up migration throws when RunDbMigrationWhenAppStart is on, and the first database call fails when it is off. At run time Npgsql's EnableRetryOnFailure() defaults retry a transient failure before the request fails; /healthz carries a CoreDbContext check. Locally, with the database container stopped, /healthz answered 504 Gateway Timeout. |
| Redis | we call it | StackExchange.Redis | distributed cache and idempotency keys | Not set: in-process stores, single instance only. Set but unreachable: see ❓ Open questions. |
| Identity provider (OIDC) | we call it | JWT bearer metadata fetch, only with RequireAuthorization on | signing keys, issuer and audience for token validation | See ❓ Open questions. |
| Azure Service Bus | it consumes our events | SlimMessageBus AzureBus child bus, topic product-tp, subscription product-sub | forwards ProductCreatedEvent | Off unless EnableServiceBus and ConnectionStrings:AzureBus are both set; the in-memory bus keeps working either way. |
| Azure App Configuration | we call it | DefaultAzureCredential, at start-up, only with EnableAzureAppConfig on | configuration and feature flags | See ❓ Open questions. |
| OTLP collector / Azure Monitor | we call it | OpenTelemetry exporters, only with EnableOpenTelemetry on | traces, metrics, logs | See ❓ Open questions. |
The keys that point at each system: Configuration.
🚀 Quick Start
You need the .NET 10 SDK and a running Docker engine (the Aspire host starts Redis and PostgreSQL in
containers).
From any directory, add the GitHub Packages feed and install the template — the feed needs a GitHub
personal access token with read:packages: