Skip to content

NeuralEmpowerment/event-sourcing-platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

79 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Event Sourcing Platform

A comprehensive event sourcing platform that packages a robust event store with higher-level event sourcing abstractions. This platform provides reliable, robust, and flexible packages for implementing event sourcing in different applications, with progressive examples serving as living documentation.

CI CodeQL License: MIT

๐Ÿ“‹ Table of Contents

๐Ÿ—๏ธ Architecture Overview

The platform is organized into distinct contexts following Domain-Driven Design principles:

event-sourcing-platform/
โ”œโ”€โ”€ event-store/           # Rust event store service, gRPC server, and client SDKs
โ”‚   โ”œโ”€โ”€ eventstore-core/       # Shared traits, errors, protobuf types
โ”‚   โ”œโ”€โ”€ eventstore-backend-*/  # Memory + Postgres backends
โ”‚   โ””โ”€โ”€ eventstore-bin/        # gRPC server binary
โ”œโ”€โ”€ event-sourcing/        # Event sourcing SDKs and abstractions
โ”‚   โ”œโ”€โ”€ rust/                  # Rust SDK (alpha)
โ”‚   โ”œโ”€โ”€ typescript/            # TypeScript SDK (primary focus)
โ”‚   โ””โ”€โ”€ python/                # Placeholder for future Python SDK
โ”œโ”€โ”€ vsa/                   # Vertical Slice Architecture Manager (in planning)
โ”‚   โ”œโ”€โ”€ vsa-core/             # Core Rust library
โ”‚   โ”œโ”€โ”€ vsa-cli/              # CLI tool
โ”‚   โ””โ”€โ”€ vsa-wasm/             # WASM bindings for Node.js
โ”œโ”€โ”€ examples/              # TypeScript "living documentation" examples
โ”‚   โ”œโ”€โ”€ 001-basic-store-ts/    # Direct event store usage
โ”‚   โ”œโ”€โ”€ 002-simple-aggregate-ts/
โ”‚   โ”œโ”€โ”€ โ€ฆ
โ”‚   โ””โ”€โ”€ 009-web-dashboard-ts/
โ”œโ”€โ”€ dev-tools/             # Local Postgres/Redis helper scripts and Docker Compose
โ”œโ”€โ”€ infra-as-code/         # Terraform + Ansible scaffolding (work in progress)
โ”œโ”€โ”€ docs-site/             # Docusaurus documentation site (work in progress)
โ””โ”€โ”€ docs/                  # Project notes and supporting docs

๐Ÿš€ Quick Start

Prerequisites

  • Rust (latest stable) - for the event store
  • Node.js (18+) - for TypeScript SDK and examples
  • Python (3.8+) - for Python SDK and examples
  • Docker - for development services
  • PostgreSQL - for persistent storage (via Docker)

Setup

  1. Clone and enter the repository:

    git clone https://github.com/<org>/event-sourcing-platform.git
    cd event-sourcing-platform
  2. Install workspace dependencies (pnpm 9+ recommended):

    pnpm -w install
  3. Start local infrastructure (PostgreSQL + Redis) โ€“ optional:

    make dev-start      # or `make start-services` for the lightweight compose stack
  4. Build and smoke-test the platform:

    make build
    make smoke-test     # runs the Rust event-store smoke check

Try the Examples

Start with the progressive learning examples:

# Basic event store usage (no event sourcing)
make examples-001

# Simple event sourcing with one aggregate
make examples-002

# Multiple aggregates working together
make examples-003

๐Ÿ”ง Core Components

Event Store Context

Purpose: Pure event storage and retrieval
Dependencies: None (standalone)
Technology: Rust with gRPC API

The event store provides:

  • โœ… Durable event storage with optimistic concurrency
  • โœ… Client-proposed sequence numbers (true optimistic concurrency)
  • โœ… Multiple backends (memory, PostgreSQL)
  • โœ… gRPC API with protocol buffer definitions
  • โœ… Basic client libraries for multiple languages
cd event-store
make help

Event Sourcing Context

Purpose: Event sourcing patterns and abstractions
Dependencies: Event Store context
Technology: Multi-language SDKs (Rust, TypeScript, Python)

The event sourcing SDKs provide:

  • ๐Ÿ”„ Aggregate abstractions and lifecycle management
  • ๐Ÿ”„ Command/Event handling patterns
  • ๐Ÿ”„ Repository pattern implementations
  • ๐Ÿ”„ Projection and read model management
  • ๐Ÿ”„ Rich developer experience with type safety
cd event-sourcing
make help

Examples Context

Purpose: Living documentation and progressive learning
Dependencies: Event Store + Event Sourcing contexts
Technology: Real applications with no mocks

The examples demonstrate:

  • ๐Ÿ“š Progressive learning from basics to complete systems
  • ๐Ÿ“š Real working code with actual databases
  • ๐Ÿ“š Docker Compose setups for easy experimentation
  • ๐Ÿ“š Best practices and patterns
  • ๐Ÿ“š Performance considerations
cd examples
make help

๐Ÿ“š Examples

All examples are implemented in TypeScript today. They default to the gRPC event store provided by dev-tools; append -- --memory to run against the in-memory client.

Example Status Highlights
001-basic-store-ts โœ… Ready Append/read streams, optimistic concurrency basics
002-simple-aggregate-ts โœ… Ready Aggregate decorators, repository pattern
003-multiple-aggregates-ts โœ… Ready Aggregate collaboration and sequencing
004-cqrs-patterns-ts โœ… Ready Separate write/read models with projections
005-projections-ts โœ… Ready Analytics projections and reporting views
006-event-bus-ts โœ… Ready Event-driven interactions across bounded contexts
007-ecommerce-complete-ts ๐Ÿšง Placeholder Wiring for future full e-commerce workflow
007-inventory-complete-ts โœ… Ready Inventory lifecycle with projections and alerts
008-observability-ts โœ… Ready Operational metrics and health instrumentation
008-banking-complete-ts ๐Ÿšง Placeholder Scaffold for banking domain (commands TBD)
009-web-dashboard-ts โœ… Ready Express-based dashboard consuming projections

Run an example with:

make examples-001           # replace with desired example number
# or directly with pnpm:
pnpm --filter ./examples/001-basic-store-ts run start -- --memory

๐Ÿ› ๏ธ Development

Build Commands

# Build everything
make build

# Build specific components
make event-store
make event-sourcing
make examples
make tools

Testing

# Run all tests
make test

# Test specific components
make test-event-store
make test-event-sourcing
make test-examples

Quality Assurance

# Run QA checks on everything
make qa

# QA specific components
make qa-event-store
make qa-event-sourcing
make qa-examples

Service Management

# Start development services (PostgreSQL, etc.)
make start-services

# Stop development services
make stop-services

# Run smoke tests against services
make smoke-test

๐Ÿงช Testing

Current automated coverage focuses on the pieces that ship today:

  • Rust event store โ€“ cargo unit + integration tests cover the core traits, in-memory backend, Postgres backend, and gRPC server wiring. Postgres tests automatically spin up Testcontainers when a local database is not available.
  • TypeScript event-sourcing SDK โ€“ Jest tests validate aggregate lifecycle, optimistic concurrency, and event serialisation helpers.

Planned additions (not yet automated):

  • Cross-language SDK compatibility suites (Rust โ†”๏ธŽ TypeScript โ†”๏ธŽ future Python).
  • Example-level end-to-end checks and smoke tests for each scenario.
  • Performance/stress benchmarks and observability regression tests.

๐ŸŽฏ Core Principles

  1. Domain Focus: Event Store and Event Sourcing define the rules of the event sourcing domain
  2. Living Documentation: Examples demonstrate how to use core packages to build real applications
  3. Progressive Learning: Examples build from basic concepts to complete systems
  4. No Mocks: All examples use real working code with actual databases
  5. Future Extensibility: Architecture supports future event modeling and code generation

๐Ÿ”ฎ Future Plans

Event Modeling Package

  • Code generation from event models
  • Domain-specific language for event modeling
  • Multi-language code generation
  • Scaffolding and boilerplate reduction

Additional Backends

  • KurrentDB backend
  • Kafka backend
  • EventStoreDB adapter
  • Custom backend implementations

Enhanced Tools

  • Advanced CLI features
  • Web UI enhancements
  • Code generation tools
  • Event modeling tools

๐Ÿ“– Documentation

Each component has comprehensive documentation:

๐Ÿค Contributing

We welcome contributions! Please see our contributing guidelines and code of conduct.

Getting Started

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Run make qa to ensure quality
  6. Submit a pull request

Development Workflow

  1. Run make setup for initial setup
  2. Use make dev-setup for development environment
  3. Use make build and make test during development
  4. Use make qa before submitting changes

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿท๏ธ Status

  • โœ… Event Store (Rust) โ€“ Memory and Postgres backends with a production-ready gRPC surface.
  • โœ… TypeScript SDK โ€“ Drives all current examples; adding richer patterns iteratively.
  • ๐Ÿ”„ Rust SDK โ€“ Early alpha; core abstractions present, feature parity in progress.
  • ๐Ÿ“‹ Python SDK โ€“ Placeholder directory waiting for implementation.
  • ๐Ÿ”„ VSA Tool โ€“ Vertical Slice Architecture Manager in planning phase. See vsa/README.md for details.
  • โœ… Examples โ€“ TypeScript examples 001โ€“006, 007 inventory, 008 observability, and 009 dashboard are runnable today.
  • ๐Ÿšง Examples (future) โ€“ 007 e-commerce and 008 banking are scaffolds awaiting domain logic.
  • ๐Ÿšง Infra-as-code & docs-site โ€“ Module scaffolding exists; provider-specific stacks and walkthroughs are being built.

๐Ÿ“š Inspiration & References

This platform draws inspiration from and builds upon the work of leading event sourcing practitioners:


This platform serves as a comprehensive foundation for event sourcing applications, providing both the low-level event storage and high-level patterns needed to build robust, scalable systems.

About

Polygot event-sourcing infrastructure including modular event-store with support for different DBs.

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •