Git Event Store

Draft specification 0.23.0 · implementation in progress

Store your events in the Git repository that holds your code

The Git Event Store specification (GES) shows how. Clone the repository and you have the events too. There is no server to run.

Read the specificationGive feedback

CrumblES, the reference implementation, is being built. The specification stays the authority on what conforms.

Illustrative output
$ git log --oneline refs/ges/orders/streams/order-42
7f3a91c order-42: OrderShipped
c41d7a6 order-42: OrderPlaced
Your events, as git log shows them.

Your record and your code drift apart

Your events live in a database or an event-store server, outside your repository. Soon nobody can say which commit produced which event.

TODAYCode repositoryEvent-store server?Two places, two states.Which commit produced which event?Server, credentials, driver and backupare extra to run.
The record lives outside the repository and drifts from the code.
WITH GESOne Git repositoryrefs/heads/…refs/ges/…One clone, one backup.Code and events travel together.No server to run.
Events sit in the repository, under their own refs.

Keep both in one repository

GES maps events onto things Git already has.

Order placedcommit 1Item addedcommit 2Order shippedcommit 3refpoints tothe newestEvent = commitStream = refWrite = move the refone commit per eventa named pointer to the newest commitonce, and only if it hasn't moved
A crash before the ref moves leaves the stream unchanged.

What you get

Two people write at once? The second one looks again

Every write carries a check. If something changed since you read, the write is refused.

1 Read2 Decide3 Write, with a checkAnything newsince I read?noSavedyesRefused. Look again.
The specification calls this a Dynamic Consistency Boundary: the write names what it depends on.

Saving has three steps, not one

A database does all three at COMMIT. GES keeps them apart, so you can write offline.

  1. 1

    Visible

    Others on this clone can see it.

  2. 2

    Durable

    It survives a power cut.

  3. 3

    Authoritative

    The main copy accepted it.

What GES won't do

The specification says so in section 1, before its goals.

Three steps

  1. 1

    Read the core specification

    Start with the scope, the terms and the conformance clauses.

  2. 2

    Check the limits

    One writer per stream and no quorum writes must be fine for you.

  3. 3

    Build it or question it

    Implement the specification, or tell us where it is unclear.

You can test a store against it

The specification defines when a store conforms. These are the numbers.

23
conformance clauses
31
acceptance tests
150
requirements in the Easy Approach to Requirements Syntax (EARS)
13
behavioural modules in the Allium language

GES isn't the standard for event sourcing in Git yet. Independent implementations would earn it that title.

License and contributions

The license isn't chosen yet, on purpose. Until it is, all rights stay with the author. The choice comes before the specification is finalized. Contributions are welcome: open an issue or a pull request in the repository.

Start with the specification

Prefer the reasoning first? Read thereview of gaps and edge cases or thedecision to put the Dynamic Consistency Boundary in the core.

Read the specificationGive feedback