Skip to content
CAI
Software that uses CAICheck a score

kalintsenkov/BookStore

39.8

Weak · 20 September 2026

3.4k

lines of production code

TypeScript

with C#

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

This system is a full-stack e-commerce platform for a bookstore, built with a .NET 7 backend and a React frontend. It provides capabilities for managing a book and author catalog, handling user identity and profiles, and processing sales through shopping carts and orders. The architecture follows domain-driven design principles, utilizing CQRS, event sourcing for state synchronization, and soft-delete mechanisms to maintain data integrity.

Features

Adds application-layer infrastructure for validation, mapping, and result handling

This change introduces a suite of common application services and patterns to the BookStore backend. It adds a MediatR pipeline behavior that automatically validates incoming requests using FluentValidation and throws a structured ModelValidationException on failure. It also provides a generic Result type (success/failure with error handling) and a paginated response model for API responses. Additionally, it establishes an AutoMapper-based mapping profile that automatically discovers and applies mappings from types implementing IMapFrom\<T\>, alongside supporting contracts for current user context, date/time abstraction, in-memory database operations, and query repositories.

src/Server/BookStore.Application/Common · high confidence

Book catalog domain model and factory implementation

The catalog domain now includes a complete Book and Author model with strict validation rules enforced via factory classes (BookFactory, AuthorFactory) and custom exceptions. Users can create and update books with specific attributes like title, price, quantity, image URL, description, genre, and author, with the system ensuring data integrity through guard clauses. The domain also introduces initial seed data for popular books and supports querying books by title, author, genre, and price range through specification patterns.

src/Server/BookStore.Domain/Catalog · high confidence

Domain foundation: base models, validation, and event infrastructure

The BookStore domain layer now includes core building blocks for domain-driven design. The Entity base class introduces soft-delete support (IsDeleted, DeletedOn) and a domain event collection, enabling entities to track state changes and raise events like BookCreated, BookUpdated, and BookDeleted. A new Guard class provides centralized validation for strings, numbers, and URLs, throwing typed BaseDomainExceptions on failure. The Enumeration base class adds value-based equality and lookup capabilities for strongly-typed enums. Additionally, a Specification pattern with expression caching is introduced to standardize complex query logic, while interfaces for aggregate roots, repositories, factories, and initial data establish the structural contract for the domain.

src/Server/BookStore.Domain/Common · high confidence

Infrastructure service registration and health checks

The application now registers its core infrastructure services, including SQL Server and Redis-backed databases, repository patterns, identity management with JWT authentication, and health checks for both the database and memory cache.

src/Server/BookStore.Infrastructure · high confidence

Initial application layer scaffolding for identity and customer management

This change introduces the initial structure for the BookStore.Application layer, establishing the core application services and command/query handlers. It adds configuration for MediatR, AutoMapper, and event handlers, alongside identity commands for user login and registration (including validation). It also defines the initial customer management capabilities, including commands to edit customer profiles, queries to search and retrieve customer details, and an event handler that automatically creates a customer profile and shopping cart upon user registration.

(repo-wide) · high confidence

Initial implementation of the Author management API

This change introduces the complete application-layer support for managing authors within the BookStore catalog. Users can now create, edit, and delete authors, as well as search for them by name with pagination and retrieve detailed author information. The implementation includes command handlers for mutations, query handlers for data retrieval, validation rules for author names and descriptions, and the corresponding response models.

src/Server/BookStore.Application/Catalog/Authors · high confidence

Initial implementation of the book catalog data access layer

This change introduces the foundational infrastructure for the book catalog feature, adding Entity Framework Core configurations for Books and Authors, a dedicated DbContext interface, and repository implementations for querying and managing book and author data.

src/Server/BookStore.Infrastructure/Catalog · high confidence

Initial release of the BookStore Web API

This change introduces the complete web API layer for the BookStore application. It establishes the foundational infrastructure, including an abstract ApiController base class, a validation exception handling middleware, and dependency injection configuration for Swagger, FluentValidation, and JSON serialization. The API exposes RESTful endpoints for managing the catalog (Books and Authors), user identity (Login and Register), and sales operations (Customers, Orders, and Shopping Carts), with specific authorization rules applied to administrative and user-specific actions.

src/Server/BookStore.Web · high confidence

Initial release of the BookStore client application

The src/Client directory now contains the complete frontend for the BookStore application, introducing a React-based single-page application with Bootstrap UI, dark/light theme support, and JWT-based authentication. Users can browse and search books by title, genre, or author, view author details, and manage a shopping cart. The application includes a full administration interface for managing authors and books, as well as order management capabilities for authenticated users and administrators. The client is configured for Docker deployment using Nginx and includes comprehensive routing, protected routes, and toast notifications for user feedback.

src/Client · high confidence

Initial sales domain persistence and repository layer

This change introduces the foundational data access layer for the Sales module. It adds Entity Framework Core configuration classes (in \Configurations/\) to define the database schema for Address, Book, Customer, Order, OrderedBook, ShoppingCart, and ShoppingCartBook entities, including relationships and constraints. It also implements the corresponding repository classes (in \Repositories/\) that provide CRUD operations, specific queries (such as finding customers by user ID or retrieving shopping cart contents), and integration with AutoMapper for mapping domain models to response DTOs.

src/Server/BookStore.Infrastructure/Sales · high confidence

Initial server startup configuration and containerization

The BookStore server application is now fully bootstrapped with a standard ASP.NET Core startup structure. This includes a Program entry point configured with Serilog console logging, a Startup class that wires up domain, application, and infrastructure services, and enables Swagger, CORS, authentication, and health checks. The project is also ready for containerized deployment via a new Dockerfile based on .NET 7.0, with environment-specific configuration provided in appsettings and a .env file for local development secrets.

src/Server/BookStore.Startup · high confidence

Introduce soft delete support and domain event dispatching infrastructure

The BookStore application now supports soft deleting entities, automatically filtering them out from queries via a global EF Core query filter and recording the deletion timestamp in a new \DeletedOn\ column added to all domain tables. This is enabled by the \ModelBuilderExtensions\ in the infrastructure layer. Additionally, a new \EventDispatcher\ implementation has been added to the \Common\ area to handle domain events, allowing repositories to dispatch events upon saving changes, and a \BookStoreDbInitializer\ has been introduced to manage database migrations and seed an initial administrator user.

src/Server/BookStore.Infrastructure/Common · high confidence

New book catalog queries with search, details, and caching

The application now exposes structured queries for browsing and viewing books. Users can search the book catalog with filtering by title, price range, genre, and author, as well as sorting by title, price, or author; results are paginated. A dedicated query retrieves full book details, including quantity and description. Additionally, the default book listing is cached in memory to improve performance for unfiltered searches.

src/Server/BookStore.Application/Catalog/Books/Queries · high confidence

Order management commands and query handlers

This change introduces the application-layer logic for managing orders, including commands to create, cancel, and complete orders, as well as queries to retrieve order details, search orders, and list a user's own orders. The implementation leverages MediatR for command/query handling, integrates with domain repositories for data access, and defines response models for order listings and details.

src/Server/BookStore.Application/Sales/Orders · high confidence

Sales domain model and factory implementation

The Sales domain now includes core entity models for Books, Customers (with Address and PhoneNumber), Orders, and Shopping Carts, each with validation rules and state management. Factory classes (BookFactory, CustomerFactory, OrderFactory, ShoppingCartFactory) enforce required field constraints during object creation. Repository interfaces define data access contracts for these entities, and specification classes enable filtering orders by customer ID or name and customers by name.

src/Server/BookStore.Domain/Sales · high confidence

Shopping cart management commands and queries

This change introduces the application-layer commands and queries for managing a customer's shopping cart. Users can now add books to their cart, edit the quantity of existing items, and remove books. Additionally, new queries allow retrieving the full list of books currently in the cart (including title, price, and image) and counting the total number of items. These operations are implemented via MediatR handlers that interact with the domain repositories to persist changes or fetch data.

src/Server/BookStore.Application/Sales/ShoppingCarts · high confidence

Behavioural changes

Added event handlers for book creation, updates, and soft deletion

The application now includes dedicated event handlers to synchronize the sales book repository with domain events. When a book is created, the \BookCreatedEventHandler\ constructs the book entity and persists it. Updates to book details (title, price, quantity, image URL) are applied via \BookUpdatedEventHandler\, which retrieves the existing entity and updates its properties. Deletions are handled by \BookDeletedEventHandler\, which performs a soft delete by marking the book with a timestamp rather than removing it from the database.

src/Server/BookStore.Application/Sales/Books · high confidence

Introduce caching and soft-delete for book management

The application now caches book listings and details using in-memory storage, with cache keys defined in \BooksCacheConstants\ and invalidated during create, edit, and delete operations. Additionally, book deletion has been changed to a soft-delete mechanism that marks records as deleted via a timestamp rather than removing them immediately, ensuring data integrity while keeping the book hidden from listings.

src/Server/BookStore.Application/Catalog/Books/Commands · high confidence

Dependencies

Initial project scaffolding with .NET 7 and React dependencies

The repository now includes the foundational dependency manifests for both the client and server applications. The client (src/Client) is initialized with a React 18 stack, including react-router-dom, react-toastify, and testing libraries. The server (src/Server) is scaffolded on .NET 7.0, establishing a layered architecture (Domain, Application, Infrastructure, Web) with dependencies for Entity Framework Core, MediatR, FluentValidation, JWT authentication, and health checks.

(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 40 → 40 (-0.3)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 80 → 85 (+5.2)
  • Maturity 45 → 46 (+1.4)
  • Readiness 24 → 23 (-1.5)
  • Security 68 → 77 (+8.2)
  • Accessibility 46 → 50 (+4.2)

Resolved (64)

  • Coverage not measured — analyzer environment
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Duplicated block (11 lines × 2) (src/Server/BookStore.Application/Sales/Orders/Queries/Details/OrderedBookResponseModel.cs)
  • Duplicated block (14 lines × 2) (src/Server/BookStore.Infrastructure/Catalog/Repositories/BookRepository.cs)
  • Duplicated block (16 lines × 2) (src/Server/BookStore.Application/Sales/ShoppingCarts/Commands/AddBook/ShoppingCartAddBookCommand.cs)
  • Duplicated block (16 lines × 2) (src/Server/BookStore.Infrastructure/Sales/Configurations/OrderedBookConfiguration.cs)
  • Duplicated block (17 lines × 2) (src/Server/BookStore.Domain/Catalog/Models/Books/Book.cs)
  • Duplicated block (18 lines × 2) (src/Server/BookStore.Domain/Sales/Models/Orders/OrderedBook.cs)
  • Duplicated block (18 lines × 2) (src/Server/BookStore.Infrastructure/Catalog/Configurations/BookConfiguration.cs)
  • Duplicated block (23 lines × 2) (src/Server/BookStore.Domain/Catalog/Factories/Books/BookFactory.cs)
  • Duplicated block (24 lines × 2) (src/Server/BookStore.Domain/Catalog/Models/Books/Book.cs)
  • High CVE: [GHSA redacted] (src/Client/package-lock.json)
  • High CVE: [GHSA redacted] (src/Client/package-lock.json)
  • …and 44 more

New (106)

  • BooksList.BooksList (cognitive 28) (src/Client/src/pages/books/list/BooksList.tsx)
  • BooksList.BooksList (cyclomatic 27) (src/Client/src/pages/books/list/BooksList.tsx)
  • Coverage not measured — no coverage collector is wired up
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Critical CVE: [GHSA redacted] (src/Client/package-lock.json)
  • Documentation: no architecture or design documentation (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 2) (src/Server/BookStore.Application/Sales/Orders/Queries/Details/OrderedBookResponseModel.cs)
  • Duplicated block (12 lines × 8) (src/Server/BookStore.Domain/Catalog/Exceptions/InvalidAuthorException.cs)
  • Duplicated block (13 lines × 2) (src/Server/BookStore.Infrastructure/Catalog/Repositories/BookRepository.cs)
  • Duplicated block (14 lines × 2) (src/Server/BookStore.Domain/Sales/Models/Orders/OrderedBook.cs)
  • Duplicated block (15 lines × 2) (src/Server/BookStore.Application/Sales/ShoppingCarts/Commands/AddBook/ShoppingCartAddBookCommand.cs)
  • Duplicated block (15 lines × 2) (src/Server/BookStore.Infrastructure/Sales/Configurations/OrderedBookConfiguration.cs)
  • Duplicated block (25 lines × 2) (src/Server/BookStore.Domain/Catalog/Models/Books/Book.cs)
  • …and 86 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

kalintsenkov/BookStore 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 2f3ef6bf20a544a1a6925ae36dac79a3dfdff075 — 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.