Skip to content
CAI
Software that uses CAICheck a score

NilavPatel/Todo.CQRS

32.4

Weak · 8 November 2026

1.8k

lines of production code

C#

primary language

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a modular .NET application for managing todo items, built on an Event Sourcing architecture using EventStore for persistence. It exposes asynchronous REST APIs for creating, updating, completing, and querying todo items, while a background processor asynchronously consumes domain events to maintain SQL-based read models. The solution is structured into distinct modules and a shared framework to handle command dispatch, event projection, and infrastructure concerns.

Features

Added SQL schema for TodoItems table

A new SQL script (Database/todo.sql) has been added to the database layer. This script creates a 'Todo' database and a 'TodoItems' table containing columns for Id (uniqueidentifier), Version (int), Title (nvarchar), and IsComplete (bit). This provides the underlying storage structure for the Todo feature.

Database · high confidence

Added event handlers for Todo item domain and integration events

The application now includes handlers for Todo item lifecycle events. The \TodoItemEventHandler\ processes domain events (creation, completion status changes, title updates) by persisting the corresponding changes to the database via a unit of work. Additionally, a \TodoItemIntegrationEventHandler\ has been added to process integration events, currently implemented as a placeholder that delays processing.

Modules/Todo/Todo.Application/EventHandlers · high confidence

Introduce Todo background processor with EventStore and SQL connectivity

A new background processor service for the Todo module has been added, designed to consume events from an EventStore and persist read-model updates to a SQL Server database. The application initializes by registering framework services, connecting to the EventStore via TCP, and configuring a SQL Server context for data persistence, enabling asynchronous processing of Todo-related events.

Modules/Todo/Todo.BackgroundProcessor · high confidence

Removals

Removal of legacy CQRS and Event Sourcing infrastructure

The framework has removed its core Command Query Responsibility Segregation (CQRS) and Event Sourcing components, including the \AggregateHandler\, \BaseController\, \SaveEventsHandler\, \AggregateRepository\, and the \EventStoreContext\ (Entity Framework Core DbContext). This eliminates the built-in capability to persist domain events to a database and automatically publish them via the event bus, as well as the base controller abstraction for handling commands.

Todo.Framework · high confidence

Removal of legacy TodoItem command handler

The \TodoItemHandler\ class, which previously managed \CreateTodoItem\ and \MarkTodoItemAsComplete\ commands within the \Todo.Domain\ layer, has been removed. This change eliminates the specific command handling logic for these operations from the domain infrastructure.

Todo.Domain · high confidence

Architecture

Solution structure reorganized into modules and renamed projects

The solution has been restructured to support a modular architecture. Projects such as Todo.Webapi, Todo.Domain, Todo.Contracts, and Todo.Application are now nested under a Modules/Todo folder, while the shared infrastructure code has been moved to a top-level Framework project. Additionally, a new Todo.BackgroundProcessor project has been added, and the previous Todo.ReadModels and Todo.Projections projects have been replaced by Todo.Application.

(repo-wide) · high confidence

Behavioural changes

Async query support and new endpoint for completed items in Todo module

The TodoItemQueryController has been moved to the Modules/Todo location and updated to use asynchronous operations via the new IReadRepository interface, replacing the previous synchronous IBaseRepository. This change enables the controller to await database calls, improving responsiveness. Additionally, a new GET endpoint, GetCompletedTodoItems, has been added to retrieve only completed todo items using a specification filter.

Modules/Todo/Todo.Webapi/QueryControllers · high confidence

Framework refactored to Event Sourcing with EventStore and background processing

The Framework has been restructured to support an Event Sourcing architecture, replacing the previous SQL-based persistence with EventStore. This introduces an AggregateRepository that persists domain events and snapshots to EventStore, a SessionRepository for in-memory aggregate tracking, and a BackgroundEventProcessor that consumes events from EventStore streams and publishes them via an IntegrationEventBus. The framework now includes a CheckpointStore to track processing positions, a SnapshotStrategy for periodic state snapshots, and a unified Serializer for event data. Command and event handling have been updated to be fully asynchronous, and the RegistrarService now wires up these new components for dependency injection.

Framework · high confidence

Migrate Todo module to EventStore and automate handler registration

The Todo WebAPI now uses an EventStore for persistence instead of a standard SQL database, with the connection configured in appsettings.json. Startup logic has been refactored to replace manual service registrations with automated discovery: command and domain event handlers are now registered automatically from the 'Todo.Application' assembly, and framework services are initialized via a centralized registrar. This simplifies the configuration and ensures new handlers are picked up without manual DI setup.

Modules/Todo/Todo.Webapi · high confidence

New commands for uncompleting and updating todo items

The Todo module now supports marking items as incomplete and updating their titles. Two new command classes, MarkTodoItemAsUnComplete and UpdateTodoItemTitle, have been added alongside the existing MarkTodoItemAsComplete command. All three commands now include a Version property, enabling optimistic concurrency control to prevent race conditions when multiple users modify the same item. The UpdateTodoItemTitle command also accepts a Title string to set the new name.

Modules/Todo/Todo.Contracts · high confidence

Removal of legacy TodoItemProjection handler

The \TodoItemProjection\ class, which previously handled \TodoItemCreated\ and \TodoItemMarkedAsComplete\ events to update the read model, has been removed from the \Todo.Projections\ module. This change eliminates the specific projection logic for these events in this location.

Todo.Projections · high confidence

Todo API endpoints refactored to use asynchronous command execution

The TodoItem controller has been moved to the Modules/Todo structure and renamed to TodoItemCommandController. The implementation now uses asynchronous methods (Task\<ICommandResult\>) for all endpoints, calling SubmitAsync on the command bus instead of the synchronous Submit method. Additionally, two new endpoints have been added: MarkTodoItemAsUnComplete and UpdateTodoItemTitle, allowing users to unmark items as complete and update item titles.

Modules/Todo/Todo.Webapi/CommandControllers · high confidence

Todo command handling refactored to use session-based repository

The Todo application's command handling has been restructured to use a new \ISessionRepository\ abstraction instead of the previous unit-of-work pattern. The \TodoItemCommandHandler\ now manages persistence for creating, completing, uncompleting, and updating todo items through this session interface, which handles adding entities and committing changes. Additionally, the read-model context (\TodoContext\) has been moved into the \Modules/Todo/Todo.Application/ReadModels\ directory and its namespace updated to reflect this new module structure.

Modules/Todo/Todo.Application/CommandHandlers · high confidence

Todo items can now be uncompleted, have titles updated, and use snapshots

The Todo module now supports marking items as uncompleted and updating their titles, in addition to the existing ability to mark them as complete. These new actions trigger specific domain events (TodoItemMarkedAsUnComplete, TodoItemTitleUpdated) that update the item's state. Internally, the TodoItem aggregate has been refactored to use a snapshotting mechanism (SnapshotAggregateRoot) to optimize performance, and validation errors now throw specific DomainValidationException types instead of generic Exceptions.

Todo · high confidence

Dependencies

Project structure reorganization and dependency updates

The solution has been reorganized into a modular structure under a new 'Modules' directory, with the core 'Framework' project moved to the root level. Several projects were renamed or relocated (e.g., Todo.Projections to Todo.Application, Todo.ReadModels deleted) to better reflect their responsibilities. Dependencies were updated to .NET 5.0, with the Framework project adding EventStore.Client and Microsoft.Extensions packages, while other modules like Todo.Webapi and Todo.Application added Microsoft.EntityFrameworkCore.SqlServer. A package.json was introduced to simplify running and building the WebAPI and BackgroundProcessor services.

(dependencies) · high confidence

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

How this codebase got here

Score

  • CAI 33 → 32 (-0.1)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 58 → 58 (+0.0)
  • Architecture 67 → 67 (+0.0)
  • Maturity 46 → 46 (+0.0)
  • Readiness 14 → 14 (+0.0)
  • Security 36 → 36 (-0.3)
  • Domain Modelling 86 → 86 (+0.0)
  • Event-Driven 100 → 100 (+0.0)
  • Performance 85 → 85 (+0.0)

Resolved (9)

  • End-of-life runtime: .NET net5.0 (Framework/Framework.csproj)
  • Inconsistent capitalization in the 'UnComplete' suffix. The codebase uses 'UnComplete' (capital C) instead of the standard 'Uncomplete' or 'UnCompleted'. While consistent within these specific symbols, it is a non-standard compound word formation that differs from typical C# conventions (e.g., 'Uncompleted' or 'MarkAsComplete' with a past participle). However, since it is consistent across the three related symbols, this is a style choice rather than an inconsistency between different concepts. Correction: Upon closer inspection, 'MarkTodoItemAsUnComplete' is a verb phrase, while 'TodoItemMarkedAsUnComplete' is a noun/event name. The inconsistency is actually between 'UnComplete' (adjective/verb stem) and the expected 'Uncompleted' (past participle) for events, or 'MarkAsUncomplete'. But more critically, looking at 'TodoItemMarkedAsUnComplete' vs 'TodoItemCreated' (past participle), 'UnComplete' breaks the pattern. 'Created' is past tense, 'Marked' is past tense, but 'UnComplete' is not 'Uncompleted'.
  • Inconsistent spelling of 'Handlers' in namespace names. The command handler namespace uses 'CommandHanders' (missing 'd'), while the event handler namespaces use 'EventHanders' (also missing 'd'). While consistent with each other, both are misspelled compared to the standard English word 'Handlers' and the likely intended convention. Additionally, 'CommandHanders' vs 'EventHanders' suggests a systemic typo in the namespace definition.
  • Inconsistent spelling of 'Occurred'. The property 'OccuredOn' uses the incorrect spelling 'Occured' (missing one 'r'). The rest of the codebase does not show this error, making this an isolated typo.
  • Naming inconsistency: 'UnComplete' is not standard English terminology. The standard antonym for 'Complete' in this context is 'Incomplete' or 'Uncompleted'. 'UnComplete' reads as a typo or non-standard abbreviation.
  • Scanner failed to run — not a clean result
  • Scanner failed to run — not a clean result
  • Typo in the domain model class name: 'TodoItemSpanshot' is missing the 's' in 'Snapshot'. This creates a confusing divergence from the rest of the codebase which consistently uses 'Snapshot' (e.g., in Framework.Snapshotting namespace, ISnapshotRepository, SnapshotAggregateRoot, and method names like CreateSnapshot/RestoreFromSnapshot).
  • redundant comment (Framework/Repository/SpecificationEvaluator.cs)

New (8)

  • Documentation: no build, run or usage example (README.md)
  • Documentation: no map of the repository's parts (README.md)
  • End-of-life runtime: .NET net5.0 (Framework/Framework.csproj)
  • End-of-life runtime: .NET net5.0 (Modules/Todo/Todo.Application/Todo.Application.csproj)
  • End-of-life runtime: .NET net5.0 (Modules/Todo/Todo.BackgroundProcessor/Todo.BackgroundProcessor.csproj)
  • End-of-life runtime: .NET net5.0 (Modules/Todo/Todo.Contracts/Todo.Contracts.csproj)
  • End-of-life runtime: .NET net5.0 (Modules/Todo/Todo.Domain/Todo.Domain.csproj)
  • End-of-life runtime: .NET net5.0 (Modules/Todo/Todo.Webapi/Todo.Webapi.csproj)

API surface

  • Unchanged — 2 HTTP endpoints

Architecture

  • Unchanged — 3 containers · 2 contexts · 1 edges

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

Survey your own repository

NilavPatel/Todo.CQRS 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 8 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 8aafdc09bca8a438a12783a16711491cde7a0365 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-45ab2cab63de.