go-mink
Event Sourcing & CQRS for Go β Built for developers who demand simplicity without sacrificing power.
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. π¦«