Skip to content
CAI
Software that uses CAICheck a score

yerinadler/typescript-event-sourcing-sample-app

42.5

Weak · 21 September 2026

1.4k

lines of production code

TypeScript

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a distributed event-driven application built on a CQRS and event sourcing architecture, split into distinct services for managing job listings and user applications. It leverages MongoDB for event storage, Cassandra for read models, and Kafka for asynchronous communication between components. The codebase has been refactored from a legacy monolithic structure into a Yarn monorepo with separate packages for core infrastructure, job management, and application logic.

How it got here

2021 — monorepo migration and legacy cleanup

12 changes.

The project was restructured into a Yarn monorepo with separate packages for application, job, and core logic. This period involved removing legacy infrastructure, including the command bus, event handlers, and domain models, while modernizing the Node.js environment and TypeScript configuration.

2024 — CQRS and event sourcing foundation

7 changes.

The codebase was structured around a Command/Query (CQRS) and event-sourcing architecture, introducing core primitives, domain models, and infrastructure integrations for MongoDB, Kafka, and Redis. Development environments were standardized with TypeScript configurations, environment templates, and automated setup scripts for backend services like Cassandra and Kafka.

Features

Add job management API and CQRS infrastructure

The job service now exposes HTTP endpoints for creating, updating, and archiving jobs, as well as retrieving all jobs. These operations are handled via a CQRS pattern where HTTP controllers dispatch commands to a command bus, which invokes domain handlers that persist changes to a MongoDB event store. Event handlers then update a Cassandra read model, and the service subscribes to Kafka topics to process events. The implementation includes domain models, command/query handlers, and infrastructure bindings for MongoDB, Cassandra, and Kafka.

packages/job/src · high confidence

Automated initialization scripts for Cassandra and Kafka services

New shell scripts have been added to the setup directory to automate the initialization of backend services. The Cassandra setup script waits for the database to become available and then creates the 'cqrs\_es\_dev' keyspace and 'jobs' table. The Kafka setup script automatically creates the 'job' and 'application' topics if they do not already exist. These changes ensure that the development environment is properly configured and ready for use without manual intervention.

setup · high confidence

Initial application configuration and build setup

The application package is now configured for development and build processes. A new .env\_template file defines environment variables for Node, API, MongoDB, Redis, and Kafka connections. Additionally, nodemon.json is added to automate the build and run process using TypeScript compilation and concurrent execution of API and subscriber processes. The tsconfig.json file establishes TypeScript compilation settings, including path aliases for modular code organization (e.g., @src, @common, @api) and references to the core package.

packages/application · high confidence

Initialise job package configuration and environment

The job package is initialised with essential configuration files: a .env\_template defining environment variables for MongoDB, Redis, Kafka, and Cassandra; a nodemon.json for development hot-reloading; and a tsconfig.json setting up TypeScript compilation, path aliases, and project references. These changes establish the foundational build and runtime environment for the job service.

packages/job · high confidence

Introduce application domain with CQRS, Kafka, and Redis integration

Users can now submit job applications via a new HTTP API endpoint and retrieve all applications. The application module implements a CQRS architecture using a Command Bus for creating applications and a Query Bus for retrieving them. It integrates with MongoDB for event sourcing, Kafka for event publishing and subscription, and Redis for caching and job replication. The change includes new domain models, command/query handlers, event handlers, and infrastructure modules to support these capabilities.

packages/application/src · high confidence

Introduce core CQRS/DDD primitives and event sourcing infrastructure

The packages/core module now provides foundational building blocks for a command/query and event-sourced architecture. This includes an abstract Event base class and an EventSourcedRepository for managing aggregate state, alongside interfaces for commands, queries, and event handling. The EventStore implementation has been refactored to use dependency injection and publish events via an IEventBus, while utility functions handle event serialization and rehydration. Additionally, a Winston-based Logger utility and a DomainException error class have been added to the core.

packages/core · high confidence

Removals

Removal of book event handlers

The event handlers for book creation, updates, and author changes have been removed from the application. This eliminates the previous logic where these events triggered Redis cache updates or console logging, indicating a shift away from the current event-driven caching and notification mechanisms for book data.

src/eventHandlers · high confidence

Removed BookController and its index export

The HTTP controller for book operations (CRUD endpoints) has been removed from the application. This change eliminates the previous HTTP interface for managing books, meaning users can no longer interact with book data through the standard REST API endpoints that were previously exposed.

src/interfaces · high confidence

Removed obsolete book command classes

The specific command classes for creating, updating, and updating the author of a book have been removed from the codebase. This eliminates the legacy command implementations that previously handled these specific book-related operations.

src/commands · high confidence

Behavioural changes

1 commit (0 fixes) modifying assets

A change to existing behaviour in assets — 1 commit, 2 files.

assets · medium confidence · unverified

Removal of core messaging and command bus interfaces

The core messaging and command bus interfaces have been removed from the codebase. Specifically, the abstract Event class, along with the interfaces for message handling (IMessage, IEvent, IEventHandler), data mapping (IDataMapper), and command execution (ICommandBus) have all been deleted. This eliminates the previous abstraction layer for events and commands, likely simplifying the core architecture by removing these specific interface definitions.

src/core · medium confidence

Removal of default Redis client export

The default export of the Redis client instance from the infrastructure layer has been removed. This change eliminates the shared, globally-accessible Redis client that was previously exported from the infrastructure/redis module, likely to enforce stricter dependency injection or per-request client instantiation patterns.

src/infrastructure/redis · high confidence

Removal of legacy book command handlers

The specific command handlers for creating, updating, and modifying the author of a book have been removed from the codebase. This eliminates the previous implementation of these operations, indicating a shift in how book-related commands are processed within the application.

src/commandHandlers · high confidence

Removal of legacy command bus and book data mapper

The legacy CommandBus implementation and the BookDataMapper have been removed from the infrastructure layer. This eliminates the previous mechanism for registering and executing commands via a Map-based handler registry, as well as the data mapping logic for the Book entity.

src/infrastructure/commandBus · high confidence

Removed Book domain model and associated event classes

The Book aggregate root, its repository interface, the ReadModel facade, and all associated domain events (BookCreated, BookAuthorChanged, BookUpdated) have been deleted from the src/domain/book directory. This removes the previous implementation of book management and its read-model caching layer.

src/domain · high confidence

Removed constants for DI and commands

The file src/constants/commands.ts, which defined the Commands enum, and src/constants/types.ts, which defined the TYPES object containing symbols for dependency injection (e.g., Db, Redis, EventBus, BookRepository), have been deleted. This removes the centralized registry of symbols and command identifiers previously used for IoC and event handling.

src/constants · high confidence

Removed legacy application bootstrap and core infrastructure classes

The application's entry point (src/entrypoint.ts) and the main index file (src/index.ts) have been deleted, removing the previous logic that initialized the Inversify dependency injection container, registered command and event handlers, and started the Express server. Additionally, the generic Repository class, the EventHandler class, and the EventBus utility have been removed from the codebase, indicating a significant restructuring of how the application is bootstrapped and how domain events are processed.

src · high confidence

Upgraded Node.js base image and modernized TypeScript configuration

The Dockerfile base image was updated from the deprecated \node:dubnium-alpine\ to \node:gallium-alpine\, ensuring the application runs on a supported, secure version of Node.js. Additionally, the \tsconfig.json\ was significantly simplified and modernized, removing obsolete comments and unused options, while \nodemon.json\ was updated to use \tsc --build --force\ for improved incremental compilation. These changes improve security, maintainability, and build performance.

(repo-wide) · high confidence

Dependencies

Migrate to monorepo structure with new package dependencies

The project has been restructured into a Yarn monorepo, splitting the codebase into separate packages: @cqrs-es/application, @cqrs-es/job, and @cqrs-es/core. This change introduces new dependencies for each package, including libraries for Express, ioredis, KafkaJS, MongoDB, and Winston, alongside updated dev dependencies for TypeScript, ESLint, and Prettier. The root package.json now defines workspaces and scripts to manage these sub-packages.

(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

Score

  • CAI 42 → 42 (+0.5)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 80 → 89 (+9.6)
  • Architecture 69 → 69 (+0.0)
  • Maturity 58 → 58 (+0.0)
  • Readiness 12 → 16 (+3.3)
  • Security 79 → 78 (-1.4)

Resolved (44)

  • Critical CVE: [GHSA redacted] (yarn.lock)
  • Critical CVE: [GHSA redacted] (yarn.lock)
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • …and 24 more

New (69)

  • Critical CVE: [GHSA redacted] (yarn.lock)
  • Critical CVE: [GHSA redacted] (yarn.lock)
  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • High CVE: [GHSA redacted] (yarn.lock)
  • …and 49 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

yerinadler/typescript-event-sourcing-sample-app 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 21 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 354ab3c160472e6676a5aeb06fad8e554cd4d689 — 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-b84573e22831.