Skip to content

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 are not 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, but they are not the same. 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. It also takes in everything the in-game controllers report and writes it down. The website's code is generated from the backend, so a backend change turns into a build error in the website rather than a silent mismatch.

The data is backed up

The database is the one place all of Kacky's history lives, so it is copied every night, three ways:

  • To off-site storage on Hetzner (our sponsor), so there is a safe copy well away from the live server.
  • Into the dev environment, restored from that night's dump, so dev always works with a fresh, realistic copy of real data.
  • A physical copy on an admin's own machine, so there is always a backup that is not in the cloud at all.

Three copies, in three different places, refreshed daily. All three must fail at once for the database to be lost for good.

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 is the whole point of a single source of truth: there is no second opinion to argue with.