Skip to content
CAI
Software that uses CAICheck a score

mrh-jishan/bookstore-cqrs-example

43.6

Weak · 22 September 2026

2.2k

lines of production code

Java

primary language

6

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a distributed bookstore application built on a CQRS (Command Query Responsibility Segregation) architecture, separating command and query models. It manages three primary business contexts: a product catalog for browsing books, a shopping cart for managing user selections, and an order processing system that handles order placement, activation, and publisher fee tracking. The architecture leverages domain events and sagas to coordinate state changes across these contexts, supported by in-memory persistence and RESTful APIs for both user interaction and administrative monitoring.

Features

Added PurchaseRegistrationSaga to handle order activation and purchase registration

A new saga, PurchaseRegistrationSaga, has been introduced to manage the flow when an order is activated. Upon receiving an OrderActivatedEvent, the saga queries for order details, looks up the associated PublisherContractId for each line item, and dispatches a RegisterPurchaseCommand to the command bus. This change implements the integration between the order context and the publisher contract context.

order-context-parent/sagas · high confidence

Added REST API for order management

A new RESTful resource, OrderResource, has been introduced to handle order-related requests. It exposes two POST endpoints: one for placing orders and another for activating them. The resource leverages a CommandBus to dispatch corresponding commands, effectively bridging the HTTP layer with the application's command handling logic.

order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/resource · high confidence

Added order query service and read models

Introduced a new query service and associated read models to support querying order data. This includes an in-memory order projection repository, denormalizer for order events, and an aggregator for daily order counts. The QueryResource exposes endpoints to retrieve all events, a list of orders, and daily order counts, enabling users to view order statuses and sales metrics.

order-context-parent/order-query · high confidence

Added publisher contract registration and purchase tracking

Users can now register a new publisher contract and track associated purchase fees. This change introduces the command and domain logic for registering a publisher contract (including fee percentage and limit) and recording purchases against it, with the system automatically calculating and capping the accumulated fees based on the defined limits.

order-context-parent/publisher-contract-command · high confidence

Introduce core domain event infrastructure

Added the foundational classes for the application's event-driven architecture. This includes the DomainEvent base class, which standardizes event properties (aggregate ID, version, timestamp) and serialization; the DomainEventBus interface for publishing and replaying events; the DomainEventListener interface for handling events; and the DomainEventStore interface for persisting and loading event streams. These components establish the core mechanism for domain event handling within the bookstore module.

cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/event · high confidence

Introduce in-memory event store and admin UI for the Order application

The order application now supports an in-memory domain event store implementation (InMemoryDomainEventStore) alongside a file-based alternative (SimpleFileBasedEventStore), allowing developers to run the system without external persistence dependencies. Additionally, a new admin interface (admin.html) is served to display order lists and domain events, and a task is added to manually replay events, facilitating easier debugging and testing of the order context.

order-context-parent/order-application · high confidence

Introduce product catalog service with REST API

The product-catalog-context now provides a new service for managing product and book data. This includes a RESTful API (ProductResource) that supports creating and retrieving products and their associated book details. The implementation uses an in-memory repository for storage and includes configuration for server ports, logging, and CORS headers. Test coverage is provided via unit tests for the resource and a data importer for loading test data.

product-catalog-context · high confidence

Introduces core CQRS domain abstractions

The domain layer now provides a base \AggregateRoot\ class that automatically manages uncommitted events, versioning, and timestamps, while allowing optional event handlers via reflection. A \Repository\ interface is introduced to handle saving and loading aggregates, and a \ValueObject\ base class is added to provide standard \equals\, \hashCode\, and \toString\ implementations for value objects.

cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/command, cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/saga, cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/domain · high confidence

New shopping context with cart management and frontend

The shopping context is now a standalone application that allows users to create and manage shopping carts. It exposes a REST API for adding items, retrieving cart details, and clearing carts, backed by an in-memory repository. The application includes a web interface for browsing books, adding them to the cart, and placing orders. Tests have been added to verify cart domain logic and resource behavior.

shopping-context · high confidence

Behavioural changes

Add Jackson serialization annotations to order domain events

The OrderActivatedEvent and OrderPlacedEvent classes in the eventbus-contract module now include @JsonProperty annotations on their constructor parameters. This change ensures that the JSON serialization of these domain events uses explicit property names (such as 'aggregateId', 'version', 'timestamp', 'customerInformation', 'orderLines', and 'orderAmount') during message bus communication, improving consistency and reliability of event data across the system.

order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event · medium confidence

Added API request and DTO classes for order and cart operations

New API classes have been introduced in the order context to support order and cart interactions. This includes \ActivateOrderRequest\ and \PlaceOrderRequest\ for handling order-related commands, alongside data transfer objects \CartDto\ and \LineItemDto\ to represent cart and line item data. These additions provide the necessary data structures for processing orders and managing cart state within the application.

order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/api · high confidence

Introduces GenericId and TransportObject base classes

The codebase now includes a GenericId class that enforces a specific regex pattern for ID validation, alongside a new TransportObject abstract class that provides standard equals, hashCode, and toString implementations for use across the application.

cqrs-lib/src/main/java/se/citerus/cqrs/bookstore · medium confidence

Introduces new command classes for order placement and activation

The order context now includes new command classes (PlaceOrderCommand, ActivateOrderCommand) and their corresponding handler (OrderCommandHandler) to process order placement and activation requests. The command factory maps DTOs to these commands, extracting customer information, order lines, and total amount. This represents a structural change in how order commands are handled within the system.

order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/command · high confidence

New publisher contract event models and ID class

Added new domain event classes for the publisher contract: PublisherContractId, PublisherContractRegisteredEvent, and PurchaseRegisteredEvent. These classes define the structure for publisher registration and purchase events, including fields for publisher name, fee percentage, limits, and accumulated fees, with Jackson annotations for serialization.

order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract · medium confidence

Refactored order domain into ValueObjects and AggregateRoot base

The order domain model was restructured to improve modularity and consistency. CustomerInformation and OrderLine were converted into ValueObjects, separating their data-carrying roles from the main Order aggregate. The Order class now extends AggregateRoot, centralizing version, timestamp, and ID management, while the Order class itself was restructured to handle order placement and activation events more cleanly. This change simplifies the domain model by leveraging value objects for immutable data and using a common base class for aggregate state management.

order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/domain · medium confidence

Refined order context data models with explicit JSON serialization

The order context now uses dedicated value objects for identifiers (BookId, OrderId, ProductId) and structured TransferObjects for CustomerInformation and OrderLine. Each class includes Jackson @JsonProperty annotations to ensure consistent field names in serialized payloads, and the OrderStatus enum defines the possible states (ACTIVATED, PLACED).

order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order · medium confidence

Test coverage

Added unit tests for Order domain and OrderResource

Added new test classes for the Order domain logic and the OrderResource API endpoint. The OrderTest class verifies order placement, activation, and event generation, while OrderResourceTest validates the HTTP endpoint for creating orders using mocked dependencies.

order-context-parent/order-command/src/test · high confidence

Dependencies

Migrate to Dropwizard 1.2.2 and Java 8

The project has been upgraded to use Dropwizard version 1.2.2 and is now built with Java 8. This update ensures compatibility with the latest stable release of the framework and modernizes the Java runtime requirements for all modules.

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

Lenses

  • Code Health 99 → 99 (-0.3)
  • Architecture 100 → 90 (-10.3)
  • Maturity 64 → 43 (-21.1)
  • Readiness 39 → 32 (-7.3)
  • Security 100 → 82 (-18.0)
  • Domain Modelling 100 → 100 (-0.0)
  • Accessibility 37 → 38 (+0.5)

Resolved (9)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • Duplicated block (6 lines × 2) (order-context-parent/order-application/src/main/java/se/citerus/cqrs/bookstore/ordercontext/application/OrderApplication.java)
  • Duplicated block (9 lines × 2) (order-context-parent/publisher-contract-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/command/RegisterPublisherContractCommand.java)
  • No exposed public API
  • No setup or build/run instructions for local development. (README.md)
  • Scanner failed to run — not a clean result
  • Test reliability not included
  • dormant codebase — no living knowledge left to concentrate

New (25)

  • Dependency hygiene PARTLY measured — Maven/Gradle declarations read, no dependency graph resolved
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (12 lines × 2) (order-context-parent/order-query/src/main/java/se/citerus/cqrs/bookstore/ordercontext/client/productcatalog/ProductCatalogClient.java)
  • Duplicated block (23 lines × 2) (cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/TransportObject.java)
  • Duplicated block (27 lines × 2) (cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/command/Command.java)
  • Duplicated block (7 lines × 2) (order-context-parent/order-application/src/main/java/se/citerus/cqrs/bookstore/ordercontext/application/OrderApplication.java)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)
  • No ADRs found
  • No assertions: cannotPlaceAnOrderTwice (order-context-parent/order-command/src/test/java/se/citerus/cqrs/bookstore/ordercontext/order/domain/OrderTest.java)
  • No assertions: feeCannotBeNegative (order-context-parent/publisher-contract-command/src/test/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/domain/AccumulatedFeeTest.java)
  • No assertions: requireOrderLinesWhenPlacingAnOrder (order-context-parent/order-command/src/test/java/se/citerus/cqrs/bookstore/ordercontext/order/domain/OrderTest.java)
  • No assertions: shouldClearCart (shopping-context/src/test/java/se/citerus/cqrs/bookstore/shopping/resource/CartResourceTest.java)
  • No assertions: testCannotRegisterTwice (order-context-parent/publisher-contract-command/src/test/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract/domain/PublisherContractTest.java)
  • …and 5 more

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

Survey your own repository

mrh-jishan/bookstore-cqrs-example 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 22 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 224aac68e1ef616a2a57f71d5de550960f96fabf — 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-821afab8930d.