Checkmoss: an online chess site with live, rated games

Checkmoss: an online chess site with live, rated games

00 Markdown

Open challenges at 3+2, 5+0 and 10+0, live games with clocks and legal moves, spectators, ratings and replays.

Agent specs

Agent
Claude Code, Opus 5.5 Medium
Time
17 min
Cost
$5.44*

Agents work faster and more accurately on Elements.

* Cost at API rates, September 2026.

Run it yourself

Paste this prompt into your AI agent. You get the finished app on your own machine, ready to change however you like.

Agent Chat
Install elements:
curl -fsSL 'https://install.elements.dev?os=darwin' | sh && export PATH=~/elements/bin:$PATH

Create an Elements app from the elementscode/demo-checkmoss scaffold:
cd ~/elements/projects
elements create checkmoss -scaffold=elementscode/demo-checkmoss
cd checkmoss

Start the app.

Need an AI agent?

In AI desktop apps, paste into the Code tab, not the general chat.

How it's built

Checkmoss needed accounts, a lobby that shows who is online, moves and clocks pushed to players and spectators, and scheduled flag checks. Each of those is a part of Elements, so the agent spent its 17 minutes on chess itself.

What Elements gave the app

  • Live games. Every move, draw offer and resignation publishes the game's full state on a channel. Both players and every spectator listen for that game, so the board, clocks and move list stay in step on every screen.
  • Who is online. A page's live connection marks its player online and offline, and the lobby's channel pushes that list along with open challenges and games in progress.
  • Moves as function calls. The board calls @rpc functions to move, offer a draw or resign. The server checks the move is legal, runs the clock and records it in one locked transaction, and a checkmate moves both players' ratings in that same transaction.
  • Flag falls on a schedule. A one-line cron schedule runs a job every minute that ends games whose clock ran out with nobody watching. Open pages report a flag fall themselves, and the server decides.
  • Sessions. Players sign up with a username and sign in with either the username or the email.
  • Data from SQL files. Migrations define the schema and seed four rated players, twelve finished games, one game in progress and an open challenge. The project server applied each one as soon as it was saved.

What the project server gave the agent

The project server runs alongside the agent and answers as soon as a file is saved: it type-checks the templates, TypeScript and SQL, applies migrations and reruns the tests, so every question came back right away and the agent kept building.

What shipped

The app type-checks with zero errors and all 29 tests pass. Every page works on desktop and phone, and live updates arrive across sessions, such as moves and clocks reaching both players and a spectator as a game plays to checkmate.

The code

Build it from scratch

To watch your agent build this app from an empty project, use the prompt we used instead. It takes longer than starting from the finished app above.

Agent Chat
Install elements:
curl -fsSL 'https://install.elements.dev?os=darwin' | sh && export PATH=~/elements/bin:$PATH

Create an Elements app:
cd ~/elements/projects
elements create checkmoss
cd checkmoss

Start the app, then build this:

Build an online chess site named checkmoss.

- Sign up, log in, pick a username.
- Lobby: open challenges with time control (3+2, 5+0, 10+0), who is online,
  and games in progress to watch.
- Create a challenge or accept one.
- Play on a board with drag and drop, legal moves only, clocks, move list,
  draw offers and resign. Check, checkmate, stalemate and flag fall end the
  game.
- A rating per player that moves after each game.
- Profile with rating and game history, and replay a past game move by move.

Seed four players with ratings and a history of finished games, and one game in
progress. Show the seeded logins on the sign-in page.

Moves, clocks, the lobby and spectators update in real time.

The weekly digest

New lessons, demos and posts from elements.dev, in one email a week.

Comments· 0