Skip to content
CAI
Software that uses CAICheck a score

andresantarosa/CleanArchitectureExample

37.1

Weak · 20 September 2026

2.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 5 library management application built as a study scaffold for Clean Architecture principles. It provides a RESTful API to manage authors, books, and people, while handling the full lifecycle of book loans including creation, lending, and returns. The architecture separates concerns into Domain, Application, Persistence, and WebAPI layers, utilizing MediatR for command/query handling and Entity Framework Core for data persistence.

Features

Initial domain model and persistence layer for the library management system

This release introduces the core domain and data access layers for a library management application. The Domain.Core layer adds a domain notification system (IDomainNotifications, DomainNotifications, and a facade) to handle validation errors, along with an AssertionsConcern utility for fluent validation checks. The Persistence layer establishes the Entity Framework Core infrastructure, including read/write (ApplicationDbContext) and read-only (ApplicationDbContextReadOnly) contexts, entity configurations for Person, PersonPhone, Author, Book, and BookLoan, and a series of migrations that create the database schema, add base audit fields to Person, and define relationships such as Author-to-Book and Person-to-BookLoan.

CleanArchitectureExample.Domain.Core, CleanArchitectureExample.Persistence · high confidence

Initial domain model and request handling for a library management system

This change introduces the core domain entities (Author, Book, Person, BookLoan, PersonPhone) and their associated validation logic within the CleanArchitectureExample.Domain layer. It also implements the initial set of MediatR request handlers for managing authors, books, and people, as well as handling book loan requests and returns. The domain includes a custom BookSituationEnum to track book status (Awaiting, Lent) and an event dispatcher interface to support post-commit notifications, such as sending emails or SMS upon a successful loan.

CleanArchitectureExample.Domain, CleanArchitectureExample.Service · high confidence

Initial release of CleanArchitectureExample .NET 5 solution

This change introduces the initial version of the CleanArchitectureExample project, a .NET 5 solution designed as a study scaffold for implementing Clean Architecture principles. The solution structure includes Domain, Application, Persistence, CrossCutting, WebAPI, and Service layers, along with a Tests project. It demonstrates concepts such as DDD, CQRS, Repository Pattern, Unit of Work, and Dependency Injection using the native .NET container. Key libraries integrated into the example include Entity Framework Core, MediatR, Polly, Fluent Assertions, and XUnit with Moq.

(repo-wide) · high confidence

Initial release of the Clean Architecture WebAPI

This change introduces the initial version of the CleanArchitectureExample.WebAPI project, establishing the foundational ASP.NET Core infrastructure and core domain controllers. The API exposes endpoints for managing Authors, Books, Persons, and Book Loans via the AuthorController, BookController, PersonController, and BookLoanController, all inheriting from a new BaseController that standardizes request result handling. The application is configured to use Newtonsoft.Json for serialization, integrates with the ApplicationLayer's IOrchestrator for command and query mediation, and includes standard startup, program entry point, and environment-specific configuration files.

CleanArchitectureExample.WebAPI · high confidence

Introduces application-layer orchestration and event dispatching

The Application layer now includes a new orchestration infrastructure to manage command execution and event publishing. This introduces an IOrchestrator interface and its implementation, which coordinates unit-of-work commits, domain notifications, and pre/post-commit event firing via a new EventDispatcher. Additionally, a HttpContextServiceProviderProxy is added to allow service resolution within the request context, and a generic RequestResult type is defined to standardize command/query responses.

CleanArchitectureExample.Application · high confidence

Architecture

Centralized dependency injection configuration for the application

The IoCContainer class in the CrossCutting layer now provides a centralized entry point for configuring the application's service container. This change registers core infrastructure services, including Entity Framework Core contexts for both read-write and read-only database access, along with integrations for AutoMapper and MediatR. It also binds internal application abstractions—such as orchestrators, unit of work, domain notifications, and event dispatchers—to their concrete implementations, and registers persistence repositories and communication services (SMS and email) to enable dependency injection throughout the system.

CleanArchitectureExample.CrossCutting · high confidence

Test coverage

Initial unit test coverage for domain entities and command handlers

Added a comprehensive suite of unit tests for the CleanArchitectureExample project, covering the Author, Book, Person, and BookLoan entities and their associated command handlers. The tests validate domain rules such as name length constraints, ISBN format validation based on release year, and document uniqueness for persons, as well as command behaviors like preventing duplicate loans and ensuring proper repository interactions during add and return operations.

CleanArchitectureExample.Tests · high confidence

Dependencies

Initial project structure with .NET 5 and Clean Architecture dependencies

The CleanArchitectureExample solution is introduced with a multi-project structure targeting .NET 5. The dependency set includes Entity Framework Core 5.0.4 for persistence, MediatR 9.0.0 for command/query handling, AutoMapper for object mapping, and Polly 7.2.1 for resilience patterns. The test project is configured with xUnit, Moq, and FluentAssertions, while the WebAPI layer utilizes Newtonsoft.Json for serialization.

(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

Score

  • CAI 72 → 37 (-35.0)
  • Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 70 → 56 (-13.7)
  • Architecture 93 → 93 (+0.0)
  • Maturity 78 → 53 (-25.7)
  • Readiness 78 → 28 (-50.1)
  • Security 67 → 24 (-42.9)
  • Domain Modelling 97 (new)
  • Event-Driven 100 → 100 (+0.0)

Resolved (14)

  • Bounded contexts not declared
  • Coverage not measured — analyzer environment
  • Duplicated block (10 lines × 2) (CleanArchitectureExample.Persistence/Context/ApplicationDbContext.cs)
  • Medium CVE: Microsoft.Data.SqlClient 2.0.1
  • No exposed public API
  • Test runner surfaced no tests
  • The event name 'LoanEffetivatedEvent' contains a typo ('Effetivated' instead of 'Activated' or 'Effected'). This typo is present in the base event and its related handlers/events.
  • Typo in the event name: 'Effetivated' is used instead of 'Activated' or 'Effected'. This typo is consistently applied across the base event and its related handlers/events, but the root word is misspelled.
  • early-stage repository — too few commits for a meaningful bus factor
  • early-stage repository — too little history to judge knowledge freshness
  • git history depth insufficient
  • git history depth insufficient
  • redundant comment (CleanArchitectureExample.Tests/AuthorTests/Commands/AddAuthorCommandTest.cs)
  • redundant comment (CleanArchitectureExample.Tests/AuthorTests/Commands/AddAuthorCommandTest.cs)

New (13)

  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (12 lines × 2) (CleanArchitectureExample.Persistence/Context/ApplicationDbContext.cs)
  • End-of-life runtime: .NET net5.0
  • Inconsistent spelling of 'Null' in validation method names. 'ValidateBookNotNul' is misspelled.
  • No ADRs found
  • The event class is named 'LoanEffetivatedEvent' (containing a typo 'Effetivated' instead of 'Activated' or 'Effected'). The handlers for this event are named 'LoanEffetivatedEventSendSms' and 'LoanEffetivatedEventSendMail', inheriting the typo. Additionally, the naming convention for the handlers is inconsistent with standard patterns (e.g., 'LoanEffetivatedEventHandler' or 'SendSmsNotificationHandler'), and the typo is propagated across the domain event and its handlers.
  • The event name 'LoanEffetivatedEvent' uses a non-standard and misspelled verb form. Standard domain event naming conventions typically use past tense for completed actions (e.g., 'LoanActivated', 'LoanCreated'). The suffix 'Event' is redundant in the class name if the namespace or context already implies it, but the primary issue is the typo and non-standard verb.
  • The method 'ValidateBookNotNul' contains a typo ('Nul' instead of 'Null'). This is inconsistent with the correct spelling used in 'ValidateBookGuid' and other validation methods in the codebase.
  • The test method 'ValidateBookLoadn_Return_ShouldReturnBookNotLent' contains a typo in the action description ('Loadn' instead of 'Lend'). This is inconsistent with the correctly spelled 'ValidateBookLoan_Lend_ShouldReturnNoErrors' in the same class.
  • WriteOnlyPrivateField (CleanArchitectureExample.Service/Communication/SmsServices.cs)
  • redundant comment (CleanArchitectureExample.WebAPI/Startup.cs)

API surface

  • Unchanged — 6 HTTP endpoints

Architecture

  • Unchanged — 2 containers · 1 contexts · 0 edges

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

Survey your own repository

andresantarosa/CleanArchitectureExample 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 20 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 d5b1b259e054ee64331326254c41a5f7a372e337 — 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.