This is a template for an API using a streamlined verison of Clean Architecture alongside .NET's Minimal APIs.
-
.NET 9 SDK - [required] This solution in built on it, you need to install it before building and running.
-
Docker - [optional] If you want to build the Dockerfile you will need to install it.
-
Docker-Compose - [optional] If you want to launch this solution quickly via the docker-compose.yml you will need to install it.
This is a .NET template and you can install it using the dotnet new cli. To install the lastest version of the template run the following command.
dotnet new install CleanApi.Solution.Template
To create a new solution using this template run one of the following commands
# new solution with git initialized
dotnet new cleanapi --allow-scripts yes --name {YOUR_SOLUTION_NAMESPACE}
# new solution without git
dotnet new cleanapi --git false --name {YOUR_SOLUTION_NAMESPACE}
And then you could modify contents of docker-compose.yml
, src/Web/Dockerfile
and src/Web/Configs/*.json
to suit your own business. Things you may wanna to modify are as follows:
- postgres configs in docker-compose.yml
- postgres connection string in config files
- dockerfile labels
To learn something more about creating new solution from this template, run the following command:
dotnet new cleanapi --help
There are plenty of handy implementations of features throughout this solution, in no particular order here are some that might interest you.
- Authentication using JWT Token
- Data Storage using Postgres
- Data accessing using EFCore with Code First Mode
- Object Mapping using AutoMapper
- Mediator Pattern using MediatR
- Validation using FluentValidation
- OpenApi using Swashbuckle
- Logging using Serilog
- Testing using NUnit, Fluent Assertions, Moq & Respawn