Skip to content
CAI
Software that uses CAICheck a score

go-gadgets/eventsourcing

61.0

Adequate · 21 September 2026

3k

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 an event sourcing framework that manages state by recording and processing a sequence of events. It provides a command-driven model where aggregates handle commands to produce events, supported by a flexible middleware system for logging, snapshotting, and publishing. The architecture supports multiple storage backends, including in-memory, DynamoDB, MongoDB, and Redis, as well as event distribution via Kafka or in-process mechanisms.

Features

Add DynamoDB snapshot middleware for event sourcing

Users can now persist entity snapshots to a DynamoDB table, enabling state caching and faster entity loading. The new \dynamosnap\ middleware integrates with the existing \snapbase\ logic to handle get, put, and purge operations against a configurable DynamoDB table, with a corresponding test suite validating standard store compliance and performance.

stores/middleware/dynamosnap · high confidence

Add DynamoDB-backed event store with a reusable key-value store abstraction

Users can now persist event-sourced aggregates to Amazon DynamoDB. This change introduces a new \stores/dynamo\ package that implements the \eventsourcing.EventStore\ interface using the AWS SDK for Go. To support future providers, the commit also adds a \stores/key-value\ package that abstracts common key-value store logic (check, fetch, put, close) into a base implementation, allowing other backends like MongoDB or Cassandra to be added with minimal code duplication.

stores/key-value · high confidence

Add Kafka pub/sub example with consumer and publisher components

Added a new example demonstrating event sourcing with Kafka, featuring a publisher that writes events to a Kafka topic and a consumer that reads from it. The example includes a CounterAggregate model, a Handler for processing events, and middleware for logging, snapshotting, and publishing, illustrating how to integrate Kafka into an event-driven architecture.

examples/kafka · high confidence

Add MongoDB OpLog tailer example

A new example application in examples/mongo-log-publish demonstrates how to use the MongoDB OpLog tailer to publish and consume events. The example sets up an in-process event receiver, configures a MongoDB tracker and oplog publisher, and includes a dummy event producer to simulate activity.

examples/mongo-log-publish · high confidence

Add MongoDB Oplog tailer and refactor MongoDB store

The MongoDB store now supports tailing the MongoDB oplog to push changes to an event publisher, enabling real-time event streaming from MongoDB. The store has been refactored to use a key-value store base type, and the API has been updated: the old \NewMongoStore\ and \NewSnapStore\ functions are removed in favor of \NewStore\ and \NewStoreWithConnection\, which support bringing your own MongoDB session. Additionally, the code now requires \bson.SetJSONTagFallback(true)\ to be called globally before use.

stores/mongo · medium confidence

Add MongoDB snapshot middleware for event sourcing

Introduced a new MongoDB-based snapshot middleware that persists entity state to a MongoDB collection. The implementation manages connection handling and provides a factory for creating middleware instances that wrap the event store, enabling efficient state recovery and bulk operations.

stores/middleware/mongosnap · high confidence

Add Redis-based snapshot middleware for event sourcing

Introduced a new Redis-backed snapshot store that persists event-sourced state to a Redis instance. The implementation provides a factory to create a middleware that handles saving, loading, and purging snapshots with configurable intervals and TTLs, enabling users to leverage Redis for efficient state recovery.

stores/middleware/redissnap · high confidence

Added Snapbase middleware for snapshot management

Introduced a new middleware component in the stores/middleware/snapbase package that handles event commit and state refresh operations. The implementation includes a custom JSON decoder using UseNumber to preserve integer precision during serialization, ensuring accurate numeric data handling in snapshots.

stores/middleware/snapbase · medium confidence

Added in-memory event store implementation

Users can now use an in-memory event store for development or testing purposes. The new \stores/memory\ package provides a \NewStore\ function that returns an \eventsourcing.EventStore\ backed by an internal map structure. The implementation includes a custom JSON decoder using \UseNumber\ to preserve integer precision during deserialization, and the store is validated against the standard compliance test suite.

stores/memory · high confidence

Added in-process event distributor

Introduced a new in-process event distribution mechanism that acts as both a publisher and consumer. The \distributor\ component registers event handlers and propagates events post-store, supporting start/stop lifecycle management and validation of event types via an event registry.

distribution/inproc · high confidence

Added logging and in-memory snapshot middleware implementations

Introduced new middleware components for the event sourcing store. The logging middleware wraps the store to log commit and refresh operations using logrus, providing debug-level visibility into event processing. Additionally, an in-memory snapshot middleware was added, allowing for configurable, lazy-loaded caching of entity states to reduce load operations. Both middleware implementations include corresponding test suites verifying compliance and performance.

stores/middleware/logging · high confidence

Introduce command handling and middleware support for event sourcing

The framework now supports a command-driven model where aggregates handle commands to produce events, replacing the previous event-application pattern. This includes a new CommandRegistry for managing command types and a middleware system that allows intercepting store operations (commit, refresh, cleanup) via a wrapper. Additionally, an event handler base is introduced to automatically wire up event consumers, and a test store is provided for unit testing. The Event and Command interfaces are updated to support these new patterns, and the standard registry now requires a domain name.

(repo-wide) · high confidence

Introduce command handling via CommandRegistry and Handle method

The aggregate base now supports a new Command-based interaction model. A CommandRegistry concept is introduced, allowing commands to be dispatched to the aggregate via a new Handle method. This replaces the previous mutex-based in-process safety mechanism with a cleaner, type-safe command handler map that automatically wires up command handlers using reflection. Users can now send commands to an aggregate, which are then processed through the new Handle flow, improving concurrency handling and code clarity.

gopath.local/. · high confidence

Introduce publish middleware for event sourcing

A new middleware component has been added to the store's publish pipeline. This middleware intercepts uncommitted events during a commit operation, iterates through them, and publishes each event using a provided publisher. It ensures that all events are successfully published before the commit is considered complete, integrating with the existing event sourcing infrastructure.

stores/middleware/publish · high confidence

Kafka distribution support for event sourcing

Added a new Kafka-based distribution layer for the event sourcing system, introducing a \consumer\ that reads events from a Kafka topic and dispatches them to registered handlers, and a \publisher\ that writes serialized events to a Kafka topic. The consumer implementation uses \json.Decoder.UseNumber()\ to preserve integer precision during deserialization, and the publisher supports a 'bring your own producer' pattern for flexible integration.

distribution/kafka · high confidence

Removals

Removed in-memory event store implementation

The in-memory event store implementation (memorystore.go) and its associated tests (memorystore\_test.go) have been removed from the stores/in-memory directory. This eliminates the ability to use an ephemeral, in-memory storage provider for event sourcing, which was previously available for unit tests and disposable-data scenarios.

stores/in-memory · high confidence

Behavioural changes

Counter example adopts middleware-based store and command handling

The counter example now uses a middleware chain to wrap the event store, adding in-memory and MongoDB snapshotting, structured logging, and retry logic. The API is extended with a POST endpoint that processes an IncrementCommand, and the aggregate handles commands via a dedicated method that enforces a domain limit of 30.

examples/counter · medium confidence

Removed deprecated mgo and validator.v8 vendored dependencies

The vendored copies of the mgo.v2 (MongoDB driver) and go-playground/validator.v8 libraries have been removed from the vendor directory. This eliminates the legacy mgo package and the v8 version of the validator library from the project's dependencies.

vendor/gopkg.in · high confidence

Update Shopify Sarama to version 1.16.0

The vendored copy of the Shopify Sarama Kafka client library has been updated to version 1.16.0. This update adds support for the Create/Delete Topics, Describe/Create/Delete ACLs, and five transaction-related request/response pairs. It also includes improvements such as higher default fetch sizes for better throughput, and several bug fixes for consuming and producing messages with the new protocol format.

vendor/github.com · medium confidence

Fixes

Fix timestamp mapping from JSON

Added a decoder hook in the mapping utilities to correctly parse RFC3339 formatted time strings into Go time.Time objects, preventing blank or error states during JSON mapping.

utilities/mapping · medium confidence

Test coverage

New test utilities for event sourcing validation

Added new test utilities to simplify and standardize testing of event stores and aggregates. The \accept\_store.go\ file introduces a \CheckStandardSuite\ that runs a compliance suite of acceptance tests (startup/shutdown, write/read, concurrency, etc.) against any \EventStore\ implementation. The \aggregate\_tester.go\ file provides an \AggregateTester\ interface and implementation that can run recursive JSON-based test suites against aggregates, supporting inheritance and error validation. Additionally, \handlers.go\ adds a \LoggingHandler\ for capturing published events during tests, while \common.go\ and \errorstore.go\/\nullstore.go\ are updated to support these new testing patterns.

utilities/test · 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 63 → 61 (-2.4)
  • Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.

Lenses

  • Code Health 99 → 100 (+0.2)
  • Architecture 100 → 99 (-0.6)
  • Maturity 46 → 46 (+0.0)
  • Readiness 55 → 48 (-6.7)
  • Security 100 → 95 (-5.0)
  • 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
  • Duplicated block (11 lines × 2) (stores/middleware/dynamosnap/middleware.go)
  • Duplicated block (12 lines × 2) (stores/middleware/mongosnap/middleware.go)
  • No exposed public API
  • Test reliability not included
  • single-maintainer — knowledge-concentration (bus factor) risk

New (4)

  • Duplicated block (11 lines × 2) (stores/middleware/dynamosnap/middleware.go)
  • Duplicated block (16–17 lines × 2) (stores/middleware/mongosnap/middleware.go)
  • Medium: security finding (details withheld)
  • Medium: security finding (details withheld)

Architecture

  • Containers 0 added · 0 removed · contexts 1 added · 1 removed · edges 0 added · 0 removed

Added bounded contexts (1)

  • gopath.local/.

Removed bounded contexts (1)

  • gopath.local/.

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

Survey your own repository

go-gadgets/eventsourcing 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 eeebc8ff0c43b243e4b7a8d8a070c74323e468c2 — 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-fa71c66cabd8.