Skip to content

J-Tech-Japan/SuperSimpleEventSourcing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SuperSimpleEventSourcing

A Sample Event Sourcing Demo with Sekiban.Pure

This repository provides a very simple demonstration of event sourcing.

Event sourcing is a simple concept: save events, and project the current state using a projector.

Included here are a lightweight event sourcing library and a sample domain, making it a great starting point for understanding how event sourcing frameworks can be built.

It also comes with a minimal Web API (with a scalar UI), a simple console application, and straightforward unit tests.

Limitations

Events are stored in a simple List<IEvent>—this is purely in-memory and not meant as a production-ready persistence layer. Additionally, we only have projection at the partition level, so you cannot create live projections that list all aggregates.

Project Overview

  • Domain: A simple event sourcing framework and sample domain.
  • Web: A basic Web API.
  • Console: A simple console application.
  • Test: Basic xUnit tests.

Note: Querying and listing existing aggregates is not currently implemented.

Key Components

  • Aggregate: Represents the state container, which changes throughout its lifecycle.
  • Command: Triggers changes to an Aggregate. Commands are processed by a command handler and affect only a single partition.
  • Command Handler: A function that produces events in response to a command.
  • Event: A fact that is stored as the source of truth.
  • Partition: A stream of events. Aggregates can be reconstructed (projected) from these events.
  • Projector: A function that applies events to evolve the aggregate’s state, returning a new state.

Language 1. (C#)

C# is the language we first developed Sekiban. This is updated concept of new Sekiban. It is still very simple yet powerful enough to extend in future Sekiban.

https://github.com/J-Tech-Japan/SuperSimpleEventSourcing/tree/main/csharp

Web API Usage Sample

Language 2. (Rust)

With my limited knowledge and help of LLM, I have completed very very simple Rust implementation. In console you can see it can send command and change aggregate. Change Suggestion welcomed!

https://github.com/J-Tech-Japan/SuperSimpleEventSourcing/tree/main/rust

Language 3. (Go)

With my limited knowledge and help of LLM, I have completed very very simple Go implementation as well. In console you can see it can send command and change aggregate. Change Suggestion welcomed!

https://github.com/J-Tech-Japan/SuperSimpleEventSourcing/tree/main/go

Language 4. (Typescript)

I use typescript for Frontend but not often. It was first time to write as backend component, first concept is made for the console application. Change Suggestion would be welcomed!

https://github.com/J-Tech-Japan/SuperSimpleEventSourcing/tree/main/typescript

Other Languages might coming...

  • F#

maybe.

Next Steps

We are extending these concepts in the Sekiban project:

https://github.com/J-Tech-Japan/Sekiban

We are continually improving domain modeling approaches. While the concepts here are still under development, Sekiban already supports Azure Cosmos DB, DynamoDB, and PostgreSQL. It offers a full-featured environment for building event-sourced applications for small to medium projects, and we are working towards better support in distributed environments.

About

Sample Event Sourcing with Sekiban.Pure

Resources

License

Stars

17 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors