Skip to content

DaWeba02/servicestarter-domain

Repository files navigation

ci

ServiceStarter.Domain

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.

Solution layout

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

Endpoints

  • GET /ping
  • GET /health/live
  • GET /health/ready
  • POST /auth/login
  • POST /quote
  • GET /audit/recent?take=20 (AdminOnly)
  • Swagger UI available only in Development.

Running locally

  1. dotnet restore
  2. dotnet build -c Release
  3. Ensure SQL Server reachable (default: localhost,14333, database ServiceStarter, sa / Pass@word1!).
  4. Run API: dotnet run --project src/ServiceStarter.Api (set ASPNETCORE_ENVIRONMENT=Development for Swagger and auto-migrations).

Running with docker compose

docker compose up --build

API listens on http://localhost:8080; SQL Server on localhost,14333.

Testing

dotnet test -c Release

Integration tests spin up SQL Server using Testcontainers and apply migrations automatically in the Testing environment.

Migrations

  • DbContext lives in ServiceStarter.Infrastructure.
  • Migrations are under ServiceStarter.Infrastructure/Persistence/Migrations.
  • Dev/Testing apply on startup; Production requires Database:ApplyMigrationsOnStartup=true or manual dotnet ef database update.

Security

  • JWT auth with AdminOnly policy (@admin.local email -> Admin role).
  • Serilog request logging and global ProblemDetails error responses.

About

Production-ready .NET 8 Clean Architecture starter (Domain-first) with JWT auth, EF Core SQL migrations, Serilog, ProblemDetails + FluentValidation, Docker/Compose, CI, and Testcontainers-based integration tests.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors