fals/cqrs-clean-eventual-consistency
42.8
Weak · 20 September 2026
2.3k
lines of production code
C#
primary language
4
measurements over time
What this system is
Ametista is a .NET 6 web service designed for managing credit cards and their associated financial transactions. It employs a CQRS architecture with separate write and read models, using SQL Server for transactional data and MongoDB for optimized read views. The system leverages RabbitMQ for asynchronous event handling and Redis for caching, ensuring reliable persistence and performance for card creation, listing, and transaction recording.
Features
Added persistence repositories for Cards and Transactions
New write-only repository implementations have been added for the Card and Transaction domain entities. These classes provide the underlying data access layer, enabling the application to persist, retrieve, update, and delete card and transaction records via the WriteDbContext.
src/Ametista.Infrastructure/Persistence/Repository · high confidence
Initial database schema for Cards and Transactions
The application now includes the initial Entity Framework Core migration to create the underlying database schema. This adds the 'Cards' table (storing card number, holder, and expiration date) and the 'Transactions' table (storing transaction details, charge amount, currency, and a reference to the associated card). This migration establishes the foundational data structure required for the card and transaction management features.
src/Ametista.Infrastructure/Migrations · high confidence
Initial domain model and infrastructure abstractions for Ametista.Core
This change introduces the core domain entities and supporting infrastructure interfaces for the Ametista application. It defines the \Card\ and \Transaction\ aggregates with their respective creation events (\CardCreatedEvent\, \TransactionCreatedEvent\) and validation logic, including a Luhn-algorithm check for card numbers. It also establishes the foundational DDD and CQRS abstractions: shared interfaces for caching (\ICache\), event bus/dispatching (\IEventBus\, \IEventDispatcher\, \IEventHandler\), persistent connections (\IPersistentConnection\), and write-only repositories (\IWriteOnlyRepository\). Configuration is centralized in \AmetistaConfiguration\, exposing connection strings for SQL Server, MongoDB, RabbitMQ (EventBus), and Redis Cache.
src/Ametista.Core · high confidence
Initial project scaffolding with Docker Compose support
The application is now packaged with Docker support, allowing users to run the entire stack via Docker Compose. This includes the API service along with its required dependencies: SQL Server, MongoDB, RabbitMQ, and Redis, all configured in a single compose file for local development and testing.
src · high confidence
Initial release of the Ametista.Api service with Docker support
The Ametista.Api project is introduced as a new ASP.NET Core 6.0 web service, providing the entry point for the application. It includes a Dockerfile for containerization, configuration files for development and Docker environments, and a startup configuration that registers Autofac for dependency injection, SQL Server and Redis health checks, Swagger UI for API documentation, and an event bus subscription for card and transaction events.
src/Ametista.Api · high confidence
Introduces CQRS read-side infrastructure with materialized views and caching
The \src/Ametista.Query\ module now provides the read-side architecture for the application, implementing a Command Query Responsibility Segregation (CQRS) pattern. This includes abstractions for queries and handlers, a \ReadDbContext\ connecting to MongoDB, and specific materialized views (\CardViewMaterializedView\, \CardListMaterializedView\, \TransactionListMaterializedView\) to optimize read performance. Event handlers automatically update these views when cards or transactions are created, and query handlers for retrieving card and transaction lists now support caching via an \ICache\ service to reduce database load.
src/Ametista.Query · high confidence
Introduction of Redis-based caching implementation
The application now supports Redis as a caching backend through the new \RedisCache\ class, which implements the \ICache\ interface. This change enables caching for operations such as retrieving card lists, allowing data to be stored and retrieved from a Redis instance for improved performance. The implementation handles serialization, key generation with parameters, and includes logging for error tracking.
src/Ametista.Infrastructure/Cache · high confidence
Introduction of command, event, and query dispatchers
The application now includes infrastructure dispatchers for commands, events, and queries, enabling the routing of these operations to their respective handlers via dependency injection. CommandDispatcher handles both result-returning and non-result commands, EventDispatcher routes events to handlers, and QueryDispatcher executes queries, all leveraging Autofac for handler resolution.
src/Ametista.Infrastructure/Dispatchers · high confidence
New WriteDbContext for Card and Transaction persistence
A new WriteDbContext has been introduced to handle write operations for Card and Transaction entities. This context configures database mappings for the Cards and Transactions tables, explicitly ignoring the 'Valid' property on both entities, and defines the structure for the nested Charge object within Transaction, mapping its CurrencyCode and Amount properties.
src/Ametista.Infrastructure/Persistence · high confidence
Behavioural changes
Introduction of RabbitMQ-based event bus with persistent connections
The system now uses RabbitMQ as the underlying transport for its event bus, replacing the previous implementation. This change introduces a new \RabbitMQEventBus\ and \RabbitMQPersistentConnection\ that handle message publishing and consumption via a dedicated exchange and queue. Key behavioral updates include the use of persistent message delivery (delivery mode 2) to ensure messages survive broker restarts, automatic retry logic with exponential backoff for connection and publishing failures, and a custom JSON serializer configuration that explicitly includes private properties during serialization. The event bus also implements a subscription manager to ensure only events of the correct type are dispatched to subscribers.
src/Ametista.Infrastructure/Bus · high confidence
Migrate API from single controller to dedicated endpoint files
The API implementation in \src/Ametista.Api/Endpoints\ has been refactored from a single monolithic controller into distinct, feature-specific endpoint classes (e.g., \CreateCardEndpoint\, \GetCardListEndpoint\). This change reorganizes the existing card and transaction management capabilities—creation, listing, and viewing—into separate files to improve code structure and maintainability, without altering the underlying business logic or external API contracts.
src/Ametista.Api/Endpoints · high confidence
Structured dependency injection for command, query, event, and infrastructure modules
The IoC configuration has been refactored into four distinct Autofac modules to organize service registration. CommandModule registers command handlers, the command dispatcher, and specific write-only repositories (CardWriteOnlyRepository, TransactionWriteOnlyRepository). QueryModule registers query handlers, the query dispatcher, the read database context, and specific materializers for card and transaction list queries. EventModule registers event handlers (including MaterializeCardEventHandler and TransactionCreatedEventHandler), the event dispatcher, and the read database context. InfrastructureModule registers core infrastructure services including the RabbitMQ persistent connection, Redis cache, and RabbitMQ event bus.
src/Ametista.Infrastructure/IoC · high confidence
Test coverage
Added unit and integration tests for card and transaction features
Added comprehensive test coverage for the card and transaction domains, including unit tests for the CreateCard and CreateTransaction command handlers, endpoint tests for the CreateCard API, and integration tests using an in-memory SQLite database. The changes also introduce test helpers such as builders, mother objects, and fake implementations for caching and event bus dependencies to support these new tests.
src/Ametista.UnitTest · high confidence
Dependencies
Upgrade to .NET 6 and update core dependencies
The project has been upgraded to target .NET 6.0 across all components (Api, Command, Core, Infrastructure, Query, and UnitTest). This update includes aligning Microsoft.Extensions packages, Entity Framework Core, and ASP.NET Core MVC testing libraries to version 6.0.7. Additionally, several infrastructure dependencies have been updated or added, including MongoDB.Driver to 2.19.0, Autofac to 6.4.0, RabbitMQ.Client to 6.4.0, StackExchange.Redis to 2.6.48, and Newtonsoft.Json to 13.0.2. Health check packages for SQL Server, MongoDB, Redis, and RabbitMQ are now included in the API project.
(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 46 → 43 (-3.3)
- Rubric changed (rubric-2026.08.18 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 57 → 56 (-0.4)
- Architecture 82 → 82 (+0.0)
- Maturity 60 → 60 (+0.0)
- Readiness 56 → 57 (+0.9)
- Security 30 → 23 (-7.3)
- Event-Driven 77 → 77 (+0.0)
Resolved (24)
- Bounded contexts not declared
- High CVE: MessagePack 2.1.152
- High CVE: MessagePack 2.1.152
- High CVE: NuGet.Protocol 5.11.0
- High CVE: NuGet.Protocol 5.11.0
- High: security finding (details withheld)
- High: security finding (details withheld)
- Low CVE: NuGet.Protocol 5.11.0
- Medium CVE: Azure.Identity 1.3.0
- Medium CVE: Azure.Identity 1.3.0
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- Medium CVE: MessagePack 2.1.152
- …and 4 more
New (23)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- End-of-life runtime: .NET net6.0
- High CVE: MessagePack 2.1.152
- High CVE: NuGet.Protocol 5.11.0
- High IaC: WD-COMPOSE-0002 (src/docker-compose.yml)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Medium IaC: WD-COMPOSE-0002 (src/docker-compose.yml)
- Medium IaC: WD-COMPOSE-0002 (src/docker-compose.yml)
- Medium IaC: WD-COMPOSE-0002 (src/docker-compose.yml)
- Medium IaC: WD-DOCKER-0003 (src/Ametista.Api/Dockerfile)
- Medium IaC: WD-DOCKER-0003 (src/Ametista.Api/Dockerfile)
- Medium: security finding (details withheld)
- Medium: security finding (details withheld)
- Medium: security finding (details withheld)
- No dependency advisory monitoring
- The property 'Data' on 'TransactionCreatedEvent' is a generic payload container. While not strictly inconsistent, it lacks the semantic precision found elsewhere in the codebase (e.g., 'UniqueId', 'CardHolder', 'ExpirationDate'). However, since 'Data' is a common convention for event payloads and no alternative specific name is used for other events in this sample, it is not flagged as a naming inconsistency between concepts.
- Workflow token permissions not restricted
- WriteOnlyPrivateField (src/Ametista.Query/EventHandlers/CardCreatedEventHandler.cs)
- …and 3 more
API surface
- Unchanged — 5 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
fals/cqrs-clean-eventual-consistency 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 e4e1be8e737f1e9b4de172169a7f333aeec86f8d — 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.