I've been playing around w/ making something w just agents, purely out of curiousity, this is that!
A simple web-based chess game that you can play with just a link.
We give you a shareable URL and we'll randomly pick your side; the next person gets the other.
Anyone else who opens the link is a spectator.
Players can react with any emoji using the built-in emoji picker.
- Go 1.22+
- Make
- Optional:
airfor live reload (go install github.com/cosmtrek/air@latest) - Optional: Postgres if you want persistence
go mod download
make runOpen http://localhost:8080.
make devSet DATABASE_URL to enable persistence (Postgres DSN), for example:
export DATABASE_URL="postgres://user:pass@localhost:5432/tinychess?sslmode=disable"go test ./...Runs a headless browser test that opens two clients and plays a complete legal game (Fool's Mate) to verify a game can finish.
go test -tags e2e ./internal/e2e -run TestPlayFullGameNotes:
- Requires a local Chrome/Chromium install.
- If Chrome isn't on your PATH, set
CHROME_BINto the browser executable. - If your environment needs it, set
CHROMEDP_NO_SANDBOX=1. - To watch the game being played, run headed with
CHROMEDP_HEADLESS=0. - To slow down moves, set
E2E_MOVE_DELAY_MS(milliseconds between moves). - To pause before the first move, set
E2E_START_DELAY_MS. - To wait for UI updates before capturing, set
E2E_CAPTURE_DELAY_MS. - Famous quick mates:
- Fool's Mate:
go test -tags e2e ./internal/e2e -run TestPlayFullGame - Scholar's Mate:
go test -tags e2e ./internal/e2e -run TestPlayScholarsMate
- Fool's Mate:
- Optional recording:
- Set
E2E_RECORD=1to capture screenshots before each move (white client). - Output defaults to
e2e-artifacts/(override withE2E_RECORD_DIR). - Use
E2E_RECORD_FORMAT=mp4(default),gif, orframes(PNGs only). - Set
E2E_RECORD_FPSto control playback (default6). - Set
E2E_RECORD_HOLD_MSto hold the final frame (default2000). - Requires
ffmpegon PATH for mp4/gif.
- Set
E2E_RECORD=1 E2E_RECORD_FORMAT=gif E2E_RECORD_FPS=6 make test-e2eDefaults can be overridden:
CHROMEDP_HEADLESS=0to watch the run.CHROMEDP_VIEWPORT_WIDTHandCHROMEDP_VIEWPORT_HEIGHTfor mobile/aspect testing (defaults to iPhone 15 Pro: 393x852).E2E_MOVE_DELAY_MSandE2E_START_DELAY_MSfor timing.E2E_CAPTURE_DELAY_MSto wait for SSE/UI updates before each capture.E2E_RECORD_HOLD_MSto extend the final frame.E2E_RECORD_FORMAT=framesto skip stitching (no ffmpeg needed).E2E_SEND_EMOJI=0to skip the emoji taunt (default on).E2E_EMOJIto override the emoji character.
- Production: https://tinychess.dusty.wtf/
- Sandbox: https://sandbox.tinychess.dusty.wtf