Detour – playdetour.com
Introduction
Detour (playdetour.com) is an arcade of browser games. Each game takes a few minutes to play, works on a phone, and needs no account and no install. Twenty-six games are live, from daily logic and word puzzles to card games and online two-player strategy games like Chess and Checkers.
I originally built it for my friends and me, and it has since grown into a full web app with daily puzzles and an archive of past days, online multiplayer rooms, optional accounts with synced stats, a leaderboard, a shared design system, and an automated test and deployment pipeline. This page walks through how it’s put together and the decisions behind it.
The source repository is private, so this page explains the architecture and includes only short excerpts rather than a full code walkthrough.
Objectives
- Make games people can start in seconds: no sign-up, no install, no tutorial wall.
- Keep every game fast to play on a phone, including one-thumb play on a 360 px-wide screen.
- Give daily puzzles that are the same for everyone, and keep every past day playable exactly as it was.
- Support online play without asking anyone to make an account.
- Offer accounts as an optional extra (stats that follow you between devices, a spot on the leaderboard) that a guest never has to think about.
- Build the site so that adding a new game is a repeatable checklist, not a rewrite.
- Keep a consistent look, feel, and voice across every game.
The Games
The home grid can be filtered by type (Strategy, Logic, Word, Cards, Memory, Explore), by Daily, and by Multiplayer.
| Game | Type | Daily | Online | What it is |
|---|---|---|---|---|
| Wiki Race | Explore | Yes | Yes | Click from one Wikipedia article to a target. Daily pair, free play, or race friends. |
| Ultimate Tic-Tac-Toe | Strategy | No | Yes | Nine boards, one game. Your move picks where they play next. |
| Chess | Strategy | No | Yes | Full official rules. Bot (three levels), online room, or local. |
| Checkers | Strategy | No | Yes | American checkers, plus Russian and International draughts. |
| Fourward | Strategy | No | Yes | Drop chips and line up four. Bot, online room, or local. |
| Deep Scan | Strategy | No | Yes | Hide a fleet, call shots, and sink theirs. |
| Dots and Boxes | Strategy | No | Yes | Draw lines, close boxes, go again. Two to four players. |
| Turf War | Strategy | No | Yes | Flood the board with color. First past half wins. |
| Lights Out | Logic | Yes | No | A tap toggles a light and its neighbors; turn them all off. |
| Spaced Out | Logic | Yes | No | One star per row, column, and region, with no two touching. |
| Minesweeper | Logic | No | Co-op | Classic mines with a safe first click, plus a two-player co-op board. |
| Nonogram | Logic | Yes | No | Fill the grid so every row and column matches its clues. |
| Mini Sudoku | Logic | Yes | No | Sudoku rules on a quick 6×6 grid. |
| Equinox | Logic | Yes | No | Balance suns and moons, never three in a row. |
| Scenic Route | Logic | Yes | No | Draw one path through every cell, passing each number in order. |
| Subdivision | Logic | Yes | No | Divide the grid into patches, one number and one shape each. |
| Four-Way Stop | Logic | Yes | No | Slide every tile at once; group four to clear the board. |
| Gridlock | Logic | Yes | No | Swap numbers until every row and column runs 1 to 7. |
| Long Haul | Word | Yes | No | Guess a 3-letter word, then 4, all the way up to 8. |
| Wayword | Word | Yes | No | Turn one word into another, one step at a time. |
| Crossroads | Word | Yes | No | Find the themed words that fill the whole grid. |
| Crosswalk | Word | Yes | No | Swap scrambled letters until six crossing words line up. |
| Final Call | Cards | Yes | No | One deal a day. Call the cards right, then survive the ride. |
| Dungeon Draw | Cards | No | No | A deck of cards is the dungeon. Fight, heal, get out alive. |
| Recall | Memory | Yes | Yes | Repeat a growing pattern of colored pads. Endless, daily, or race rooms. |
| Double Take | Memory | Yes | No | Flip cards and find all 12 pairs against the clock. |
Tech Stack
| Layer | Technology |
|---|---|
| Framework | TanStack Start (React 19, file-based routes, server routes for /api/*) |
| Build | Vite, with Nitro producing a plain Node server |
| Styling and animation | Tailwind v4 plus scoped per-game CSS, motion |
| Hosting | Appwrite Sites (every push to main deploys) |
| Shared state | Appwrite Databases (rooms, feedback, daily caches, leaderboard, anonymous daily counters) |
| Live updates | Appwrite Realtime (room pushes) |
| Accounts (optional) | Appwrite Auth, email and password |
| Player data | Browser localStorage, synced to the account when signed in |
| Unit tests | Vitest |
| End-to-end tests | Playwright |
| CI | GitHub Actions |
Architecture
The browser does most of the work. Everything a guest owns lives in their own browser. The server is involved only when players must share state (online rooms), when something is expensive to compute or must never change (some daily puzzles), or when something has to be stored (feedback, optional accounts, leaderboard rows, and anonymous “today’s players” counters).
flowchart LR
P[Player's browser<br/>React app + localStorage]
S[Appwrite Sites<br/>Node server: SSR + /api routes]
D[(Appwrite Databases)]
RT[Appwrite Realtime]
A[Appwrite Auth<br/>optional accounts]
P -->|page loads, actions,<br/>daily puzzles, feedback| S
S -->|the only writer| D
S --> A
D -->|room changes| RT
RT -->|push| P
Browsers never write to Appwrite directly. Every write goes through an API route that holds the server key, validates the request, and applies rate limits.
Project structure
The layout is organized around the idea that a game is a self-contained folder plus a manifest:
src/
routes/ File-based routes: home grid, one thin stub per game, API routes
games/
registry.ts Discovers every game's manifest automatically
<slug>/ One folder per game
manifest.tsx Copy, icon, card art, type, daily/online flags, SEO text
engine/ Pure game rules, with tests beside them
bot/ Computer opponent (strategy games)
rooms/ Server-side room logic (online games only)
stats.ts Which stats sync to an account
share.ts What "Copy result" shares
styles.css CSS scoped to that game
components/detour/ Shared design system
hooks/ Shared hooks (daily state, daily date, local stats, loading phases)
lib/ Dates, seeded randomness, rooms, accounts, stats, leaderboard, rate limitsKey Design Decisions
1. Games described by a manifest
Each game exports a manifest: its tagline, time estimate, colors, icon, card art and background pattern, type, whether it has a daily or online play, which leaderboard it has, and all the search-page copy (title, description, how to play, tips, FAQ). A registry finds every manifest automatically, and the rest of the site is built from that list:
- The home grid renders one card per manifest, and its type, Daily, and Multiplayer filters read the manifest.
- The sitemap, structured data for search engines, the link-preview images, the archive, and the leaderboard all read from the registry.
- Each game’s route is a thin stub that builds its page metadata from the manifest.
Tests enforce the checklist: every game must have full page copy, a valid share format, a background pattern that doesn’t repeat near it on the grid, and (for dailies) an archive start date.
2. Game rules kept separate from the UI
Rules live in a pure engine/ folder with no UI in it, with unit tests beside it. The React components only render state and send player actions to the engine. Strategy games add a bot/ folder for the computer opponent and a rooms/ folder for online play, all built on the same engine. Chess, for example, checks its move generator against published move counts, and the server re-runs every online move through the engine.
3. A shared design system
Every game lives inside the same frame. GameShell provides the header with the game’s icon, a how-to-play dialog, and the footer, and a library of shared components covers the rest: buttons, badges, dialogs, menus, toasts, result cards, a confetti celebration, loading skeletons, a sound toggle, and the feedback form. A BRAND.md document defines colors, type, motion, and voice.
A few rules keep twenty-six games looking like one product:
- Card art follows written rules (fixed canvas, consistent padding and strokes, one moving element), and every card banner has one of ten shared background patterns.
- CSS is scoped per game (
.game-<slug>), because styles bleeding between games was the most common breakage early on. - Interface sounds come from one small audio engine and play only in response to something the player just did.
- Dark mode is per game and only ever the player’s choice; shared styles use color tokens so they follow along.
- Reduced motion is respected everywhere, with a still version of every animation.
4. Guests first, accounts optional
Stats, streaks, personal bests, settings, and in-progress boards all live in localStorage, under a consistent naming scheme (detour-<game>-state, detour-<game>-stats, and so on), behind a storage wrapper that never throws, because storage can be blocked or full and a game shouldn’t crash over it.
Accounts were added later as a strictly optional extra. A guest makes no account request and never sees an account prompt on a game page. Signing in only adds two things:
- Synced stats. Games read and write stats through one small layer. When a player is signed in, that layer also saves them to the account, so a daily finished on a phone is finished on the laptop too.
- The leaderboard, ranked by display name, which a player can opt out of at any time.
Accounts use email and password and must verify their email first. The browser never talks to Appwrite about accounts: the server creates the session and sets an HttpOnly cookie. Display names (and room names) pass a shared check for length, reserved names, and a profanity filter, enforced on the server.
5. Daily puzzles and the archive
The whole site agrees on “today” by using the player’s local calendar day, through one helper, rather than UTC. Inside a daily game the date comes from a single hook, which is either today or a past day opened from the archive. Each game then produces its daily in the way that fits it:
| Approach | Games | How it works |
|---|---|---|
| Curated list | Wiki Race | A date-seeded hash picks from a curated list of article pairs. |
| Generated on the client | Lights Out, Nonogram, Mini Sudoku, Equinox, Scenic Route, Subdivision, Four-Way Stop, Final Call, Recall | A PRNG seeded from the game name and date builds the board. Cheap, so no server needed. |
| Generated on the server and cached | Spaced Out, Wayword, Crosswalk, Gridlock, Double Take | Generation is slow (uniqueness checks, word-graph searches), so the first request stores the board and everyone gets the same one. If the server can’t be reached, the client builds the same board itself. |
| Curated rows in the database | Long Haul, Crossroads | Hand-picked answers and placed grids are stored as rows and served by an API route. |
The archive (“The Rearview”) lets players open any past day and play it. A past day must never change, so editable content (word lists, queues) is recorded in a puzzle ledger, and pure generators are pinned so a code change can’t alter a day already played. Archive plays count toward a player’s own stats but never toward today’s streak, today’s results, or the leaderboard.
6. Online rooms without accounts
Ten games have online rooms (Chess, Checkers, Fourward, Deep Scan, Dots and Boxes, Turf War, Ultimate Tic-Tac-Toe, Wiki Race, Recall races, and co-op Minesweeper), all built on one shared, game-agnostic room store. Each game supplies only its own rules.
- Storage: each room is a row in Appwrite Databases, never publicly readable.
- Concurrency: every write is a compare-and-set on a version number, so two players acting at once can’t overwrite each other.
- Trust: the server validates every action and is the only writer. Clients send intent, not results. Deep Scan’s tests play whole games to check no response ever leaks a ship the reader shouldn’t see.
- Sync: changes are pushed over Appwrite Realtime on per-room channels derived from a server secret, with a 10-second heartbeat as a safety net. Without Realtime, clients fall back to polling once a second.
- Identity: a random
playerIdkept inlocalStorage, never shown to other players. Rooms never use a player’s account.
7. Sharing and comparing results, privately
- Copy result shares a daily’s outcome as text and emoji, never the answer, since everyone gets the same puzzle. A test checks every game’s share format.
- Today’s players shows how a result compares (“faster than 68% of today’s players”) from one row of anonymous counters per game per day, updated only with atomic increments. No player id or per-result row is stored, so guests count too.
- Link previews for shared results are drawn on the server, so a pasted link unfurls with the result.
8. Feedback, changelog, and rate limits
The footer’s Feedback form stores only the message and a timestamp, with a honeypot field for bots. A public changelog (“Trip Log”, with an RSS feed) is written for players in plain language and updated in the same PR that ships each change. Every API route is rate-limited by IP address, with counts shared across server instances in the database.
Testing and Deployment
Testing. Unit tests live next to the code they cover: every engine, every bot, every room service, and the shared helpers. Repo-wide tests act as guard rails for the conventions above (manifest copy, share formats, date handling, card patterns, page zoom). A Playwright smoke test visits every route on the built server.
CI/CD. GitHub Actions runs typecheck, lint, an unused-code check (knip), a formatting check, the link-preview image check, unit tests, a production build, and a check of what a search crawler sees on every game page, on every pull request and every push to main. Appwrite Sites, connected to the GitHub repo, then deploys main to production.
Summary
Detour started as a way to play quick games with friends and became a growing product: twenty-six games built from one manifest-driven registry, a shared design system, guest-first persistence with optional synced accounts, date-seeded daily puzzles with a permanent archive, server-validated multiplayer pushed over Realtime, privacy-preserving result comparisons, and a CI pipeline that tests and deploys every change. The through-line is keeping each piece simple, making the failure cases explicit, and never making a guest pay for a feature they didn’t ask for.