Skip to content
CAI
Software that uses CAICheck a score

yasiekz/payments-DDD-ES-tutorial

62.9

Adequate · 20 September 2026

1.5k

lines of production code

PHP

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Symfony 4 application built on a CQRS and Event Sourcing architecture, using MongoDB as the persistent event store. It models core financial domain logic, specifically managing account balances with currency validation and processing payments through a defined lifecycle of creation, confirmation, and cancellation. The codebase includes infrastructure for command routing, event persistence, and data fixtures to support development and testing of these domain aggregates.

Features

Added MongoDB data fixtures for account balances and payments

New data fixtures have been added to the \src/DataFixtures/MongoDB\ directory to populate the MongoDB database with test data. \BalanceFixtures\ seeds three account balances (PLN 100,000, PLN 20,000, and PLN 0) by persisting \AccountBalanceCreated\ events. \PaymentFixtures\ depends on the balance fixtures and seeds two payment scenarios by persisting \PaymentCreated\ and \PaymentConfirmed\ events. Both classes are marked with \@codeCoverageIgnore\ to exclude them from code coverage reports, as they are infrastructure fixtures rather than testable business logic.

src/DataFixtures · high confidence

Added Symfony 4 application entry points

The project now includes the standard Symfony 4 front controller (public/index.php) and console application (bin/console). These files initialize the application kernel, load environment variables via Dotenv, configure trusted proxies and hosts, and enable debug mode when appropriate, establishing the runtime entry points for the web and CLI interfaces.

bin, public · high confidence

Initial CQRS command bus and MongoDB event store infrastructure

The application now includes a Command Bus implementation within the CQRS layer, featuring a command dispatcher, handler manager, and associated interfaces to route commands to their respective handlers. Additionally, an event sourcing infrastructure has been added using MongoDB via Doctrine ODM; this includes an Event document model and a MongoEventRepository that persists domain events as JSON and loads them back for state reconstruction.

src/Infrastructure · high confidence

Initial Symfony configuration for MongoDB-backed CQRS architecture

This change introduces the foundational configuration for a Symfony application structured around Command Query Responsibility Segregation (CQRS) and Event Sourcing. It registers the Doctrine MongoDB Bundle to connect to a MongoDB instance via environment variables, sets up routing to load controllers via annotations, and defines the service container wiring. Specifically, it configures the infrastructure layer by registering the MongoDB event repository, a command bus, and a command handlers manager, while also wiring domain repositories (such as account balance and payment repositories) to depend on these infrastructure services.

config · high confidence

Initial project scaffolding with Docker, Symfony 4, and MongoDB Event Sourcing

This change introduces the foundational infrastructure for a Symfony 4 application utilizing Domain-Driven Design and Event Sourcing. It establishes a fully containerized development environment via Docker Compose, separating test and production networks, and configures the application to use MongoDB as the event store. The update includes the necessary configuration files (.env.dist, phpunit.xml.dist), CI integration with Travis CI and Codecov, and a Dockerfile that installs the required PHP MongoDB extension, enabling local development and automated testing of the payment and account balance domain logic.

(repo-wide) · high confidence

Introduction of Symfony Kernel for application bootstrapping

The application now includes a Kernel class that handles the core bootstrapping process, including bundle registration, container configuration, and route loading. This change establishes the foundational structure for the Symfony framework integration, enabling the application to manage its dependencies and routing configuration through the standard Symfony lifecycle.

src · high confidence

Introduction of event-sourced domain models for accounts, payments, and users

The domain layer now implements core business capabilities using an event-sourcing architecture. Account balances are managed via the AccountBalance aggregate, which records events for creation, deposits, and withdrawals, enforcing currency consistency and sufficient funds through dedicated assertion classes. Payment processing is handled by the Payment aggregate, supporting a lifecycle of creation, confirmation (with code verification), and cancellation, while the PaymentFactory ensures source account validity before initiating transfers. Additionally, the User aggregate now models customer profiles with address details and postcode validation. These aggregates rely on shared infrastructure including the EventSourceTrait for state management, DomainEvent definitions, and repository interfaces for persisting and loading event streams.

src/Domain · high confidence

Test coverage

Initial unit and integration tests for core domain and infrastructure

Added comprehensive test coverage for the application's core domain entities and infrastructure components. This includes unit tests for Account Balance logic (creation, deposits, withdrawals, currency validation), Payment lifecycle (creation, confirmation, cancellation, code validation), and User/Address models. It also covers the CQRS Command Bus and Handler Manager, and adds an integration test for the MongoDB Event Store to verify event persistence and retrieval.

tests · high confidence

Dependencies

Initial project setup with Symfony 4 and MongoDB ODM

This change introduces the initial dependency configuration for the project via a new composer.json and composer.lock file. It establishes a Symfony 4 LTS foundation (including framework-bundle, console, yaml, and flex) and integrates MongoDB support through the alcaeus/mongo-php-adapter and doctrine/mongodb-odm-bundle packages. Additional dependencies include moneyphp/money for currency handling, ramsey/uuid for identifier generation, and doctrine/doctrine-fixtures-bundle for development data seeding, alongside PHPUnit for testing.

(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

Score

  • CAI 66 → 63 (-2.8)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 100 → 100 (-0.3)
  • Architecture 69 → 69 (+0.0)
  • Maturity 90 → 90 (+0.0)
  • Readiness 46 → 43 (-2.7)
  • Security 97 → 84 (-12.2)
  • Domain Modelling 100 → 93 (-7.1)
  • Event Sourcing 100 → 100 (+0.0)

Resolved (7)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — no supported dependency manifest was read
  • High IaC: DS-0029 (Dockerfile.dev)
  • No exposed public API
  • Test reliability not included
  • early-stage repository — too little history to judge knowledge freshness
  • single-maintainer — knowledge-concentration (bus factor) risk

New (24)

  • Critical CVE: [GHSA redacted] (composer.lock)
  • Critical CVE: [GHSA redacted] (composer.lock)
  • Critical CVE: [GHSA redacted] (composer.lock)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • End-of-life framework: Symfony 4
  • High CVE: [GHSA redacted] (composer.lock)
  • High CVE: [GHSA redacted] (composer.lock)
  • High CVE: [GHSA redacted] (composer.lock)
  • High IaC: DS-0029 (Dockerfile.dev)
  • High IaC: DS-0029 (Dockerfile.dev)
  • High IaC: WD-COMPOSE-0002 (docker-compose.test.yml)
  • High IaC: WD-COMPOSE-0002 (docker-compose.yml)
  • Low CVE: [GHSA redacted] (composer.lock)
  • Medium CVE: [GHSA redacted] (composer.lock)
  • Medium CVE: [GHSA redacted] (composer.lock)
  • Medium IaC: WD-DOCKER-0003 (Dockerfile.dev)
  • No assertions: testNewPayment (tests/Domain/Payment/PaymentRepositoryTest.php)
  • No assertions: testObject (tests/Infrastructure/Cqrs/CommandBusTest.php)
  • No assertions: testSave (tests/Domain/Account/Repository/AccountBalanceRepositoryTest.php)
  • …and 4 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

yasiekz/payments-DDD-ES-tutorial 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 99b3ff616df9491001aea59dc2d0f410cabcb88a — 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.