A lightweight event sourcing library that logs and replays application state changes.
eventstream-lite is a zero-dependency event sourcing toolkit. Every state change in your app is recorded as an immutable event. You can replay, audit, and time-travel through your application state — stored in flat JSON files or SQLite.
const { EventStore, EventStream } = require('eventstream-lite');
const store = new EventStore('./events.json');
const orders = new EventStream('orders', store);
orders.append({ type: 'ORDER_CREATED', data: { id: 1, item: 'Book', qty: 2 } });
orders.append({ type: 'ORDER_PAID', data: { id: 1, amount: 29.99 } });
orders.append({ type: 'ORDER_SHIPPED', data: { id: 1, tracking: 'XYZ123' } });
// Replay all events
const state = orders.replay();
// Time-travel to a specific point
const pastState = orders.replayUntil('2025-01-15T10:00:00Z');- 📝 Immutable append-only event log
- ⏪ Full event replay from any point in time
- 🔍 Event filtering by type, aggregate, or time range
- 💾 JSON file or SQLite storage backends
- 🔔 Subscribe to event streams with callbacks
- 📊 Event timeline visualizer in terminal
- 🧩 Works with any Node.js framework
bash scripts/setup.sh && bash scripts/unlock-all.shSee CONTRIBUTING.md