๐๐๐ถ๐น๐ฑ ๐ ๐๐๐ฟ๐ฎ๐ฏ๐น๐ฒ ๐๐๐ ๐ง๐ผ๐ผ๐น ๐๐ป ๐ฅ๐๐๐
Build a CLI tool with Rust. Use event sourcing to make it durable.
This tool is a to-do manager. It does not save the final state. It saves every action.
Actions include:
- Adding items.
- Completing tasks.
- Adding tags.
- Setting due dates.
Why use this method?
- You see every change.
- You rebuild state any time.
- Undo and redo are easy.
The system uses three parts:
- Domain model: handles the data.
- Event store: saves events to a file.
- CLI: takes your commands.
To keep it fast, use snapshots. A snapshot saves the state. The tool loads the snapshot. It reads the new events.
Testing is simple. Use unit tests for state changes. Use integration tests for the CLI flow.
Source: https://dev.to/therizwansaleem/building-a-small-durable-event-sourced-cli-tool-in-rust-k3j