Skip to main content

Introduction

go-mink is an Event Sourcing and CQRS toolkit for Go. It gives you the building blocks to record changes as events, rebuild domain state, and create read models for your application.

Start with a small event stream. Add commands, projections, and workflow coordination as your application needs them.

Choose your starting point​

If you want to…Start here
Build an application step by stepThe order system tutorial
Understand the moving partsArchitecture
Append events and load a streamThe event store
Build query-friendly viewsRead models and projections
Compare storage capabilitiesAdapters
Learn the concepts from first principlesThe Event Sourcing series

Install the module​

From a Go module, add go-mink:

go get go-mink.dev

Use the memory adapter for tests and local experiments. Use PostgreSQL when your events need durable storage. The project setup tutorial walks through configuration, schema initialization, and your first application.

Think in events​

A conventional state update records that an order is now shipped. An event-sourced model also records the steps that got it there:

OrderCreated → ItemAdded → PaymentReceived → OrderShipped

The event stream is the history. An aggregate applies that history to rebuild its current state. A projection transforms events into a view designed for a specific query: an order summary, a fulfillment queue, or a report.

This is useful when the sequence of changes matters. It also introduces responsibilities: event schema evolution, projection maintenance, replay safety, and operational monitoring. For a small CRUD application with no need for historical behavior, a conventional database model may be simpler.

Follow the data​

  1. Handle a command. Your domain logic validates an action and decides which events to record. The command bus can add validation, logging, tracing, and other middleware.
  2. Persist the events. The event store serializes events and appends them through an adapter. Expected stream versions protect against conflicting writes.
  3. Build a view. Your application explicitly invokes inline projections, runs async projections, or notifies live projections according to its consistency needs.
  4. Query the read model. Read a view shaped for your application instead of rebuilding an entire stream for every screen.
Projections are explicit

Appending an event does not automatically run every projection. Inline projections are invoked through ProcessInlineProjections; async projections poll stored events and maintain checkpoints; live projections receive notifications through NotifyLiveProjections.

Add capabilities as you need them​

The library provides mechanisms; your application defines domain rules, consistency boundaries, access controls, and retention policies. The architecture guide explains how these pieces fit together.