tourem/bookstore-cqrs-example
43.6
Weak · 22 September 2026
2.2k
lines of production code
Java
primary language
6
measurements over time
What this system is
This system is a distributed e-commerce platform built on a CQRS architecture, separating command and query responsibilities across distinct bounded contexts. It manages the full lifecycle of orders, shopping carts, and product catalogs through dedicated services that expose REST APIs for client interaction. The architecture leverages event-driven patterns, using domain events and sagas to coordinate state changes and maintain read models for reporting.
Features
Added REST API for order management
A new OrderResource class has been introduced to expose order-related endpoints. It provides POST endpoints for placing orders and activating existing orders, mapping incoming requests to internal commands via a CommandFactory and dispatching them through the CommandBus.
order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/resource · high confidence
Added order query and read-model infrastructure
The order-query module now includes a complete read-model stack for orders. This adds an in-memory projection repository, denormalizer, and aggregator that listen to order events to maintain up-to-date order lists and daily sales counts. A new REST resource exposes endpoints for retrieving all events, the full order list, and orders-per-day statistics, allowing users to query order data directly.
order-context-parent/order-query · high confidence
Added publisher contract management capabilities
Users can now register new publisher contracts and record purchases against them. This introduces a new REST endpoint at /publisher-contract-requests to create contracts, and tracks the accumulated fees for each publisher, capping the total fees at a defined limit.
order-context-parent/publisher-contract-command · high confidence
Introduce PurchaseRegistrationSaga for order activation
A new saga, PurchaseRegistrationSaga, has been added to the order context to handle the processing of OrderActivatedEvent. Upon receiving the event, the saga queries the order details and iterates through each order line to publish a corresponding RegisterPurchaseCommand to the publisher contract, enabling the system to track purchases per product.
order-context-parent/sagas · high confidence
Introduce core CQRS and Saga abstractions
Added the foundational classes for the command-side of the application. This includes the abstract Command base class providing standard object identity methods, the CommandBus interface for dispatching commands and registering handlers, the CommandHandler marker interface, and the abstract Saga class implementing DomainEventListener with replay support disabled.
cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/command, cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/saga · high confidence
Introduce core CQRS eventing infrastructure
Added the foundational classes for the application's event-driven architecture. This includes the DomainEvent base class, which standardizes aggregate ID, version, and timestamp, along with the DomainEventBus and DomainEventListener interfaces for publishing and subscribing to domain events, and the DomainEventStore interface for persisting and retrieving event streams.
cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/event · high confidence
Introduce product catalog service with REST API
The product-catalog-context now includes a new service built on Dropwizard, exposing a REST API for managing products and books. The service provides endpoints to create, retrieve, and list products, with an in-memory repository for data storage. A configuration file (dev.yml) sets up HTTP and admin connectors, logging, and CORS headers. The API includes DTOs for books and products, a factory for mapping domain objects to DTOs, and a resource class handling the HTTP requests. Tests verify the resource's behavior, and a test client and data importer are provided for manual testing.
product-catalog-context · high confidence
Introduces CQRS domain base classes for aggregates and repositories
The domain layer now includes an \AggregateRoot\ base class that automatically manages uncommitted events, versioning, and timestamps, while allowing optional event handlers. A \Repository\ interface is added to support loading and saving aggregate roots, and a \ValueObject\ base class provides standard equality and hashing behavior. These changes establish the foundational structure for implementing CQRS aggregates within the bookstore domain.
cqrs-lib/src/main/java/se/citerus/cqrs/bookstore/domain · high confidence
Introduces publisher contract domain events and identifiers
New domain event classes and identifiers have been added to the publisher contract module. Specifically, the codebase now includes \PublisherContractId\ and three new domain events: \PublisherContractRegisteredEvent\, \PurchaseRegisteredEvent\, and their associated structures. These changes define the data contracts for publisher-related events, including fields for publisher name, fee percentages, limits, and accumulated fees, facilitating the tracking of purchase and fee data within the order context.
order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/publishercontract · high confidence
Launched the shopping context as a standalone application
The shopping context has been extracted into its own application, exposing a REST API for managing shopping carts. Users can now create carts, add items, and view cart details via the new CartResource endpoints. The implementation includes domain models for carts and line items, an in-memory repository for cart persistence, and a client for the product catalog service.
shopping-context · high confidence
Order application bootstrapped with in-memory infrastructure and admin UI
The order application module now includes a complete runtime setup using the Dropwizard framework, featuring an in-memory domain event store and a file-based event store for persistence. It registers command and domain event buses, sets up REST resources for orders and publisher contracts, and exposes an admin interface (admin.html) for viewing and activating orders. Additionally, a task is provided to replay domain events, and test utilities are included for importing publisher contract data.
order-context-parent/order-application · high confidence
Behavioural changes
Added JSON serialization support for order events
New event classes, OrderActivatedEvent and OrderPlacedEvent, have been introduced in the eventbus contract. These classes extend DomainEvent and include Jackson @JsonProperty annotations on their constructor parameters, enabling proper serialization of order events for the event bus.
order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/event · medium confidence
Introduced new value objects for order context
The order context now includes new value objects: BookId, OrderId, ProductId, CustomerInformation, OrderLine, and OrderStatus. These classes define the structure for order-related data, including customer information, order lines with product details, and order status enumeration. The introduction of these value objects supports the separation of value objects from transfer objects in the system architecture.
order-context-parent/eventbus-contract/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order · high confidence
Introduction of ID validation and transport object 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 standardizes equality, hash code, and string representation for transport objects.
cqrs-lib/src/main/java/se/citerus/cqrs/bookstore · medium confidence
New API request and DTO classes for order processing
Added new API classes to support order management: ActivateOrderRequest for activating orders, PlaceOrderRequest for placing orders with customer and cart details, and DTOs (CartDto, LineItemDto) to represent cart and line item data. These classes introduce validation constraints (NotEmpty, Pattern, Min, NotNull) for order IDs, customer information, and cart contents.
order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/api · high confidence
New command objects and handlers for order placement and activation
The order context now introduces specific command classes (PlaceOrderCommand, ActivateOrderCommand) and a corresponding handler (OrderCommandHandler) to process order placement and activation requests. The CommandFactory maps incoming API requests (PlaceOrderRequest, ActivateOrderRequest) into these domain commands, ensuring that customer information, order lines, and total amounts are correctly transferred to the domain layer for processing.
order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/command · high confidence
Refactored order domain into new ValueObjects and an Order aggregate
The order context's domain model has been restructured to use explicit ValueObjects for customer and line item data. A new \CustomerInformation\ class now holds customer name, email, and address, while \OrderLine\ encapsulates product details. The \Order\ aggregate has been updated to accept these new types, and the \place\ method now accepts a \totalAmount\ directly from the cart's total price.
order-context-parent/order-command/src/main/java/se/citerus/cqrs/bookstore/ordercontext/order/domain · medium confidence
Test coverage
Added unit and integration tests for the Order domain and resource layer
Added new test classes for the Order domain (OrderTest) and the Order resource (OrderResourceTest). The domain tests verify order placement, activation, and event generation, while the resource tests validate the HTTP endpoint for creating orders using mocked dependencies.
order-context-parent/order-command/src/test · high confidence
Dependencies
Maven build structure and dependency management
The project now uses a multi-module Maven structure with a parent POM that defines a centralized dependency management section. This includes specific versions for Dropwizard (1.2.2), JUnit (4.12), Mockito (2.15.0), and other libraries, ensuring consistent dependency versions across all submodules like order-context-parent, shopping-context, and product-catalog-context.
(dependencies) · medium 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 (8)
- 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
- 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
tourem/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.