Production-ready .NET 8 minimal API starter following Clean Architecture (Domain-first) with SQL Server persistence, JWT auth, Serilog logging, FluentValidation, health checks, and Testcontainers-based integration tests.
src/ServiceStarter.Domain– domain model (Money, PricingEngine, value objects).src/ServiceStarter.Application– use cases, validators, ports (audit, JWT).src/ServiceStarter.Infrastructure– EF Core DbContext, migrations, JWT and clock implementations.src/ServiceStarter.Api– minimal API endpoints, DI, auth, error handling.tests/*– unit and integration tests (SQL Server via Testcontainers).docs/– ADRs, C4 container diagram, starter guide.docker/,docker-compose.yml– containerized runtime.
GET /pingGET /health/liveGET /health/readyPOST /auth/loginPOST /quoteGET /audit/recent?take=20(AdminOnly)- Swagger UI available only in Development.
dotnet restoredotnet build -c Release- Ensure SQL Server reachable (default:
localhost,14333, databaseServiceStarter,sa/Pass@word1!). - Run API:
dotnet run --project src/ServiceStarter.Api(setASPNETCORE_ENVIRONMENT=Developmentfor Swagger and auto-migrations).
docker compose up --build
API listens on http://localhost:8080; SQL Server on localhost,14333.
dotnet test -c Release
Integration tests spin up SQL Server using Testcontainers and apply migrations automatically in the Testing environment.
- DbContext lives in
ServiceStarter.Infrastructure. - Migrations are under
ServiceStarter.Infrastructure/Persistence/Migrations. - Dev/Testing apply on startup; Production requires
Database:ApplyMigrationsOnStartup=trueor manualdotnet ef database update.
- JWT auth with AdminOnly policy (
@admin.localemail -> Admin role). - Serilog request logging and global ProblemDetails error responses.