← WorkOpen Source · API

dotnet-clean-api-starter

A production-ready .NET 10 Web API template built on Clean Architecture and CQRS. Fully wired up with JWT auth, PostgreSQL, Docker and integration tests — ready to clone and build on.

Visit site
dotnet-clean-api-starter

Period

May 2026

Role

Solo Backend Developer

Stack

.NET 10 · C# · PostgreSQL · EF Core · MediatR · JWT · Docker · xUnit · Testcontainers

The problem

Starting a new .NET API from scratch takes days of boilerplate — project structure, auth, database setup, error handling, tests. This template eliminates that setup time so you can focus on your actual feature.

What I built

  • Clean Architecture in four layers: Domain → Application → Infrastructure → API, with strict one-way dependency rules
  • CQRS via MediatR with a validation pipeline — every command runs FluentValidation automatically before the handler
  • JWT access tokens (15 min) + refresh token rotation (7 days) — stored in PostgreSQL with full revocation support
  • Multi-stage Dockerfile + docker-compose with healthcheck — one command to run the full stack locally
  • Integration tests with Testcontainers (real PostgreSQL), Respawn (database cleanup) and Bogus (realistic test data)
  • GitHub Actions CI pipeline — build, unit tests and integration tests on every push to main

Result

A fully functional, tested and documented .NET 10 API template. 17 passing tests (10 unit, 7 integration). Clean Architecture demonstrated end-to-end — from domain value objects to integration tests against a real database.

17
tests passing
4
architecture layers
CI
GitHub Actions

Next project

De Bergen