Backend and data¶
One service holds all of Kacky's truth: the backend. Everything a player sees (a record, a rank, whether a server is live) is a value the backend decided and stored. Nothing else gets to be the authority.
What it stores¶
The backend keeps the core things in a database. The handful worth knowing:
- Event: one edition's batch of maps, with its start and end.
- Map: a single Kacky map. Its real identity is a unique ID baked into the map file, not its number (map numbers aren't unique across the two series).
- Player: someone who plays in-game, optionally linked to a website account.
- Finish: every completion. One line for each time you crossed the finish.
- Record: a player's best online time on a map.
Events are made of maps; players rack up finishes and records against those maps. Finish and Record look similar and aren't: that split is the thing people trip on, and Records vs Finishes tells the full story.
How it serves everything¶
The backend feeds the website and the admin panel, and it takes in everything the in-game controllers report and writes it down. The website's code is generated to match the backend automatically, so the two can't quietly drift apart.
The data is backed up¶
The database is the one place all of Kacky's history lives, so it's copied every night, three ways:
- Into the dev environment at midnight, so dev always works with a fresh, realistic copy of real data.
- To off-site storage on Hetzner (our sponsor) at the same time, so there's a safe copy well away from the live server.
- A physical copy on an admin's own machine, so there's always a backup that isn't in the cloud at all.
Three copies, in three different places, refreshed daily. Losing the database for good would take all three failing at once.
Where the rules live¶
Rank cutoffs, what counts toward which edition, which times are trustworthy: that logic lives in the backend, in one place, not copied into every app. An app asks; the backend answers with the one true version. That's the whole point of a single source of truth: there's no second opinion to argue with.