Skip to content

Per-game web routes and a Homefelt home on play.homefelt.io

Context and problem

Once the game was live at play.homefelt.io, the question was what a second game would do to it. That address was Canasta: every page, and the engine, belonged to one game. Whatever changed, the links that matter most had to keep working: invites (/join/…) and tables (/table/…) that people share.

Options considered

  1. Leave play.homefelt.io as Canasta until a second game exists, and move things then.
  2. Move Canasta under its own path now, with a Homefelt home at /, keeping the platform’s pages (sign-in, lobby, invites, tables) at the URLs they already have.

Decision

We chose option 2 (#130, #131):

  • / is the Homefelt home: a card per game, your online tables across games when signed in, sign-in, and the display settings every game shares.
  • Canasta moves to /canasta. The marketing site’s Play buttons link straight there, so nobody coming from the site gets an extra click.
  • /online, /join/* and /table/* stay where they are, as platform routes that send each table to its game. A not-found page links home.
  • One game registry (web/src/games.ts) lists each game’s id, name, path and a lazy load(); the home and the router read it, and nothing else names a game’s path.
  • Each game’s UI and Wasm engine load only on its own pages, so / fetches no .wasm.
  • The server and the protocol don’t change. Tables get a game id when there is a second game to tell apart, not before.

Consequences

Good

  • Links shared today keep working after a second game exists.
  • The home stays light: about 76 kB of gzipped JavaScript and no engine, against 234 kB more of WebAssembly on /canasta.
  • A second game is a registry entry and a route subtree, not a reshuffle of the app.

Bad

  • Until the server stores a game id, gameForTable answers canasta for every table: a placeholder that game two has to replace, along with a game id on tables, invites and the hello.
  • The online lobby still loads Canasta, because its New table form lists Canasta’s rule sets.
  • Someone who types play.homefelt.io now lands on a home with one game on it, one click from playing.
  • The routes live in three places that must agree: the registry, web/vercel.json’s rewrites, and the site’s Play links.

More information

  • Issue #130 lists the decisions under 2026-11-23; the diary tells them on day 5, 2026-11-22. PR: #131.
  • Diary: Day 5, “Making room for the second game”.
  • “Web routes” in docs/architecture.md; the Vercel rewrites in docs/deploy.md.