𝗕𝘂𝗶𝗹𝗱 𝗔 𝗗𝘂𝗿𝗮𝗯𝗹𝗲 𝗖𝗟𝗜 𝗧𝗼𝗼𝗹 𝗜𝗻 𝗥𝘂𝘀𝘁
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