Skip to content

domoar/CleanArchitectureTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CleanArchitectureTemplate

CI - Build, Format, Test Generate documentation Generate and Publish Code Coverage

ToC

  1. Api
  2. Docker
  3. Testing
  4. Usage
  5. Architecture
  6. CI/CD
  7. Tools
  8. Git Hooks

Api

To debug or run the api locally use

dotnet watch run --launch-profile "https"

DockerFile and DockerCompose for the project

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 for Logging

Seq captures and can query structures logs.

How to setup Seq

Jaeger for Tracing

Jaeger displays distributed traces.

How to setup Jaeger

Additonal compose files for different purposes (.dcproj)
  • 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.

Docker merge strategies

Testing

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

Code Coverage is generated from unittests and integrationtests and merged into a report via GitHub Actions using theReportGenerator tool.

View Full Coverage Report

Postman

The testsuite contains a postman collection that can be used via the postman application or its vscode extension. In .extras/postman.

Testsuite client

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.

Usage

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

Architecture

Continuous Integration und Continuous Deployment (CI/CD)

CI/CD is handled with Github Actions see the workflows in .github/workflows.

Tools

Using the .editorconfig file all projects can be formatted using

dotnet format .\__Northwind__.sln --verbosity diagnostic

Git Hooks

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.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published