Skip to content
CAI
Software that uses CAICheck a score

lamondlu/Library

23.4

Critical · 21 September 2026

7.6k

lines of production code

JavaScript

with C#

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a .NET Core-based microservice architecture for library management, orchestrating book inventory, rental, and identity operations. It employs an event-sourcing pattern with a central command and event handling infrastructure, supported by SQL Server and MongoDB for persistence. The services communicate via RabbitMQ and are discovered through Consul, with an API Gateway routing requests to the respective backend services.

Features

API Gateway configured with Ocelot and Consul service discovery

The API Gateway has been set up using the Ocelot framework with Consul-based service discovery. This change introduces the core routing configuration for services including Identity, Inventory, Log, and Rental services, enabling the gateway to route requests to the appropriate backend microservices.

src/Library.ApiGateway · high confidence

Added Bootstrap 3.3.7 theme and default UI scaffolding

The Library.UI project now includes the full Bootstrap v3.3.7 theme (CSS, minified CSS, and source maps) alongside default ASP.NET MVC 5 scaffolding files. This adds the \BundleConfig\ for script/style bundling, \FilterConfig\ for global error handling, \RouteConfig\ for default routing, and \Startup.Auth\ for authentication configuration, establishing the foundational styling and structure for the application's user interface.

src/Library.UI · high confidence

Added Consul service discovery and API request utilities

Introduced a new service discovery implementation for Consul, including a generic HTTP client wrapper (ApiRequest) for performing REST operations, a model class (ConsulServiceItem) for service registration payloads, and a Consul-specific service discovery implementation (ConsulServiceDiscovery) that registers services via the Consul API. The change also adds core infrastructure interfaces and models (IServiceDiscovery, BaseServiceDiscovery, Service) to support this capability.

src/Library.Infrastructure.Operation.Consul, src/Library.Infrastructure.Operation.Core · high confidence

Added Dockerfiles and Nginx configuration for microservices

Added Dockerfiles for each microservice (Inventory, ApiGateway, Handler, Identity, Log, Rental) and an Nginx reverse-proxy configuration (nginx.conf.tpl) to facilitate containerized deployment and load balancing across the service instances.

src · high confidence

Added database schema scripts for library management

New SQL scripts have been added to the repository, defining the database schemas for the application. This includes tables for managing book inventory (Book, BookInventory, History), rental records (RentalRecord), library events (Events), command logs (CommandLogs), and user/person management (Person, User) with initial seed data for an admin and a customer.

db · high confidence

Initial database schema scripts for library management

Added SQL scripts to create and populate the core database tables for the application. This includes the BookInventoryDB (Book, BookInventory, History), BookRentalDB (RentalRecord), LibraryEventDB (Events), LibraryLogDB (CommandLogs), and LibraryUserDB (Person, User) with initial seed data for admin and guest users.

src/DBScripts · high confidence

Initial project scaffolding and documentation

The repository was initialized with essential configuration and documentation files. A \.gitattributes\ file was added to configure line-ending normalization and diff behavior for C\# and other project files. A \.gitignore\ file was introduced to exclude Visual Studio build artifacts, test results, and IDE-specific files. The project's licensing was established with an Apache 2.0 \LICENSE\ file. Additionally, a \README.md\ was created to describe the microservice architecture, prerequisites (including .NET Core, Redis, RabbitMQ, and Consul), and service discovery mechanisms. Finally, a Jekyll \\_config.yml\ file was added to set the site theme to 'tactile'.

(repo-wide) · high confidence

Initial release of the Inventory Service API

The Inventory Service is now available as a standalone microservice, exposing REST endpoints for managing book inventory. Users can now retrieve book lists and details, add new books, update existing records, and manage inventory status changes (in-store/out-of-store) via the BooksController. The service is configured to listen on port 5001 and registers itself with Consul for service discovery. Configuration for database connections (read/write) and RabbitMQ messaging is provided via appsettings.json, with providers implemented to inject these settings into the application's dependency injection container.

src/Library.Service.Inventory · high confidence

Introduce Rental service with book rental and return capabilities

The Rental service is introduced, providing endpoints to rent and return books, as well as retrieve unreturned book records. The service is configured to run on port 5002 and registers with Consul for service discovery. It utilizes RabbitMQ for command publishing and connects to SQL Server databases for read/write operations, with all configuration managed via appsettings.json.

src/Library.Service.Rental · high confidence

Introduce book rental domain logic

Added the domain model and command handlers for the book rental flow, including the Book and Customer entities, RentBook and ReturnBook commands, and the associated event handlers that process rental requests and updates.

src/Library.Service.Rental.Domain · high confidence

Introduce domain models and handlers for book inventory management

Added domain entities for Book and BookInventory, along with their associated command handlers, event handlers, and event classes within the Library.Service.Inventory.Domain layer. This introduces the core domain logic for tracking book status (InStore/OutStore), managing book details (title, ISBN, description, issued date), and processing inventory state changes such as adding, updating, or removing books and their physical inventory records.

src/Library.Service.Inventory.Domain · high confidence

Introduce identity domain models and SQL Server data accessors

Added new domain classes for identity management, including User, Administrator, and UserPrincipal, along with corresponding domain events (AdministratorCreatedEvent, UserCreatedEvent) and an event handler stub. Introduced view models (IdentityViewModel, IdentityDetailsViewModel, CustomerListViewModel) to represent identity and customer data. Implemented the SQL Server persistence layer with a new Convertors utility for mapping DataTables to view models, and a new IdentityReportDataAccessor that provides methods for retrieving user identities, customer lists, and account details, as well as creating new users.

src/Library.Service.Identity.Domain · high confidence

Introduce service handler with configuration and dependency injection

The Library.Service.Handler project is introduced, providing a central entry point that reads appsettings.json to configure database connection strings, RabbitMQ, and SignalR endpoints. It registers command and event handlers via reflection and maps interfaces to implementations in the DI container, enabling the system to process commands and events from the Inventory, Rental, and Identity services.

src/Library.Service.Handler · high confidence

Introduces a new domain core and infrastructure layer for event sourcing and command handling

The codebase now includes a new \Library.Domain.Core\ module that implements an event-sourcing pattern, featuring an \AggregateRoot\ base class that tracks and persists \DomainEvent\s. This is supported by a \BaseCommandHandler\ and \BaseEventHandler\ that process commands and events while logging outcomes via \CommandLogAttribute\ and \EventLogAttribute\. The infrastructure layer provides concrete implementations for data access, including a \DomainRepository\ for SQL Server and a \MongoDBEventStorage\ for event persistence, along with messaging interfaces for command and event publishing/subscribing.

(repo-wide) · high confidence

Behavioural changes

Added new DTOs for customer and identity data

New Data Transfer Objects (DTOs) have been introduced in the identity service to handle customer and identity information. Specifically, \CustomerDTO\ now includes fields for user credentials (username, password) and personal details (first, middle, and last name), while \IdentityDTO\ is added to manage username and password data. These changes enable the service to serialize and deserialize this specific user identity data.

src/Library.Service.Identity/DTOs · medium confidence

Migrated logging and identity services to new microservice structure

The logging and identity services have been restructured into dedicated microservices (Library.Service.Logs and Library.Service.Identity) with updated startup configurations. The logging service now exposes endpoints to retrieve command and event logs, while the identity service provides APIs for identity verification, customer details, and account information. Both services now register with Consul for service discovery and use appsettings.json for configuration, including database connection strings and RabbitMQ credentials.

src/Library.Service.Identity · high confidence

Removal of default API controllers and configuration files

The default \ValuesController\ and associated configuration files (such as \appsettings.json\ and \Startup.cs\) have been removed from both the \BookingLibrary.BookRepository.ApiService\ and \BookingLibrary.RentSystem.ApiService\ projects. This change eliminates the boilerplate HTTP endpoints and default application startup configuration, indicating a shift away from the initial project templates toward a more customized service implementation.

BookingLibrary.BookRepository.ApiService, BookingLibrary.RentSystem.ApiService · high confidence

Dependencies

Added .NET Core 2.0 project files for infrastructure and service layers

This change introduces 31 new .csproj files that define the build structure for the library's domain, infrastructure, and service layers. These projects target .NET Core 2.0 and establish dependencies on key packages including IdentityServer4.AccessTokenValidation 2.1.0, Microsoft.AspNetCore.All 2.0.0, and Microsoft.Extensions.Configuration.Json 2.0.0, alongside internal project references for components like SQL Server data persistence, MongoDB event storage, and RabbitMQ messaging.

(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 28 → 23 (-4.3)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 57 → 52 (-5.3)
  • Architecture 88 → 88 (+0.2)
  • Maturity 51 → 50 (-0.1)
  • Readiness 24 → 26 (+1.4)
  • Security 11 → 9 (-2.7)
  • Domain Modelling 54 → 59 (+4.8)
  • Event-Driven 100 → 100 (+0.0)
  • Accessibility 61 → 29 (-31.5)

Resolved (61)

  • Bounded contexts not declared
  • Build did not complete in the analyzer
  • Duplicated block (10 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • Duplicated block (10 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • Duplicated block (11 lines × 2) (src/Library.Service.Handler/Program.cs)
  • Duplicated block (12 lines × 2) (src/Library.Domain.Core/BaseEventHandler.cs)
  • Duplicated block (12 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • Duplicated block (12 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • Duplicated block (13 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • Duplicated block (14 lines × 8) (src/Library.Infrastructure.Messaging.SignalR/ApiRequest.cs)
  • Duplicated block (15 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • Duplicated block (15 lines × 2) (src/Library.UI/Utilities/ApiRequest.cs)
  • Duplicated block (15 lines × 4) (src/Library.Infrastructure.Messaging.SignalR/ApiRequest.cs)
  • Duplicated block (9 lines × 2) (src/Library.Infrastructure.EventStorage.SQLServer/DbHelper.cs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • …and 41 more

New (383)

  • BaseEventHandler.AddEventLog (cognitive 41) (src/Library.Domain.Core/BaseEventHandler.cs)
  • BaseEventHandler.AddEventLog (cyclomatic 18) (src/Library.Domain.Core/BaseEventHandler.cs)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no licence statement (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 2) (src/Library.Infrastructure.DataPersistence.Core.SQLServer/DbHelper.cs)
  • Duplicated block (10 lines × 2) (src/Library.UI/Models/ManageViewModels.cs)
  • Duplicated block (11 lines × 2) (src/Library.Infrastructure.DataPersistence.Core.SQLServer/DbHelper.cs)
  • Duplicated block (11 lines × 2) (src/Library.Infrastructure.DataPersistence.Inventory.SQLServer/Extensions/ConvertExtension.cs)
  • Duplicated block (12 lines × 4) (src/Library.Service.Identity/Startup.cs)
  • Duplicated block (12–13 lines × 3) (src/Library.Domain.Core/BaseEventHandler.cs)
  • Duplicated block (13 lines × 2) (src/Library.Infrastructure.DataPersistence.Core.SQLServer/DbHelper.cs)
  • Duplicated block (13 lines × 2) (src/Library.Infrastructure.DataPersistence.Core.SQLServer/DbHelper.cs)
  • Duplicated block (14 lines × 2) (src/Library.Infrastructure.DataPersistence.Core.SQLServer/DbHelper.cs)
  • Duplicated block (14 lines × 8) (src/Library.Infrastructure.Core/Utilities/ApiRequest.cs)
  • Duplicated block (14–15 lines × 2) (src/Library.Domain.Core/BaseEventHandler.cs)
  • Duplicated block (16 lines × 2) (src/Library.Service.Handler/Program.cs)
  • Duplicated block (16 lines × 2) (src/Library.UI/Models/AccountViewModels.cs)
  • Duplicated block (17 lines × 2) (src/Library.Infrastructure.DataPersistence.Core.SQLServer/DbHelper.cs)
  • Duplicated block (17 lines × 2) (src/Library.Service.Rental.Domain/ViewModels/UnreturnedBookViewModel.cs)
  • …and 363 more

API surface

  • Unchanged — 20 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

lamondlu/Library 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 62397358c050a35b93c65d19438f3d995e2c3e2f — 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-fa71c66cabd8.