Play chess against Stockfish 18, challenge a friend online, and review any game move by move with accuracy, blunder detection and an estimated rating.
- Play vs the computer at 8 strength levels (~800 Elo to full power).
- Play a friend: pass & play on one device, or an online room with a shareable code and link, server-authoritative clocks, draw offers, resignation and rematch.
- Analysis board with a live eval bar, best-move arrow and multi-PV lines.
- Game review: every move classified (brilliant, great, best, excellent, good, book, inaccuracy, mistake, blunder) with accuracy, average centipawn loss and an estimated rating per side.
- Import / export PGN and FEN, and save games to a database.
- Full rules via
chess.js: castling, en passant, underpromotion (you pick the piece), check, checkmate, stalemate, threefold repetition, the fifty-move rule, insufficient material, and flag fall (including the "opponent cannot mate, so it is a draw" case). - Keyboard navigation, sound effects, responsive board, dark UI.
npm install
cp .env.example .env.local # optional: add a DATABASE_URL
npm run devOpen http://localhost:3000.
The app runs without a database: you can play and analyse, but saving games
and online rooms are disabled until DATABASE_URL is set. Tables are created
automatically on first use.
Stockfish 16 NNUE (~600 KB) is bundled and runs in the browser, so the app works
out of the box with no setup and no server cost. You can drop in the stronger
Stockfish 18 build or enable the native server engine later - see
public/engines/README.md.
This app has two halves with different needs: a Next.js server, and an optional native Stockfish process that wants a long-lived container.
| Host | Free tier | Native engine | Notes |
|---|---|---|---|
| Vercel + Neon | generous | no | Start here. Zero config, never sleeps. |
| Render (Docker) | yes, sleeps when idle | yes | Pick this only if you want the native engine. |
| Koyeb | one free instance | yes | Fast cold starts, Docker or buildpack. |
| Fly.io | small free allowance | yes | Great if you want a region near you. |
| Railway | trial credit | yes | Easiest setup, credit runs out. |
Free Postgres: Neon (best), Supabase, or Railway. Paste the
connection string into DATABASE_URL.
- Create a free Neon database and copy the connection string.
- Import this repo on Vercel.
- Set
DATABASE_URLandNEXT_PUBLIC_SITE_URL=https://<your-app>.vercel.app. - Deploy. Tables are created on first request.
Nothing else is needed: the engine runs in the visitor's browser, so it costs you no CPU and never hits a serverless timeout.
- Create a Neon database, copy the connection string.
- New -> Web Service -> connect this repo -> Runtime Docker.
- Environment:
DATABASE_URL,NEXT_PUBLIC_SITE_URL=https://<your-app>.onrender.com, andENABLE_NATIVE_ENGINE=1. - Deploy. The first engine search downloads the Stockfish binary (~60 MB) once.
| Variable | Required | Purpose |
|---|---|---|
DATABASE_URL |
no | Postgres. Enables saved games and online play. |
NEXT_PUBLIC_SITE_URL |
no | Absolute URL for share links and OG tags. |
ENABLE_NATIVE_ENGINE |
no | 1 to run native Stockfish server-side. Needs a persistent host. |
NEXT_PUBLIC_ENGINE_URL |
no | Override the browser engine build. |
npm run dev # development server
npm run build # production build
npm run start # run the production build
npm run lint # eslint
npm run typecheck # tsc --noEmitNext.js 16 (App Router), React 19, Tailwind 4, chess.js, react-chessboard, Drizzle ORM + Postgres, Stockfish 18 (WASM in the browser, native on the server).