Overview
A blockchain event indexer with an analytics dashboard. A Solidity game contract emits events on a local Hardhat chain, a Node.js backend listens for them and stores them in PostgreSQL, and a React dashboard shows the results live. I built it to learn how indexing, caching and live updates fit together.
What it does
- Event indexing: the backend listens to contract events and stores them as they arrive. Events are written in batches of up to 50, flushed every second, and duplicates are skipped.
- Caching: an in-memory cache with per-endpoint TTLs of 5 to 60 seconds sits in front of the stats queries. The repo includes cache and load tests.
- Live updates: Socket.IO pushes new events to the dashboard, with block updates throttled to one per second so the client is not flooded.
- Analytics dashboard: player leaderboard, event distribution and an activity timeline.
- Docker setup: the contract, backend, database and frontend start together from the compose files.
Technical notes
Each stats endpoint gets its own TTL. The platform stats expire after 5 seconds, the leaderboard after 30, and the event distribution and timeline after 60. Batching the writes and throttling the socket both exist to keep the system steady when a burst of events lands at once.