Skip to content
CAI
Software that uses CAICheck a score

ktutak1337/Clean-Architecture-Template

58.6

Weak · 21 September 2026

4k

lines of production code

C#

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a .NET-based API service for managing orders, structured around a Clean Architecture pattern. It implements a CQRS (Command Query Responsibility Segregation) design, supporting both MediatR and Convey.CQRS for internal command and query dispatching. The application handles order creation, updates, and retrieval, backed by PostgreSQL and MongoDB, with infrastructure for structured logging and request context propagation.

Features

Add Docker support for containerized deployment

Users can now build and run the application using Docker. A Dockerfile and .dockerignore file have been added to the project root, enabling containerized execution of the .NET 5.0 API. The Dockerfile configures the ASP.NET Core environment and exposes port 5000, allowing developers to easily deploy the application in isolated containers.

(repo-wide) · high confidence

Added CQRS command definitions for order management

Introduced new command objects for order operations, including CreateOrder and UpdateOrder, which define the structure for creating and updating orders with buyer ID, shipping address, and line items. The implementation supports both MediatR and Convey.CQRS command interfaces via conditional compilation, and includes an Extensions class to handle the mapping of write models to domain entities and value objects.

src/CleanArchitectureTemplate.Application/Commands · high confidence

Added DTOs for Order, OrderItem, and Address

New Data Transfer Objects (DTOs) have been introduced in the Application layer to support the new order management features. Specifically, the system now includes OrderDto, OrderItemDto, and AddressDto classes, which define the structure for order data transfer and mapping, enabling the application layer to expose these data models to the API and infrastructure layers.

src/CleanArchitectureTemplate.Application/DTOs · high confidence

Added OrdersController with support for MediatR or custom dispatcher

Introduced the OrdersController to expose order management endpoints (create, retrieve by ID, list all, and update). The controller is built on a new BaseController that abstracts the underlying command/query execution mechanism, supporting either the MediatR library or a custom IDispatcher implementation. This allows the API layer to remain consistent regardless of the chosen internal architecture.

src/CleanArchitectureTemplate.Api/Controllers · high confidence

Added query models for retrieving single and multiple orders

Introduced GetOrder and GetOrders query classes in the Application layer to support fetching order data. These classes implement either the MediatR IRequest interface or the Convey.CQRS IQuery interface depending on the mediatr feature flag, enabling the underlying handlers to process order retrieval requests.

src/CleanArchitectureTemplate.Application/Queries · high confidence

Added scripts and compose files for local development and infrastructure

New shell scripts (create-migration.sh, remove-migration.sh, revert-migration.sh, install\_dotnet-ef\_cli.sh, start-api.sh) and Docker Compose configurations (api.yml, infrastructure.yml) are introduced to streamline local development. The infrastructure configuration now supports PostgreSQL alongside MongoDB, and includes tooling for logging (Elasticsearch, Seq).

scripts · high confidence

Added write models for address and order items

New write model classes have been introduced to support data transfer for address and order line items. The AddressWriteModel now exposes City, Street, Province, Country, and ZipCode properties, while the OrderItemWriteModel provides Id, Name, Quantity, UnitPrice, and Price fields, enabling structured command payloads for these entities.

src/CleanArchitectureTemplate.Application/Commands/WriteModels · high confidence

Adds request context, structured logging, and error handling infrastructure

The infrastructure layer now provides a request context (Context, ContextAccessor, IdentityContext) to propagate request-scoped data like correlation IDs and user identity across the application. It also introduces a structured logging pipeline (Serilog with console, file, Seq, and Elasticsearch sinks) and a centralized error handling middleware that maps exceptions to standardized JSON responses. These components are registered and wired up via extension methods in the Infrastructure project.

src/CleanArchitectureTemplate.Infrastructure · high confidence

Implemented order creation and update command handlers

Added CreateOrderHandler and UpdateOrderHandler in the Application layer to process order commands. The handlers validate that orders do not already exist or are found before proceeding, and support both MediatR (IRequestHandler) and Convey.CQRS (ICommandHandler) patterns via conditional compilation. Users can now create and update orders through the application's command processing pipeline.

src/CleanArchitectureTemplate.Application/Commands/Handlers · high confidence

Initial API project structure with environment-specific configuration

The API layer is established with a standard ASP.NET Core host builder and startup configuration. Environment-specific settings (development, docker, local, tests) are provided in appsettings files, each containing connection strings for MongoDB and PostgreSQL, logging configurations, and Swagger/OpenAPI settings including OAuth2 endpoints. The application entry point uses conditional compilation to optionally integrate Serilog logging.

src/CleanArchitectureTemplate.Api · high confidence

Introduces core domain model and business rule validation

The Core project now includes the foundational domain model, including the Order aggregate, Buyer, OrderItem, and associated value objects like Address and Amount. This change introduces a mechanism for validating business rules, ensuring that orders meet specific constraints such as minimum and maximum total amounts. The update also adds domain events to track state changes and defines a repository interface for order persistence.

src/CleanArchitectureTemplate.Core · high confidence

Behavioural changes

Added context interfaces for request and identity information

New interfaces IContext and IIdentityContext have been introduced in the Application layer to expose request metadata (RequestId, CorrelationId, TraceId, IpAddress, UserAgent) and identity details (IsAuthenticated, Id, Role, Claims). These interfaces provide a structured way to access request and identity context throughout the application, enabling better tracking and security-related functionality.

src/CleanArchitectureTemplate.Application/Contexts · medium confidence

Application layer service registration and CQRS support

The Application layer now registers application services and supports the CQRS pattern. The Extensions class provides an AddApplication method that configures the service collection, and when the 'mediatr' feature is disabled, it also configures the Convey CQRS pipeline (commands, events, and queries) with in-memory dispatchers.

src/CleanArchitectureTemplate.Application · high confidence

Introduce IDispatcher interface for command and query dispatching

A new IDispatcher interface is added to the application layer, defining the contract for sending commands and executing queries via the Convey.CQRS library. This provides a unified abstraction for dispatching commands and queries, allowing consumers to interact with the CQRS infrastructure without depending on specific implementations.

src/CleanArchitectureTemplate.Application/Dispatchers · high confidence

Introduces structured exception handling with domain-specific error types

The application layer now includes a base ApplicationException class and an ExceptionResponse record to standardize error mapping. New domain-specific exceptions, OrderAlreadyExistsException and OrderNotFoundException, are added, each carrying an OrderId for better context. This enables consistent error responses for order-related failures.

src/CleanArchitectureTemplate.Application/Exceptions · medium confidence

Test coverage

Added placeholder test files for EndToEnd, Integration, and Unit test projects

Added new test files (UnitTest1.cs) to the CleanArchitectureTemplate.Tests.EndToEnd, CleanArchitectureTemplate.Tests.Integration, and CleanArchitectureTemplate.Tests.Unit projects. These files provide a conditional implementation that supports either NUnit or xUnit test frameworks, ensuring the test projects have a valid structure for future test development.

tests · high confidence

Dependencies

Upgrade to .NET 6.0 and update test framework dependencies

The project files for the API, Application, Core, Infrastructure, Shared, and all test projects (Unit, Integration, EndToEnd) have been updated to target the .NET 6.0 runtime. Additionally, the test projects now include updated package references for xUnit (2.4.1), NUnit (3.13.2), and related testing libraries (Moq 4.16.1, Shouldly 4.0.3, Microsoft.NET.Test.Sdk 17.0.0) to align with the new framework version.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.

Score

  • CAI 65 → 59 (-6.7)
  • Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 57 → 40 (-16.9)
  • Architecture 86 → 86 (+0.0)
  • Maturity 74 → 74 (+0.0)
  • Readiness 66 → 70 (+3.6)
  • Security 76 → 79 (+2.6)
  • Domain Modelling 100 → 100 (-0.0)

Resolved (15)

  • Bounded contexts not declared
  • Duplicated block (10 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Logging/Extensions.cs)
  • Duplicated block (12 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Exceptions/Definition/ErrorHandlerMiddleware.cs)
  • Duplicated block (12 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Persistence/EF/CleanArchitectureTemplateDbContext.cs)
  • Duplicated block (13 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Extensions.cs)
  • Duplicated block (14 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Logging/Extensions.cs)
  • Duplicated block (15 lines × 2) (src/CleanArchitectureTemplate.Core/BuildingBlocks/ValueObject.cs)
  • Duplicated block (16 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Swagger/Extensions.cs)
  • Duplicated block (9 lines × 2) (src/CleanArchitectureTemplate.Infrastructure/Contexts/IdentityContext.cs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Medium CVE: System.Data.SqlClient 4.8.1
  • No exposed public API
  • There is no guidance on running locally or setting up Docker. (README.md)
  • single-maintainer — knowledge-concentration (bus factor) risk

New (172)

  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/BaseController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/BaseController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/BaseController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/BaseController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Controllers/OrdersController.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Program.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Program.cs)
  • DeadPreprocessorBranch (src/CleanArchitectureTemplate.Api/Program.cs)
  • …and 152 more

API surface

  • Unchanged — 4 HTTP endpoints

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

ktutak1337/Clean-Architecture-Template was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 278b9369ce5e8dc036ca81f96d172cccea0e982e — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-28e75b8e3254.