r/tui • u/hustavojhon • 3h ago
Building a local-first TUI aggregator in Rust: Ratatui, SQLx/SQLite and an SSRF-safe HTTP client
SENTRI is a terminal app that collects opportunities (events, jobs,
hackathons) and tech news into a local SQLite database and ranks them.
A few things that were interesting to build:
- Cargo workspace split into core (pure domain), storage (SQLx), sources (connectors), app and TUI crates.
- Safe fetching: a reqwest client that resolves only public IPs, rejects HTTPS→HTTP redirects, enforces MIME allowlists and size limits, and uses ETag/Last-Modified for incremental refreshes.
- Parallel collection with a semaphore and per-source progress streamed to the UI, so the first screen fills in as sources answer.
- SQLite concurrency: deferred transactions failed with
SQLITE_BUSY_SNAPSHOTunder parallel writers; switching writes toBEGIN IMMEDIATEfixed it (regression test included). - Terminal width bugs: some glyphs (
✍, emoji with VS16) are one column forunicode-widthbut two for tmux, which broke borders.
Clippy pedantic with -D warnings, Rust 1.89+, edition 2024.
Repo: https://github.com/HustavoJhon/sentri
Happy to hear how you'd structure the connector layer differently.