Skip to content
CAI
Software that uses CAICheck a score

iblazhko/cqrs-fsharp

57.9

Adequate · 22 September 2026

3.3k

lines of production code

F#

primary language

3

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a .NET 10-based inventory management service built on a CQRS and Event Sourcing architecture. It exposes a REST API and CLI interface to process commands for creating, renaming, and managing inventory items, while tracking asynchronous command processing status. The backend leverages Wolverine for message bus operations and MartenDB for persisting domain events and projected states, supported by in-memory adapters for testing.

Features

Add MartenDB event store adapter

Introduce a new MartenDB-based implementation of the event store, providing persistence for CQRS event streams. The adapter handles opening streams, retrieving and appending events, and managing session lifecycles, while leaving the 'Contains' and 'Delete' operations as unimplemented placeholders.

src/CQRS.Adapters.MartenDbEventStore · high confidence

Add in-memory and MartenDB projection store adapters

Introduced two new implementations of the CQRS projection store interface: an in-memory adapter for unit or behavioural tests, and a persistent adapter backed by MartenDB. The in-memory store uses a thread-safe dictionary to hold documents in process memory, making it suitable for single-process testing scenarios. The MartenDB adapter persists document envelopes with versioning and leverages the Marten document store for reliable storage. Both adapters implement the IProjectionStore and IProjectionDocumentCollection interfaces, enabling the application to switch between transient and persistent projection storage strategies.

src/CQRS.Adapters.InMemoryProjectionStore · high confidence

Added V1 DTOs for inventory management

Introduced new data transfer objects for the inventory domain, including commands (Create, Rename, Add/Remove Items, Deactivate) and events (Created, Renamed, Stock changes, Deactivated) to support the V1 API. The InventoryState DTO was also added to represent the serialized state of an inventory item, including its ID, name, stock quantity, and active status.

src/CQRS.DTO/V1 · medium confidence

Added configuration model for CQRS infrastructure settings

The CQRS.Configuration module now includes new F\# types for managing infrastructure settings, including database (Marten), message broker (RabbitMQ), and logging configurations. These models support loading settings from JSON, environment variables, and command-line arguments, and provide formatted string representations for diagnostics.

src/CQRS.Configuration · high confidence

Added in-memory event store and command processing status recording

Introduced an in-memory implementation of the event store adapter, suitable for unit or behavioral tests, which persists events in memory and supports locking and serialization. Additionally, added a service to record command processing status (tracking states like Processing, Completed, Rejected, or Failed) by writing to a projection store, enabling visibility into command lifecycle status.

src/CQRS.Adapters.InMemoryEventStore · high confidence

Added new view models for inventory projections

Introduced new view models for the inventory projection, including an InventoryCollection module defining the projection ID and an InventoryViewModel class exposing properties for inventory data such as ID, name, stock quantity, and active status.

src/CQRS.Projections.ViewModels · high confidence

Initial project scaffolding and build infrastructure

The repository was initialized with core project scaffolding and build infrastructure. This includes a PowerShell build script (build.ps1) that manages .NET 10 SDK builds, tests, and Docker Compose orchestration for PostgreSQL and RabbitMQ. The project structure enforces a CQRS + Event Sourcing architecture with a Functional Core/Imperative Shell design, utilizing MartenDB and Wolverine. Additionally, standard repository configuration files (.editorconfig, .gitattributes, .gitignore) and documentation (README, CLAUDE.md) were added to support development and CI workflows.

(repo-wide) · high confidence

Introduce CQRS API Host with .NET 10 and Wolverine integration

A new CQRS API Host application has been added, built on .NET 10 and exposing port 17322. The host is configured to connect to a PostgreSQL database and uses Wolverine for message bus communication via RabbitMQ, replacing the previous MassTransit-based implementation.

src/CQRS.API.Host · medium confidence

Introduce CQRS API with command processing status tracking

The CQRS.API module now exposes a REST interface for managing inventory entities (create, rename, add/remove items, deactivate) and querying their status. A new \CommandProcessingStatusViewModel\ and associated API endpoint (\/v1/commands/{id}\) allow users to track the processing status of commands, providing visibility into asynchronous command execution. The API routes are defined in \ApiRoutes.fs\, with handlers in \ApiHandlers.fs\ and \MessageBusHandlers.fs\ delegating to the message bus. The \AcceptedResponse\ type and \EntityId\ implementation support the new functionality.

src/CQRS.API · high confidence

Introduce CQRS Application Host as a .NET 10 containerized service

A new CQRS Application Host service has been added, exposing a .NET 10 containerized entry point that configures Wolverine-based message consumers (specifically for inventory commands and projections) and registers health check endpoints. The host is configured to connect to PostgreSQL and RabbitMQ, and exposes port 17321.

src/CQRS.Application.Host · high confidence

Introduce CQRS CLI tool for inventory management

A new command-line interface (CLI) tool is introduced to manage inventory operations via an API. The CLI provides commands to create, rename, add items to, remove items from, deactivate, and retrieve inventory records. It is built in F\# using the McMaster.Extensions.CommandLineUtils library and communicates with a backend service (defaulting to localhost:17322) through a dedicated API client module. Configuration is handled via appsettings.json, environment variables, and command-line arguments.

src/CQRS.CLI · high confidence

Introduce CQRS application layer for inventory management

The CQRS.Application module now provides the core application logic for managing inventory. This includes an ApplicationEnvironment to coordinate dependencies like the EventStore, MoonPhase service, and CommandProcessingStatusRecorder. The system processes inventory commands (create, rename, add/remove items, deactivate) by mapping DTOs to domain events, projecting state changes, and persisting events. A new EventStoreEventsPublisher handles publishing domain events to a message bus, and an InventoryEventStreamProjection manages state transitions. This establishes the foundation for command processing and event sourcing within the application layer.

src/CQRS.Application · medium confidence

Introduce CQRS architecture with Wolverine message bus and MartenDB persistence

The application now implements a Command Query Responsibility Segregation (CQRS) architecture, separating command and query paths. Message handling is powered by Wolverine, replacing previous messaging infrastructure, while event and projection storage is backed by MartenDB. The codebase is restructured into distinct layers including a CLI tool, API host, application logic, domain models, and various adapters for in-memory, MartenDB, and Wolverine-based message buses. Test coverage is expanded with architecture and domain tests.

(dependencies) · high confidence

Introduce CQRS domain and ports for event sourcing and projections

Added new files defining the core abstractions for a CQRS architecture, including DTOs for commands, events, and state, along with interfaces for an event store (IEventStore, IEventStreamSession, IEventSerializer) and a projection store (IProjectionStore, IProjectionDocumentCollection). These changes establish the contract layer for persisting and querying domain events and projected states, enabling implementations to plug in specific storage backends.

src/CQRS.Ports.EventStore · high confidence

Introduce CQRS infrastructure with Wolverine, Marten, and health checks

The CQRS infrastructure layer now provides the foundational services for the application, including a new command processing status recording service, a Marten-based event store and projection store, and a message bus implementation using Wolverine with RabbitMQ. Additionally, the system now includes health check configurations for PostgreSQL and RabbitMQ, along with an infrastructure wait policy to ensure dependencies are available at startup.

src/CQRS.Infrastructure · high confidence

Introduce Inventory domain model with CQRS structure

The CQRS.Domain module now includes a complete Inventory domain model, defining value types (PositiveInteger, String types, EmailAddress), an EntityId system, and the core Inventory aggregate. This adds the ability to create, rename, add/remove items from, and deactivate inventories, while tracking stock levels and handling specific business rules like preventing deactivation during a full moon or when stock is non-empty.

src/CQRS.Domain · high confidence

New C4 component diagram for command handling

A new C4 component diagram has been added to document the command handling flow, illustrating the interactions between the API, message bus (Wolverine), application layer (DTO handler, state projection, aggregate), and the event store adapter. The diagram details the sequence of events from receiving a command, through domain processing and state projection, to persisting events and publishing them back to the message bus.

doc/C4 · high confidence

New CQRS mapping layer for inventory domain

The CQRS mapping layer for the inventory domain has been introduced, providing bidirectional conversion between domain models and DTOs. This includes mappers for all inventory commands (Create, Rename, Add/Remove Items, Deactivate), events (Created, Renamed, Stock changes, Deactivated), and the current inventory state. The implementation uses a result-based error handling approach for deserialization and includes a central dispatcher for both commands and events.

src/CQRS.Mapping · high confidence

New inventory projection implementation

Added new files to handle inventory event projections, including a generic event DTO handler, a document ID mapper, and an inventory view model projection that maps inventory events to view model updates.

src/CQRS.Projections · high confidence

Behavioural changes

Introduce CQRS solution structure and .NET 10 target

The project has been reorganized into a new CQRS (Command Query Responsibility Segregation) solution, defined by the new \src/CQRS.slnx\ file which groups core, server, client, and infrastructure projects. Additionally, the solution's build configuration in \src/Directory.Build.props\ has been updated to target .NET 10.0, reflecting a significant framework upgrade.

src · high confidence

Migrate message bus and consumers from MassTransit to Wolverine

The application's messaging infrastructure has been replaced with the Wolverine framework. This introduces a new \WolverineMessageBusAdapter\ for publishing and sending commands, alongside dedicated consumer implementations for handling inventory commands and projecting inventory events. These changes update how the system processes messages and handles background tasks.

src/CQRS.Adapters.WolverineMessageBus, src/CQRS.Application.WolverineConsumers, src/CQRS.Projections.WolverineConsumers · high confidence

Test coverage

Added architecture tests to enforce layer dependencies; Added new test modules for API and projections; Added tests for the CQRS application's event store and session logic; Added unit tests for Inventory aggregate and event handling.

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

Lenses

  • Code Health 99 → 99 (+0.0)
  • Architecture 100 → 82 (-18.5)
  • Maturity 69 → 68 (-0.8)
  • Readiness 35 → 34 (-0.7)
  • Security 82 → 82 (+0.1)
  • Domain Modelling 100 → 100 (+0.0)
  • Event Sourcing 100 → 100 (+0.0)

Resolved (45)

  • Dependency hygiene not measured — no packages were read
  • Duplicated block (10 lines × 2) (src/CQRS.CLI/AddItemsToInventoryCommand.fs)
  • Duplicated block (11 lines × 2) (src/CQRS.CLI/DeactivateInventoryCommand.fs)
  • Duplicated block (12 lines × 2) (src/CQRS.Adapters.MartenDbProjectionStore/MartenDbProjectionStoreAdapter.fs)
  • Duplicated block (15 lines × 2) (src/CQRS.Adapters.InMemoryEventStore/InMemoryEventStoreAdapter.fs)
  • Duplicated block (15 lines × 2) (src/CQRS.Application.CommandProcessingStatusRecording/CommandProcessingStatusRecordingService.fs)
  • Duplicated block (6 lines × 2) (src/CQRS.Domain/InventoryAggregate.fs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Low coverage: AddItemsToInventory'.fs (CQRS.Mapping/AddItemsToInventory'.fs)
  • Low coverage: CreateInventory'.fs (CQRS.Mapping/CreateInventory'.fs)
  • Low coverage: DeactivateInventory'.fs (CQRS.Mapping/DeactivateInventory'.fs)
  • Low coverage: EntityId.fs (CQRS.EntityIds/EntityId.fs)
  • Low coverage: EventStoreEventsPublisher.fs (CQRS.Application/EventStoreEventsPublisher.fs)
  • Low coverage: IMoonPhaseService.fs (CQRS.Application/IMoonPhaseService.fs)
  • Low coverage: Inventory.fs (CQRS.Domain/Inventory.fs)
  • Low coverage: InventoryCommand'.fs (CQRS.Mapping/InventoryCommand'.fs)
  • Low coverage: InventoryCommandDtoHandler.fs (CQRS.Application/InventoryCommandDtoHandler.fs)
  • Low coverage: InventoryCreated'.fs (CQRS.Mapping/InventoryCreated'.fs)
  • …and 25 more

New (51)

  • CI installs an unverified third-party binary (.github/workflows/ci-workflow.yml)
  • 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) (src/CQRS.CLI/AddItemsToInventoryCommand.fs)
  • Duplicated block (14 lines × 2) (src/CQRS.Application.CommandProcessingStatusRecording/CommandProcessingStatusRecordingService.fs)
  • Duplicated block (5 lines × 2) (src/CQRS.Application.CommandProcessingStatusRecording/CommandProcessingStatusRecordingService.fs)
  • Duplicated block (6 lines × 2) (src/CQRS.Domain/InventoryAggregate.fs)
  • Duplicated block (6 lines × 3) (src/CQRS.API/ApiRoutes.fs)
  • Duplicated block (8 lines × 2) (src/CQRS.CLI/DeactivateInventoryCommand.fs)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Low coverage: src/CQRS.Application/EventStoreEventsPublisher.fs (src/CQRS.Application/EventStoreEventsPublisher.fs)
  • Low coverage: src/CQRS.Application/IMoonPhaseService.fs (src/CQRS.Application/IMoonPhaseService.fs)
  • Low coverage: src/CQRS.Application/InventoryCommandDtoHandler.fs (src/CQRS.Application/InventoryCommandDtoHandler.fs)
  • Low coverage: src/CQRS.Application/InventoryEventStreamDtoMapper.fs (src/CQRS.Application/InventoryEventStreamDtoMapper.fs)
  • Low coverage: src/CQRS.Application/InventoryEventStreamProjection.fs (src/CQRS.Application/InventoryEventStreamProjection.fs)
  • Low coverage: src/CQRS.DTO/Json.fs (src/CQRS.DTO/Json.fs)
  • …and 31 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

iblazhko/cqrs-fsharp 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 fd9a30b22e8d886135f25bc8adba794f3a704a36 — 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.