Simple demo app that shows realtime cryptocurrency prices using Socket.IO and CoinGecko.
Quick start
- Install dependencies
npm install- Start server
npm startNotes
- If you have a CoinGecko PRO API key, set it in an environment variable named
COINGECKO_API_KEY(or create a.envfile with that variable) — the server will automatically send it using thex-cg-pro-api-keyheader.- To set it easily on your machine without editing files, run: Prices are polled every 10 seconds from the free CoinGecko API. Modifyserver/index.jsto change coin list or interval. If you have a CoinGecko PRO API key, set it in an environment variable namedCOINGECKO_API_KEY(or create a.envfile with that variable) — the server will automatically send it using thex-cg-pro-api-keyheader. - To set it easily on your machine without editing files, run:
npm run set-key -- YOUR_API_KEY_HEREThis will write a local .env (ignored by git). Do NOT paste your API key
into source files or commit it to version control.
- Polling/backoff: the server polls CoinGecko and will automatically back off if it receives HTTP 429 (rate limit). You can change default timing with
export POLL_INTERVAL_MS=10000
export MAX_POLL_INTERVAL_MS=120000