This is a multi-project solution dotnet template for developing an enterprise-level Web API with.NET 6 ASP.NET Core, following Clean Architecture principles and API best practices. The .NET 6 Web Api Template consist of scafolding for API versioning, CQRS, email, localization, logging, IP rate limiting, JWT, Open API, validation, unit and integration testing.
You will need the following tools:
- Visual Studio Code or Visual Studio 2022 (version 17.0.0 Preview 7.0 or later)
- .NET Core SDK 6.0
- Install the latest .NET Core 6 SDK.
- Run
dotnet new --install Net6WebTemplate::1.0.0-beta.2
to install the project template - Then navigate to the location you would like to create to project
- Run
dotnet new net6webapi -o "my-project"
to create a new project
ASP.NET Core Web API uses HTTPS and relies on certificates for trust, identity and encryption. To run Net5WebTemplate application Docker over HTTPS during development do the following:
- Generate certificate using 'dotnet dev-certs' (for localhost use Only!).
Note: Update the docker-compose file with dev-cert password used.
On Windows using Linux Containers
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p your_password
dotnet dev-certs https --trust
When using PowerShell, replace %USERPROFILE% with $env:USERPROFILE.
On macOS or Linux
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p { password here }
dotnet dev-certs https --trust
- Build and run Docker containers run Docker compose located in the solution directory
docker-compose -f 'docker-compose.yml' up --build
To setup the SQL Server database following the instrcutions below:
- Reveiw the connection string in appsettings.Local.json and update the database name.
- Run
dotnet ef migrations add Initial --context <ProjectName>DbContext
to add migation with EF Core - Run
dotnet ef database update Initial
to create application database.
This solution's structure was heavily infuenced by Jason Taylor's Clean Architecture model. Icon made by Flat Icons from www.flaticon.com
The main branch is running .NET 6.0
This project is licensed under the MIT License - see the LICENSE.md main branch is running .NET 6.0 file for details.