Real-time online chess on Cloudflare — a Radical Party project
Find a file
maverick c6337f52c3 Add robots.txt
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 21:33:37 +10:00
client Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
migrations Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
public Add robots.txt 2026-07-23 21:33:37 +10:00
src Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
.gitignore Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
package-lock.json Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
package.json Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
README.md Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00
wrangler.jsonc Radical Chess — real-time online chess on Cloudflare 2026-07-23 21:29:02 +10:00

♞ Radical Chess

Real-time online chess, live at chess.theradicalparty.com. A Radical Party project — Vibe, Vote, Veto.

Play a friend by shareable link, take on the homegrown Radical Bot, or pass-and-play on one device. No account, no ads.

Features

  • Play online — create a game, pick a time control, share the link. Moves stream live over WebSockets; reconnect keeps your seat.
  • Server-authoritative — every move is validated server-side with chess.js; illegal moves are rejected.
  • Clocks — bullet → classical presets with increment, plus an unlimited mode. Flag-fall is detected even when a player is idle (Durable Object alarms).
  • Full ruleset — castling, en passant, promotion, checkmate, stalemate, threefold repetition, insufficient material, fifty-move rule.
  • Draw offers, resign, rematch (colors swap on rematch), and in-game chat.
  • Radical Bot — a minimax + alpha-beta engine (Easy / Medium / Hard) with piece-square evaluation, running entirely client-side.
  • Spectate — anyone with the link watches live once both seats are taken.
  • Game archive — finished games are stored (PGN) and listed under /watch.

Stack

  • Cloudflare Workers + Hono — HTTP + WebSocket routing
  • Durable Objects — one instance per game holds authoritative state and broadcasts to all sockets using WebSocket hibernation
  • D1 — finished-game archive and public feed
  • Static assets — vanilla-JS SPA; the board is rendered from scratch (drag-and-drop + click-to-move, no external board library)

Layout

src/index.js      Worker entry (Hono) — /api/new, /ws/:id, /api/recent
src/game.js       Game Durable Object — rules, clocks, chat, archival
client/app.js     SPA: router, board UI, online/bot/local views, bot engine
public/           index.html, style.css, built app.js (public/dist)
migrations/       D1 schema

Develop

npm install
npm run dev        # builds client, runs wrangler dev

Deploy

Pushing to main auto-deploys via the Forgejo post-receive hook (npm run build:client runs automatically before wrangler deploy).

npm run db:migrate   # apply D1 migrations (remote)
npm run deploy       # wrangler deploy