This template uses Caravel package as an SDK and it bootstraps a full functional web api following the Hexagonal Architecture:
git clone [email protected]: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 and run docker compose
docker compose up
# Remove containers
docker compose down
sh scripts/database-init.sh
# Install dotnet-ef tool
dotnet tool install --global dotnet-ef
# Update dotnet-ef tool
dotnet tool update --global dotnet-ef
# List all migrations
dotnet ef migrations list --startup-project src/CaravelTemplate.Migrator --project src/CaravelTemplate.Adapter.PostgreSql --context ApplicationDbContext --no-build
# Generate SQL Scripts
dotnet ef migrations script --startup-project src/CaravelTemplate.Migrator --project src/CaravelTemplate.Adapter.PostgreSql --context ApplicationDbContext --no-build
# Add new database migration changes to the Application DbContext
dotnet ef migrations add CreateApplicationSchema --startup-project src/CaravelTemplate.Migrator --output-dir Migrations --project src/CaravelTemplate.Adapter.PostgreSql --context ApplicationDbContext --no-build
# Apply the migration changes
dotnet ef database update --startup-project src/CaravelTemplate.Migrator --project src/CaravelTemplate.Adapter.PostgreSql --context ApplicationDbContext --no-build