Tetris metrics

2022-08-21

I play a lot of Tetris. I mainly play on tetr.io and my profile can be found here. To track my improvements at the game, I’ve built a dashboard to visualize my Tetris statistics.

Check it out at tetris.hbenjamin.com.

Architecture

The dashboard statistics are collected using a program I wrote, tetrio-metrics. This program polls the tetr.io API for recent games and saves them into a sqlite3 database.

A script in my tetrio-metrics-archive repository is responsible for dumping the sqlite3 database into a CSV file, then commiting the CSV file to GitHub.

The tetrio-metrics program is deployed onto my DigitalOcean VPS as a Docker container. The tetrio-metrics-archive script is executed as a cronjob.

The dashboard frontend can be found in the tetrio-metrics-web repository. The classless CSS framework is classless.de. The charting library is uPlot. The CSV parsing library is Papa Parse. The implementation is purely client-side: the client downloads the CSV file from GitHub, processes the data, then renders it.