The US Debt Clock That Actually Updates in Real Time (WebSocket-Powered)
Most "real-time" debt clocks are fake — they just animate a counter based on a hardcoded rate. I wanted one that actually fetches from live government data sources.
What I Built
A FastAPI backend with WebSocket connections that pushes live updates to the client. Data sources:
- US Treasury — actual debt figures updated daily
- FRED (Federal Reserve Economic Data) — economic indicators, GDP, inflation
- Calculated rates — debt growth per second derived from Treasury data trends
How the "Real Time" Works
The Treasury updates the total public debt figure daily. I fetch that figure, calculate the per-second growth rate based on recent trend data, and push incremental updates via WebSocket so the number on screen actually moves.
This is honest about what "real time" means for government debt — the underlying figure is updated daily, but the display interpolates realistically between data points.
Stack
FastAPI (backend)
WebSocket (live push)
Treasury Direct API
FRED API
Deployed on Render (free tier)
Why Build This
US national debt crossed $36 trillion in 2025. The number grows by approximately $100,000 per second based on current deficit trajectory. Most people have no visceral sense of that scale.
A live counter that actually moves makes the number real in a way that a static "$36.4T" does not.
Try it live — no login, no ads, just the number.
Top comments (0)