A real-time web dashboard showing prices and 7-day trends for Bitcoin, Ethereum, Solana, Cardano, and Dogecoin. Data is fetched from the CoinGecko public API (no key required) and cached server-side.
- Python 3 + Flask — REST backend with in-memory cache
- CoinGecko API — public, no registration or API key needed
- Chart.js — 7-day line chart, imported via CDN
- Vanilla JS — fetch API, skeleton loading, event delegation
Browser ──GET /api/prices──────▶ Flask (app.py) ──▶ CoinGecko API
◀──JSON [{ coin... }]──
──GET /api/history/{id}─▶ Flask (app.py) ──▶ CoinGecko API
◀──JSON { prices: [] }──
Flask is not a simple pass-through: it applies a 60-second in-memory cache per endpoint to respect CoinGecko's free-tier rate limit and reduce perceived latency.
cd cryptoboard
pip install -r requirements.txt
python app.pyOpen http://localhost:5001 in your browser.
- In-memory cache with TTL — avoids hitting CoinGecko on every page refresh; Redis would be the production equivalent
coin_idallowlist validation — the URL parameter is checked against a fixed set before any external call is made, preventing arbitrary API forwarding- Skeleton loading — shimmer placeholders appear instantly while prices load, eliminating blank state
- Chart update without re-render — clicking a second coin updates
chart.dataand callschart.update()for an animated transition instead of destroying and recreating the instance - CSS custom properties for coin colors — hex values defined once in
:root, consumed by both CSS (card border) and JS (chart line color)