go-mink

Event Sourcing & CQRS for Go β€” Built for developers who demand simplicity without sacrificing power.

Get Started β†’ GitHub


πŸš€ Production Ready Β· πŸ”Œ Pluggable Β· πŸ›‘οΈ Type Safe Β· ⚑ High Performance


The Problem We Solve

Building event-sourced applications in Go means wrestling with boilerplate code, manual projections, and scattered patterns. Most teams end up reinventing the wheelβ€”or worse, avoiding event sourcing entirely.

go-mink changes that.

β€œMake Event Sourcing in Go as simple as using a traditional ORM, while maintaining the flexibility that Go developers expect.”


✨ Features

Β  Feature Status What You Get
🎯 Event Store βœ… v0.1.0 Append-only storage with optimistic concurrency
πŸ”Œ Adapters βœ… v0.1.0 PostgreSQL & In-Memory adapters
🧱 Aggregates βœ… v0.1.0 Base implementation with event application
πŸ§ͺ Testing βœ… v0.1.0 90%+ coverage, Docker Compose infrastructure
πŸ“‹ Command Bus βœ… v0.2.0 Full CQRS with middleware, validation & idempotency
πŸ” Idempotency βœ… v0.2.0 Prevent duplicate command processing
πŸ”— Correlation/Causation βœ… v0.2.0 Distributed tracing support
πŸ“– Projections πŸ”œ v0.3.0 Inline, async, and live read models
πŸ› οΈ CLI πŸ”œ v0.4.0 Generate code, run migrations, diagnose issues
πŸ” Security πŸ”œ v0.5.0 Field-level encryption & GDPR compliance
πŸ”„ Sagas πŸ”œ v0.5.0 Coordinate long-running business processes
πŸ“€ Outbox πŸ”œ v0.5.0 Reliable event publishing

πŸš€ Quick Start

package main

import (
    "context"
    
    "github.com/AshkanYarmoradi/go-mink"
    "github.com/AshkanYarmoradi/go-mink/adapters/postgres"
)

func main() {
    ctx := context.Background()
    
    // πŸ”Œ Connect to your database
    store, _ := mink.NewEventStore(
        postgres.NewAdapter("postgres://localhost/orders"),
    )
    
    // πŸ“¦ Create an aggregate
    order := NewOrder("order-123")
    order.Create("customer-456")
    order.AddItem("SKU-001", 2, 29.99)
    
    // πŸ’Ύ Save events automatically
    store.SaveAggregate(ctx, order)
    
    // πŸ“– Projections update in real-time
    store.RegisterProjection(&OrderSummaryProjection{})
}

That’s it. No ceremony. No configuration hell. Just clean, idiomatic Go.


πŸ“¦ Installation

# Install the library
go get github.com/AshkanYarmoradi/go-mink

# Install PostgreSQL adapter
go get github.com/AshkanYarmoradi/go-mink/adapters/postgres

# Or use in-memory adapter for testing
go get github.com/AshkanYarmoradi/go-mink/adapters/memory

πŸ“š Documentation

Getting Started

Guide Description
πŸ“˜ Introduction Why go-mink exists and what problems it solves
πŸ—οΈ Architecture Core concepts and system design
πŸ’Ύ Event Store How events are stored and retrieved
πŸ“– Read Models Building and maintaining projections

Advanced Topics

Guide Description
πŸ”Œ Adapters Database adapters and custom implementations
⚑ Commands & Sagas CQRS command bus and process managers
πŸ” Security Encryption, GDPR, and event versioning
πŸ§ͺ Testing BDD fixtures and debugging tools

Reference

Guide Description
πŸ› οΈ CLI Reference All command-line tools
πŸ“– API Reference Complete API documentation
πŸ—ΊοΈ Roadmap What’s coming next

Learn Event Sourcing

Guide Description

|:β€”β€”|:β€”β€”β€”β€”|

πŸ“ Blog Series 8-part series on Event Sourcing & CQRS with go-mink

🌟 Why Choose go-mink?

Aspect Traditional Approach With go-mink
Event Storage Custom implementation Built-in, optimized
Projections Manual, error-prone Automatic, reliable
Database Support Locked to one DB Swap adapters anytime
Testing Complex setup BDD fixtures included
Learning Curve Steep Gentle, familiar API

🀝 Community & Support

Β  Β 
πŸ’¬ GitHub Discussions β€” Ask questions, share ideas
πŸ› Issue Tracker β€” Report bugs, request features
🀝 Contributing Guide β€” Help us improve
⭐ Star on GitHub β€” Show your support

πŸ“„ License

go-mink is open source under the Apache 2.0 License.


go-mink
Event Sourcing for Go, Done Right. 🦫