Skip to content
CAI
Software that uses CAICheck a score

j5ik2o/cqrs-es-example-go

69.9

Adequate · 20 September 2026

3.8k

lines of production code

Go

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a Go-based application implementing CQRS and Event Sourcing to manage group chat functionality. It exposes GraphQL APIs for both writing commands (such as creating chats and posting messages) and reading data, while maintaining consistency through a Read Model Updater that syncs events to a MySQL database. The architecture relies on DynamoDB for event storage and snapshots, supported by infrastructure tooling for local development and end-to-end testing.

How it got here

2023 — Group chat feature implementation

11 changes.

This period focused on implementing the core group chat functionality within a CQRS/Event Sourcing architecture, including domain models, events, and repository logic. It also established the necessary infrastructure for read-model updates via DynamoDB streams and MySQL, along with CLI tools and database migration scripts to support the new feature.

2024 — GraphQL API for group chats

6 changes.

This period focused on implementing a comprehensive GraphQL API for group chat management, covering both read queries and write mutations. The work included establishing robust error handling, input validation, and command processing logic, supported by extensive integration and end-to-end testing infrastructure.

Features

Add DynamoDB table setup tooling

The \tools/dynamodb-setup\ directory now includes a Dockerfile, Makefile, and shell script to automate the creation of DynamoDB tables. The setup script creates a Journal table and a Snapshot table, each with a composite primary key (pkey/skey) and a Global Secondary Index on aid/seq\_nr, and supports local development via a configurable endpoint.

tools/dynamodb-setup · high confidence

Add GraphQL query API for group chats, members, and messages

The query package now exposes a GraphQL interface for retrieving group chat data, including fetching individual chats, lists of chats for a user, member details, and message history. This change introduces the GraphQL schema, generated code, and resolver implementations that map these queries to the underlying MySQL database, along with integration tests to verify the data retrieval logic.

pkg/query · high confidence

Add end-to-end test for group chat functionality

Added a new end-to-end test suite in tools/e2e-test that verifies group chat operations. The test script (verify-group-chat.sh) automates creating a group chat, adding members, posting messages, retrieving chat details and lists, renaming the chat, and fetching member information via GraphQL mutations and queries against write and read API servers. A Dockerfile and Makefile are included to build and run the test container, with configuration for API endpoints and user IDs.

tools/e2e-test · high confidence

Added group chat and Docker management utility scripts

New shell scripts have been added to tools/scripts to support group chat operations and local environment management. The set includes curl-based utilities for creating, retrieving, and managing group chats and their members (e.g., curl-create-group-chat.sh, curl-add-member.sh), as well as Docker Compose helpers for building, starting, and testing the application stack (e.g., docker-compose-up.sh, docker-compose-e2e-test.sh).

tools/scripts · high confidence

Added group chat domain events

The \pkg/command/domain/events\ package now includes a complete set of domain events for group chat operations, enabling the system to track the full lifecycle of a group chat. New event types include \GroupChatCreated\, \GroupChatDeleted\, \GroupChatRenamed\, \GroupChatMemberAdded\, \GroupChatMemberRemoved\, \GroupChatMessagePosted\, \GroupChatMessageEdited\, and \GroupChatMessageDeleted\. Each event is implemented as a struct with constructors for creation and reconstruction, implements the \GroupChatEvent\ interface, and provides methods for JSON serialization and metadata access (such as sequence number and occurrence time) to support event sourcing.

pkg/command/domain/events · high confidence

GraphQL API for group chat management and error handling

This change introduces the GraphQL interface for the command side of the application, enabling users to create, delete, rename, and manage group chats, as well as post, edit, and delete messages. The implementation includes a new \error\_handling.go\ module that maps internal domain and processor errors to specific GraphQL error codes (400 for validation, 404 for not found, 409 for optimistic lock conflicts, and 422 for domain logic errors like group chat issues), providing clearer feedback to API consumers. The feature is supported by generated code from \gqlgen\ and comprehensive integration tests that verify the mutations against a localstack-backed event store.

pkg/command/interfaceAdaptor/graphql · high confidence

Initial database migration tooling and schema for group chat features

This change introduces the infrastructure and initial database schema for group chat functionality. It adds a Dockerfile and Makefile to build and run the \refinery\ migration tool against AWS ECR, along with SQL migration scripts that create the \group\_chats\, \members\, and \messages\ tables. The schema defines relationships between users and chats, including foreign keys and unique constraints on member associations.

tools/migrate · high confidence

Initial project scaffolding and configuration

The repository is initialized with essential project infrastructure, including a Go-based CQRS/Event Sourcing example application. This includes a Dockerfile for containerization (using Go 1.27), a Makefile with commands for building, testing, and running local API servers, and configuration files for code style (.editorconfig) and automated dependency updates (renovate.json). The project also introduces dual licensing (Apache 2.0 and MIT) and comprehensive documentation (README.md, README.ja.md) outlining the architecture, which utilizes gqlgen for GraphQL APIs and j5ik2o/event-store-adapter-go for event sourcing.

(repo-wide) · high confidence

Introduce read-model updater for group chat events

Added a new read-model update mechanism in the rmu package that processes group chat events from a DynamoDB stream and persists the resulting state to a MySQL database. This includes a DAO interface and implementation for managing group chats, members, and messages, along with a ReadModelUpdater that maps specific domain events (such as creation, deletion, renaming, member changes, and message posting/editing) to corresponding database operations.

pkg/rmu · high confidence

Introduces domain models for group chat, members, and messages

Adds new value objects and domain models to the command domain layer to support group chat functionality. This includes \GroupChatId\, \GroupChatName\, and \Member\ entities with role-based access (admin/member), as well as \Message\ and \Messages\ collections that enforce ownership rules for editing and removing messages. These models provide the foundational data structures for managing group chat participants and their interactions.

pkg/command/domain/models · high confidence

New CLI commands for Write API, Read API, and Read Model Updater

The \cmd\ package now exposes three new subcommands—\writeApi\, \readApi\, and \rmu\ (with a local variant \localRmu\)—allowing users to start the respective services directly from the command line. The \writeApi\ command initializes a GraphQL server on port 28080 that persists events and snapshots to DynamoDB using configurable environment variables. The \readApi\ command starts a GraphQL query server on port 28082 backed by a MySQL database. The \rmu\ command supports running the Read Model Updater either as a Lambda function or locally via \localRmu\, which consumes DynamoDB Streams to keep the MySQL read model in sync.

cmd · high confidence

Behavioural changes

Group chat command processing and error handling

The group chat command processor now handles commands (create, delete, rename, add/remove member, post/edit/delete message) with structured error types (NotFound, Repository, DomainLogic) and returns typed events via the mo.Result pattern, ensuring consistent error propagation and event emission for group chat operations.

pkg/command/processor · high confidence

Group chat repository now supports conditional snapshotting and full event serialization

The repository layer for group chats has been expanded to include robust event and snapshot handling. It now supports conditional snapshotting, allowing snapshots to be saved based on a configurable predicate (such as event sequence number retention) rather than every write. Additionally, new converters and serializers have been added to properly serialize and deserialize group chat events (including the new GroupChatMessageEdited event) and aggregate snapshots to/from JSON, ensuring consistent storage and retrieval of the group chat state.

pkg/command/interfaceAdaptor/repository · high confidence

GroupChat domain logic and error handling

The GroupChat aggregate now includes specific error types (such as AlreadyDeletedError, NotMemberError, and MismatchedUserAccountError) to provide detailed feedback for invalid operations, and its event handling logic has been refactored to ensure that edit actions correctly emit the appropriate events.

pkg/command/domain · high confidence

Introduction of dedicated validation functions for command inputs

A new validators package has been added to the command interface adaptor layer, providing specific validation functions for group chat IDs and names, user account IDs, and messages. These functions act as an intermediate step, delegating validation logic to the underlying domain models to ensure that incoming command data conforms to expected formats and constraints before processing.

pkg/command/interfaceAdaptor/validators · high confidence

Test coverage

Added test infrastructure for MySQL and LocalStack containers

Added a new test helper file (test/common.go) that provides utilities for spinning up MySQL 8.2 and LocalStack (DynamoDB) containers using testcontainers-go, along with functions to generate data source names and run database migrations for testing purposes.

test · high confidence

Dependencies

Updated Go dependencies and toolchain

The project's Go module dependencies have been updated, including the Go toolchain directive to v1.27.1 and the base Go version to 1.26.0. Key library updates include aws-sdk-go-v2 to v1.47.0, 99designs/gqlgen to v0.17.95, j5ik2o/event-store-adapter-go to v1.0.192, and testcontainers-go to v0.44.0, alongside updates to golang.org/x/tools, go-sql-driver/mysql, and several other indirect dependencies.

(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 71 → 70 (-1.5)
  • Rubric changed (rubric-2026.08.17 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 97 → 94 (-3.2)
  • Architecture 100 → 96 (-4.5)
  • Maturity 67 → 67 (-0.3)
  • Readiness 66 → 64 (-2.4)
  • Security 70 → 71 (+1.2)
  • Domain Modelling 100 → 100 (+0.0)

Resolved (28)

  • Coverage not included — suite not readable by the collector
  • Dependency hygiene not measured — no supported dependency manifest was read
  • Duplicated block (10 lines × 2) (pkg/command/domain/events/group_chat_message_edited.go)
  • Duplicated block (11 lines × 2) (pkg/command/interfaceAdaptor/graphql/error_handling.go)
  • Duplicated block (11 lines × 7) (pkg/command/processor/group_chat_command_processor.go)
  • Duplicated block (12 lines × 6) (pkg/rmu/group_chat_dao_impl.go)
  • Duplicated block (14 lines × 2) (pkg/command/interfaceAdaptor/repository/event_converter.go)
  • Duplicated block (6 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (8 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (9 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (9 lines × 2) (pkg/command/interfaceAdaptor/repository/event_converter.go)
  • High IaC: DS-0002 (tools/e2e-test/Dockerfile)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • High: security finding (details withheld)
  • Low IaC: DS-0005 (tools/e2e-test/Dockerfile)
  • Low IaC: DS-0026 (Dockerfile.rmu)
  • …and 8 more

New (78)

  • Duplicated block (10 lines × 6) (pkg/rmu/group_chat_dao_impl.go)
  • Duplicated block (11 lines × 2) (cmd/readApi.go)
  • Duplicated block (13 lines × 2) (pkg/command/interfaceAdaptor/repository/event_converter.go)
  • Duplicated block (19–20 lines × 2) (cmd/localRmu.go)
  • Duplicated block (36 lines × 2) (cmd/localRmu.go)
  • Duplicated block (5 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (5 lines × 7) (pkg/command/processor/group_chat_command_processor.go)
  • Duplicated block (6 lines × 2) (cmd/localRmu.go)
  • Duplicated block (6 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (6 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (6 lines × 2) (pkg/command/domain/group_chat.go)
  • Duplicated block (6 lines × 6) (pkg/command/domain/events/group_chat_member_added.go)
  • Duplicated block (7 lines × 2) (pkg/command/interfaceAdaptor/repository/event_converter.go)
  • Duplicated block (9 lines × 2) (pkg/command/interfaceAdaptor/graphql/error_handling.go)
  • Duplicated block (9 lines × 2) (pkg/command/processor/group_chat_command_processor.go)
  • Duplicated block (9 lines × 7) (pkg/command/processor/group_chat_command_processor.go)
  • FunctionTooLong: repository.EventConverter (pkg/command/interfaceAdaptor/repository/event_converter.go)
  • High CVE: [GHSA redacted] (go.mod)
  • High CVE: [GHSA redacted] (go.mod)
  • High IaC: WD-COMPOSE-0001 (tools/docker-compose/docker-compose-databases.yml)
  • …and 58 more

Changes since last survey

  • 51 commits — 51 feature/other, 0 fixes

By area

  • (root) — 50 commits
  • tools/docker-compose — 1 commit

Notable commits

  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#567)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#574)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#575)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#576)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#578)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#580)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#583)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#590)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#593)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#603)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#605)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#607)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#611)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#618)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#622)
  • change: chore(deps): Update aws-sdk-go-v2 monorepo (#625)
  • change: chore(deps): Update go toolchain directive to v1.26.6 (#581)
  • change: chore(deps): Update go toolchain directive to v1.27.0 (#586)
  • change: chore(deps): Update go toolchain directive to v1.27.1 (#613)
  • change: chore(deps): Update golang Docker tag to v1.27 (#588)
  • …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

j5ik2o/cqrs-es-example-go 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 b64710331a16541ede72563941c3a55b606e9b56 — 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.