Marcelo Daniel Toledo

Marcelo Daniel Toledo

Software Developer | Bachelor's Degree in Computer Science

Back to Projects
Cover .NET API Template
Logo .NET API Template

.NET API Template

Open Source

Clean Architecture starter for .NET 9 with manual CQRS, validations, API versioning and Docker support — no hidden magic or forced conventions.

.NET Clean Architecture CQRS Scalar xUnit EF Core FluentValidation Serilog Docker

Context

In every new project, bootstrapping a clean .NET API consumes repetitive time: structuring layers, registering dependencies, defining error handling, adding validations. Without a standardized base, each team ends up making different architecture decisions about the same problems.

This template was built with two purposes in mind: serve as a reusable starting point across different projects, and as a training resource for teams adopting Clean Architecture — with explicit implementations and no hidden magic, so the code is easy to read, understand and adapt.

The Challenge

Create a pragmatic reference starter that applies Clean Architecture coherently, launchable in minutes, without magic dependencies or hidden conventions, usable as a shared starting point for any team.

The Solution

A template implementing Clean Architecture with clear layer separation (Domain, Application, Infrastructure, Presentation), manual CQRS without external libraries, request validation with FluentValidation via decorator pattern, centralized exception handling, structured logging with Serilog, API versioning and auto-migrations with EF Core. Includes Docker support with SQL Server and a test suite covering all three layers.

Technologies

  • .NET 9 — base framework
  • Clean Architecture — layer separation: Domain, Application, Infrastructure, Presentation
  • Manual CQRS — custom implementation without MediatR or mediation libraries
  • FluentValidation — request validation via decorator pattern
  • EF Core + Ardalis.Specification — ORM, auto-migrations and typed queries
  • Serilog — structured logging
  • Scalar — API documentation
  • Asp.Versioning — API versioning
  • xUnit + Moq — unit and integration testing
  • Docker — containerization with SQL Server 2022