An advent-calendar game for December: every day from the 1st to the 25th a new photo unlocks at 06:00 CET, and players guess the local time it was taken (HH:MM). The closer the guess, the more points.
Rust (axum, askama templates, SQLite via sqlx), server-rendered HTML, a few lines of JS for the countdown.
cargo run # http://localhost:7878, data in ./data
cargo testOpen http://localhost:7878, not 127.0.0.1: POST requests whose Origin differs from AOT_BASE_URL are refused.
To play outside December, debug builds accept a fake clock (it keeps ticking from the given instant). Release builds ignore it:
AOT_FAKE_NOW=2026-12-05T10:00:00Z cargo runPassword accounts work without any setup. OAuth needs the AOT_<PROVIDER>_CLIENT_ID/SECRET variables (see below).
All configuration comes from environment variables. See .env.example.
| Variable | Default | |
|---|---|---|
AOT_BASE_URL |
http://localhost:7878 |
Public URL. Used for OAuth redirects, the CSRF origin check, and Secure cookies when https |
AOT_LISTEN |
127.0.0.1:7878 |
|
AOT_DATA_DIR |
data |
Holds aot.db and pictures/ |
AOT_STATIC_DIR |
static |
|
AOT_{DISCORD,GITHUB,MICROSOFT}_CLIENT_ID / _SECRET |
unset | A provider appears on the login page only when both are set |
AOT_FAKE_NOW |
unset | Debug builds only |
Edition dates and scoring rules are code, in src/game.rs (EDITIONS). Add an entry for each new year,
and its name as edition.y<year> in every locales/*.toml.
cp .env.example .env # fill in domain, Traefik and OAuth values
mkdir -p data import && sudo chown 1000:1000 data
docker compose up -d --buildThe container joins the external Traefik network named by TRAEFIK_NETWORK and gets a router for AOT_DOMAIN
with TLS from TRAEFIK_CERTRESOLVER.
docker compose exec aot aot backup /data/backups/pre-deploy-$(date +%F).db
git fetch --tags && git checkout v2.1.0
docker compose up -d --build # the old container serves until the new image is built
docker compose logs --tail 20 aotMigrations run at startup and sessions survive the restart. To roll back, check out the previous tag and rebuild.
If that release changed the database schema, also restore the backup: stop the container, copy it over
data/aot.db, delete aot.db-wal and aot.db-shm, start again. docker image prune clears old images.
Register these at each provider (replace the domain):
- Discord:
https://<domain>/auth/oauth2-redirect/discord(scopeidentify) - GitHub:
https://<domain>/auth/oauth2-redirect/github(no scope needed) - Microsoft:
https://<domain>/auth/oauth2-redirect/microsoft(scopeUser.Read)
Provider tokens are used once at login to read the user id and are never stored.
Every admin task is a subcommand of the same binary. On the server, run it inside the live container with
docker compose exec aot aot <command> (locally: cargo run -- <command>). It uses the same database and settings.
Files the command reads go in ./import on the server, which the container sees read-only as /import.
Don't use docker compose run: the one-off container inherits the Traefik labels, and Traefik sends it part of the
traffic while it runs.
# Reads the answer from EXIF DateTimeOriginal, applies the rotation, shrinks to 1600px wide,
# writes a fresh JPEG with no metadata under a random name.
docker compose exec aot aot picture import /import/PXL_20250712_143205123.jpg \
--day 1 --location "Lisbon, Portugal" --date-hint "July"
# No EXIF time, or the camera clock was wrong? Give the local time yourself:
docker compose exec aot aot picture import /import/x.jpg --day 2 --time 14:30
docker compose exec aot aot picture edit --day 1 --location "Somewhere in Portugal"
docker compose exec aot aot picture listThe import prints the EXIF time, timezone offset and GPS position (with a map link) so you can check them.
A day whose picture is not imported yet shows "coming soon" once unlocked. Replacing a picture, or changing an
answer, is refused once players have guessed it (picture edit --time ... --force overrides).
docker compose exec aot aot user list
docker compose exec aot aot user hide <name> # unhide <name>
docker compose exec aot aot user rename <name> <new-name>
docker compose exec aot aot user reset-password <name> # prints a new random passwordRun once, before the game opens, so returning players log in to their old account and keep their name.
Empty the token fields of users.json first.
# with users.json, pictures.json and day-pics/ copied to ./import/v1 on the server
docker compose exec aot aot import-v1 \
--users /import/v1/users.json --pictures /import/v1/pictures.json --images /import/v1/day-picsEverything goes in one transaction: players, the 25 pictures (copied under random names) and all guesses. A player who already has a v2 account is reused, not duplicated. A second import is refused.
docker compose exec aot aot backup /data/backups/aot-$(date +%F).dbWrites a consistent snapshot while the server keeps running; it lands in ./data/backups on the host.
From cron, add -T (no terminal) and escape %: docker compose exec -T aot aot backup /data/backups/aot-$(date +\%F).db.
Players see the version in the footer of every page, and the release notes at /changelog.
- A PR with a change players can see adds a release at the top of changelog.toml and bumps
versioninCargo.toml: minor for features (2.1.0), patch for fixes (2.0.1). A test fails if the two disagree. - Internal changes (refactors, logs, CI) get neither.
- Once merged, CI tags the commit
v<version>. Deploy tags, notmain.
Until launch the version stays 2.0.0: visible changes add a note to the 2.0.0 release instead of bumping.
At launch, move the tag to the deployed commit: git tag -f v2.0.0 <commit> && git push -f origin v2.0.0.
The rules above apply from the first change after launch.
- Copy
locales/en.tomltolocales/<lang>.tomland translate it. A test fails if a key is missing. - Add the file to
CATALOG_SOURCESin src/i18n.rs. - Add
templates/about_<lang>.htmland a branch for it intemplates/about.html. - Optionally add
<lang> = [...]notes to the releases inchangelog.toml. Without them, the English notes show.
The language is picked from the browser's Accept-Language header, falling back to English.
MIT. The bundled 0xProto Nerd Font has its own license in static/fonts/.