After static JSON couldn't handle scores anymore, I added a Node.js + Express + SQLite backend. On day one, I ran into scores being overwritten, same-score rankings jumping around, and the leaderboard disagreeing with the database.
The root cause wasn't SQLite's performance. It was that I didn't understand SQLite's concurrent write model . Here's the debugging process and fix for all three traps, plus a framework for deciding what to use at each stage.
Environment
Node.js 20.11 + Express 4.18 + better-sqlite3 11.3
Test devices: MacBook Pro M1 (local load testing), Vercel Serverless (production)
Tools: autocannon concurrent load testing, SQLite .timer on query timing
Why I Moved from Static JSON to a Backend
In the first article, the MVP stored scores in localStorage , which meant they disappeared when you switched devices.…