- TypeScript 95%
- Nix 4%
- HTML <1%
EloRank #
Rank a list of items by 1v1 matchups. Every comparison updates both items' Elo ratings, and a leaderboard falls out of the accumulated results.
Entirely client-side: IndexedDB is the database, the app works offline as an installable PWA, and the build output is static files behind Caddy. Nothing is ever sent anywhere.
Stack #
| Runtime | Deno 2 |
| Build | Vite 7 + TypeScript |
| UI | React 19, vanilla Chakra UI v3 |
| Routing / state / tables / forms | TanStack Router, Query, Table, Form |
| Storage | Dexie 4 over IndexedDB |
| Packaging | Nix flake → static site → Caddy |
Vite is pinned to 7.x deliberately: Vite 8's Rolldown NAPI binding has known resolution problems under Deno.
Develop #
deno task dev
Other tasks: deno task test (domain logic), deno task check (types),
deno task build, deno task preview.
With Nix, nix develop provides deno, caddy and nixfmt.
Build and serve #
nix build
result/ is the static site. Serve it with the supplied config:
cp Caddyfile.example Caddyfile && caddy run --config Caddyfile
Caddyfile.example handles the SPA fallback so deep links survive a refresh,
and sets cache headers that let PWA updates through.
Dependencies are fetched by a fixed-output derivation in nix/deps.nix. Its
outputHash must be updated whenever deno.lock changes: run nix build, let
it fail, and copy the got: hash.
How it is organised #
src/domain/ pure logic: elo, pairing, category tree. No I/O, fully unit tested.
src/db/ Dexie schema + repositories. The only modules touching IndexedDB.
src/queries/ TanStack Query hooks wrapping the repositories.
src/routes/ file-based routes; the screens.
src/components/ shared UI.
The dependency direction is one-way: routes → queries → repositories → Dexie,
with domain usable from anywhere because it depends on nothing.
Model #
Category is a tree (parent pointer), but only items in the exact same
category ever face each other — nesting organises, it does not pool ratings.
Each Matchup stores the ratings from before the result as well as after, so
the most recent matchup can be undone exactly rather than by inverting the Elo
arithmetic.
Ratings start at 1200 with a K-factor of 32; both are adjustable in Settings. Draws are supported. Items with fewer than three matchups are shown as provisional.