A dependency-free snapshot dashboard: http.server + sqlite3, and the ALTER TABLE trap
Background I run more than twenty small sites as a solo developer. Publishing is automated; looking at the results was not. Google Analytics and Search Console are both fine for one site, but opening two consoles per site, aligning the date ranges, and remembering yesterday's number does not scale to twenty. I stopped doing it after three days. So I put a small server on a Mac mini at home and…
Three components make up the dependency-free snapshot dashboard: a collector, a Python server, and SQLite storage. The collector gathers data from Google Analytics and Search Console, sending it to the server via an authenticated POST request. The server appends the data to SQLite and serves the dashboard HTML. Using threading for the HTTP server prevents blocking requests, such as a browser's favicon request, which could disrupt the HTML response.
When a push occurs, a new row is created in the snapshots table, while site metrics are stored in site_metrics with a linked snapshot_id. The design allows for append-only storage, making adding new metrics inexpensive as no backfilling is required.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.