To debug or run the api locally use
dotnet watch run --launch-profile "https"
There is a Dockerfile and a docker-compose.yml in the root directory. The DockerFile can be build with:
docker build .
The compose file starts three services:
- api – ASP.NET Core application.
- seq – Centralised structured log server.
- jaeger – Distributed tracing system.
Start / Shutdown these services with
docker compose up -d
docker compose down
Seq captures and can query structures logs.
Jaeger displays distributed traces.
docker-compose.yml
+docker-compose.override.yml
– default local-dev stack (override is loaded automatically).docker-compose.dev.yml
– adds optional developer tooling (e.g. ).docker-compose.prod.yml
– production-only tweaks (harder restart policies, resource limits, etc.).
# development
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d
# production
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
to run the developement stack.
All Tests can be run by chaning the working directory of the unit or integration tests and then using the command:
cd tests/IntegrationTests
dotnet test --logger "console;verbosity=detailed"
or
cd tests/UnitTests
dotnet test --logger "console;verbosity=detailed"
Applying the [Trait]
attribute at the class level allows, that every test method in that class can be run seperatly.
Example to run individual test parts:
dotnet test --filter "category=application"
Code Coverage is generated from unittests and integrationtests and merged into a report via GitHub Actions using theReportGenerator tool.
The testsuite contains a postman collection that can be used via the postman application or its vscode extension. In .extras/postman
.
The testsuite also contains a .http file with environments pre configured. In .extras/client
you can either use the vscode extension Rest-Client or the built in feature from VS2022.
You can either use the github template and refactor or if you want the the full parametric experience?
Consider the '.template.config/template.json' file.
Use
git clone https://github.com/domoar/CleanArchitectureTemplate.git
cd CleanArchitectureTemplate
to clone the repository then customize with
dotnet new cleanarch --name MyApp --SolutionName "MyApp"
This repo will be redone once github templates allows variable names in templates. Discussion
CI/CD is handled with Github Actions see the workflows in .github/workflows
.
Using the .editorconfig file all projects can be formatted using
dotnet format .\__Northwind__.sln --verbosity diagnostic
This repo ships with a pre-commit hook in .githooks/pre-commit
. Enable it once per clone by running
git config core.hooksPath .githooks
after cloning. Git Hooks
The pre-commit checks for formatting/ linting and also if the solution compiles and can be build without errors.