Architecture Overview
Bydleni.rs is a CLI application with three subcommands:
fetch– download data from external sources into SQLitecompute– calculate affordability metrics from raw dataserve– start the Axum web server
Module structure
src/
main.rs -- clap CLI entry point
config.rs -- env-based Config struct
db.rs -- SQLite connection pool + migrations
fetchers/ -- data acquisition (FRED, CNB, CZSO, Sreality)
models/ -- database row types
compute/ -- business logic (affordability, tax, forecast, scenario)
server/ -- web server (routes, API, templates, scheduler)
Data flow
- Fetch: Each fetcher downloads data from its source and stores raw time-series rows in the
time_seriestable (EAV model). - Compute: The affordability module reads time-series data, applies Czech tax rules, and writes pre-computed rows to the
affordabilitytable. - Serve: The web server reads from
affordabilityand renders pages. Background scheduler re-runs fetch + compute every 6 hours.
Database
SQLite with WAL mode for concurrent reads. Two migration files:
001_init.sql–time_series,affordability,fetch_logtables002_phase3.sql– net wage columns, savings columns,example_listingstable