Yes Core

Core event sourcing framework providing the aggregate DSL, commands, events, read models, and supporting infrastructure for the Yes framework.

Compatibility with pg_eventstore

⚠️ pg_eventstore 3.x requires yes-core >= 2.1.1. pg_eventstore 3.0.0 generates event ids with SecureRandom.uuid_v7 (it moved the default off the database's gen_random_uuid(), which always produced v4). Those ids arrive as causation_id / correlation_id, and Types::UUID accepted only v4 before 2.1.1 — so TransactionDetails.new raised Dry::Struct::Error, the event handler failed, and the subscription died once its restarts ran out.

Types::UUID now accepts any RFC 9562 version (1-8) while still requiring a valid version and variant nibble.

Installation

Add this line to your application's Gemfile:

gem 'yes-core'

And then execute:

bundle install

Usage

See the root README for the full DSL documentation and usage examples.

Development

Prerequisites

  • Docker and Docker Compose
  • Ruby >= 3.2.0
  • Bundler

Setup

Start PostgreSQL from the repository root:

docker compose up -d

Install dependencies:

bundle install

Set up the EventStore database:

PG_EVENTSTORE_URI="postgresql://postgres:postgres@localhost:5532/eventstore_test" bundle exec rake pg_eventstore:create pg_eventstore:migrate

Set up the test database:

RAILS_ENV=test bundle exec rake db:create db:migrate

Running Specs

bundle exec rspec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yousty/yes.

License

The gem is available as open source under the terms of the MIT License.