Skip to content

Installation

Prerequisites

  • Go 1.21 or later
  • A Go module (run go mod init if you don't have one)

Install

bash
go get github.com/modernice/goes/...

The /... suffix ensures all nested packages are downloaded, including backend implementations.

Module Structure

goes is organized into focused packages:

PackageWhat it does
aggregateDefine domain objects that own state and enforce business rules
aggregate/repositorySave and load aggregates from storage
aggregate/snapshotSpeed up aggregate loading with snapshots
eventDefine events, publish and subscribe to them, store and query them
commandDefine commands and route them to the right handler
command/cmdbusCommand bus that dispatches commands over the event system
projectionBuild read-optimized views with projections
codecRegister event and command types in the codec registry so they can be serialized

Backend Packages

PackageWhat it does
backend/mongoStore events, snapshots, and read models in MongoDB
backend/postgresStore events in PostgreSQL
backend/natsPublish and subscribe to events over NATS

In-Memory (Testing & Prototyping)

PackageWhat it does
event/eventstoreStore events in memory (no database needed)
event/eventbusPublish and subscribe to events in memory (no message broker needed)

What's Next?