App

Trivia Atlas is a fully static SvelteKit single-page application. It uses adapter-static with index.html as the SPA fallback. There is no application backend and no registered service port; nginx serves the generated files directly.

Build-time corpus

The build begins by running scripts/build-corpus.mjs. It reads the atlas repository and writes src/lib/corpus.json, then Vite bundles that generated file into the static app.

The generated object has this contract:

PropertyContents
built_atISO-8601 timestamp for snapshot generation.
runcorpus_run_id and as_of_date copied from meta/run.json.
categoriesOrdered category slugs from meta/taxonomy.json.
difficultieseasy, normal, and hard.
bucketsEvery <category>/<difficulty> key with accepted, remaining, and status.
cardsAccepted public cards, each augmented with sources.

Source entries retain only url and domain. They are joined to cards by ID from meta/verification.jsonl; a card without a matching sidecar record receives an empty source list.

Because corpus.json is generated before bundling, the deployed app is a snapshot rather than a live view of repository files.

Seeded runs

Quiz order is deterministic for a given seed:

  1. xmur3 hashes the seed string to a 32-bit number.
  2. mulberry32 turns that number into the pseudorandom stream used for Fisher–Yates card shuffling.
  3. Each card’s choices use a separate seed formed from the run seed and card ID.

The daily seed is exactly:

'daily:' + new Date().toISOString().slice(0, 10)

The date is UTC, so every player receives the same ordered daily run of up to 10 cards on a given day. Bucket and mixed runs use fresh random UUID seeds instead.

Browser-local progress

The app stores progress in two best-effort localStorage records:

KeyValue
triv.v1.historyPer-card seen and correct totals, keyed by card ID.
triv.v1.dailyDaily score and total, keyed by UTC date.

Read failures return empty records and write failures are ignored, so storage restrictions do not prevent play. Progress is local to the current browser profile; there is no account or server synchronization.

Rebuild after corpus changes

cd /home/loca/dev/triv && npm run build

The app snapshots the corpus at build time. Run this command after every accepted corpus change before publishing the refreshed static build.

See Corpus for the public card schema and Pipeline for the acceptance path that produces it.