This template uses Caravel package as an SDK and it bootstraps a full functional web api with the following structure:
- CaravelTemplate (Application Domain)
- CaravelTemplate.Core (Application business logic)
- CaravelTemplate.Infrastructure (External dependencies such as database)
- CaravelTemplate.WebApi (HTTP Web Api using ASP.NET 3.1)
- CaravelTemplate.WebApi.Tests (Integration tests)
PS: CaravelTemplate
will be replaced for your project name when generating the project.
- Caravel SDK (Errors, Middleware, Exceptions)
- Business logic using CQRS pattern (MediatR)
- Entity Framework Core (InMemory and PostgresSQL)
- Health Check mechanism
- Swagger using Swashbuckle
- Docker and Docker Compose
- Logging using Serilog
- Testing using Bogus (Fake data generator) and Fluent Assertions
git clone git@github.com:Talento90/caravel-template.git
dotnet new --install ~/caravel-template
dotnet new caravel-webapi -n MyProject -o ./
Note: MyProject
is going to replace the CaravelTemplate
dotnet run --project src/MyProject.WebApi
open http://localhost:5000/swagger/index.html
- Setup PostgresSQL database
- Setup WebApi
# Setup and run docker compose
docker-compose up
# Remove containers
docker-compose down
# Install dotnet-ef tool
dotnet tool install --global dotnet-ef
# Update dotnet-ef tool
dotnet tool update --global dotnet-ef
# Run DbContext Migration
dotnet ef migrations add {Migratio Name} --output-dir Data/Migrations --project src/CaravelTemplate.Infrastructure
# Run Identity DbContext Migration
dotnet ef migrations add {Migratio Name} --output-dir Data/Migrations --project src/CaravelTemplate.Identity