Engineering · Backend · Live opsSample post
A game backend a phone clock can't cheat
Lives, daily rewards and leaderboards break if the game trusts the phone's clock. Here is how we keep timers and scores honest on the server.

Many mobile games give you a life back every 30 minutes or a reward once a day. The easy way to build that is to read the time on the phone. The problem: anyone can change the time on their phone.
The server keeps the time
In our games, timers and rewards are worked out on the server, which runs on Node.js with PostgreSQL. The phone asks “how many lives do I have?” and the server answers. Changing the phone’s clock changes nothing.
Scores are checked, not trusted
Leaderboard scores arrive with the moves that produced them, and the server checks they add up. A score that could not have happened never reaches the board.
Purchases are verified
Every in-app purchase is checked with Apple or Google before anything is unlocked.
A panel for the team
An admin panel lets the team look up a player, fix a wallet or hide a cheater, and every change is written to an audit log. We build the same setup for client games.

