eventsourced

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Event-sourced rebuild demo - account

A domain-neutral demonstration of event-sourced rebuild: a bank account whose balance survives a restart by replaying its event log, with no in-memory snapshot. In init the thrall rebuilds the balance from its event log; each deposit / withdraw appends an event and updates the balance.

The event log is an opt-in retention JetStream stream (event_log = true in the manifest), separate from the durable mailbox. With a persistent embedded JetStream (store_dir), the log

  • and therefore the rebuilt state - outlives stopping and starting aether up.

The same account is written in all three languages - main.go, account.ts, account.py - with identical behaviour. Pick one manifest below; the interaction afterwards is the same.

Run

Build the runtime once, then run one of the three variants.

export GOTOOLCHAIN=local
mise exec go@latest -- go build -o bin/aether ./cmd/aether

Go (aether.toml):

mise exec go@latest -- go build -o bin/account ./examples/eventsourced
cd examples/eventsourced
../../bin/aether up -f aether.toml

TypeScript (aether-ts.toml):

bun install
cd examples/eventsourced
../../bin/aether up -f aether-ts.toml

Python (aether-py.toml):

cd examples/eventsourced
python -m venv .venv
.venv/bin/pip install -r requirements.txt
../../bin/aether up -f aether-py.toml

In another shell (identical for every variant):

cd examples/eventsourced
../../bin/aether cast account deposit  '{"delta": 100}'
../../bin/aether cast account withdraw '{"delta": 30}'
../../bin/aether call account balance                     # -> 70

What to look for

Stop aether up (Ctrl-C) and start it again, then read the balance:

../../bin/aether call account balance                     # -> 70, rebuilt from the event log

The balance is the same after the restart even though nothing snapshotted the in-memory state - it was reconstructed by replaying the appended events. (Deleting ./.aether-store wipes the persisted log, so the next start rebuilds from an empty log back to 0.)

Documentation

Overview

Command account is a domain-neutral demo of event-sourced rebuild: a bank account whose balance survives a restart by replaying its event log, without any in-memory snapshot.

In init it rebuilds the balance from the event log; each deposit/withdraw appends an event and updates the balance. With a persistent JetStream (store_dir here), the balance is reconstructed after `aether up` is stopped and started again.

aether cast account deposit  '{"delta": 100}'
aether cast account withdraw '{"delta": 30}'
aether call account balance                     # -> 70   (and still 70 after a restart)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL