Project overview

duels

Two strangers, one ~90-second head-to-head duel, no install and no account — a web platform where matchmaking, scoring, and every answer reveal run server-side at the edge, so the game stays fast and stays cheat-proof.

The stack, explained

svelteframework5.10

A UI framework built around a compiler that turns declarative components — written in HTML, CSS, and JavaScript — into lean, optimized JavaScript that surgically updates the DOM. There is no virtual DOM, so the browser ships and runs less code.

Here: powers the web app UI (via SvelteKit).

better-sqlite3db/orm12.9

A fast, simple library for using SQLite databases from Node.js through a synchronous API, where queries return their results directly instead of via callbacks or promises. It offers full transaction support over an embedded, file-based database.

Here: the SQLite driver behind database access in local development and tests (production runs on Cloudflare D1).

drizzle-ormdb/orm0.45

A TypeScript ORM that lets you define your database schema and run queries in TypeScript, with both a typed SQL-like query builder and higher-level relational queries. It is lightweight and serverless-ready, supporting PostgreSQL, MySQL, and SQLite plus its own migration tooling.

Here: defines the schema and runs all database queries.

better-authauth1.6

A framework-agnostic authentication and authorization library for TypeScript that handles email/password sign-in, social/OAuth providers, and sessions out of the box. A plugin ecosystem extends it with features like two-factor auth, multi-tenancy, and passkeys without much extra code.

Here: anonymous-first sessions, login, and passkey sign-in.

why this choice →
tailwindcssstyling4.0

A utility-first CSS framework where you style elements by applying small predefined classes (like flex or text-center) directly in your markup instead of writing custom CSS. It scans your templates and generates only the CSS you actually use, producing a small, optimized stylesheet.

Here: styles the whole UI.

vitebuild/test6.0

A modern frontend build tool and development server that gives near-instant startup and hot-module replacement while developing, then bundles optimized assets for production. In development it serves source files over native ES modules instead of pre-bundling everything.

Here: the dev server and production bundler.

vitestbuild/test2.1

A fast testing framework powered by Vite that reuses your project's Vite config and transform pipeline, so tests run with the same setup as your app, with TypeScript, JSX, and ESM support out of the box. It offers a Jest-compatible API plus watch mode, mocking, snapshots, and coverage.

Here: runs the unit and integration test suite.

full stack
Production
@better-auth/passkey ^1.6.9@opentelemetry/api ^1.9.1@simplewebauthn/browser ^11.0.0@simplewebauthn/server ^11.0.0canvas-confetti ^1.9.3jose ^6.2.3openskill ^4.1.1partysocket ^1.0.2
Dev
@cloudflare/workers-types ^4.20260502.1@eslint/js ^9.16.0@inlang/paraglide-js ^1.11.0@inlang/paraglide-sveltekit ^0.15.0@playwright/test ^1.49.0@sveltejs/adapter-cloudflare ^7.2.8@sveltejs/kit ^2.10.0@sveltejs/vite-plugin-svelte ^5.0.0@tailwindcss/vite ^4.0.0@types/better-sqlite3 ^7.6.13@types/canvas-confetti ^1.9.0@types/node ^22.10.0drizzle-kit ^0.31.10eslint ^9.16.0eslint-plugin-svelte ^2.46.0globals ^15.13.0jsdom ^26.0.0partykit ^0.0.115prettier ^3.4.0prettier-plugin-svelte ^3.3.0prettier-plugin-tailwindcss ^0.6.0sharp ^0.33.5start-server-and-test ^2.0.12svelte-check ^4.1.0svelte-eslint-parser ^0.43.0tsx ^4.19.2typescript ^5.6.3typescript-eslint ^8.18.0wrangler ^4.87.0

Why this stack

Realtime on Durable Objects, not a socket server

Each match is its own in-memory stateful object at the edge, so there is no global lock and the per-message ping never waits on a database — D1 is touched only at session boundaries.

Anonymous-first accounts with Better Auth

Players still just type a nick, but identity lives in a server session from the first touch — so it survives a cache clear or a device switch, and signing in is offered only once there is a win worth saving.

A pure-TypeScript engine with zero Cloudflare imports

The same game logic runs in a Worker, a browser, and a Node test unchanged — which is what makes the documented ~one-week migration off Cloudflare credible, and what lets the server replay runs to catch cheaters.

The server replays every run; the client score is never trusted

The deterministic engine re-runs the exact rounds from the same seed and scores from scratch, so a client's tally is only a claim to verify — topping the leaderboard still means actually playing a correct game.

One GameModule contract every game implements

The platform never imports a specific game, so when multi-choice arrived months later it slotted in as a single new case with the three existing categories untouched.

What it gives you

Glossary

edge
Running code in data centres geographically close to each user instead of one central region, which cuts the network round-trip and lowers latency.
Durable Object
A Cloudflare primitive that pins one stateful instance per ID at the edge, so every request for that ID reaches the same isolate — ideal for coordinating one live match.
JWT
A compact, digitally-signed token that carries claims as JSON, so the receiver can verify it came from a trusted issuer and was not tampered with.
passkey
A passwordless sign-in that uses your device's fingerprint, face, or PIN together with public-key cryptography instead of a typed password.

The numbers

Data

LOC, build time, sessions, language split, commit history, and the full file-by-file breakdown.

Why it's built this way

Course

A cinematic „why” course — the architectural decisions, the traps they avoid, and the roads not taken.

Audited & remediated

Security

What was found, what's fixed — severity posture and before→after remediation, independently audited.