Checkmoss: an online chess site with live, rated games
Open challenges at 3+2, 5+0 and 10+0, live games with clocks and legal moves, spectators, ratings and replays.
Run it yourself
Get the finished app on your own machine, ready to change however you like.
Press 'Enter' to confirm your input or 'Escape' to cancel
Press ⇧⌘P in VS Code and choose Elements: New App. Then paste this line and press Enter.
New to Elements? Install Elements first.
The code
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
@rpcfunctions 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.
Join the community
Get a weekly digest of new posts.
Comments· 0