Skip to content

Repository files navigation

CheckmateAI

Play chess against Stockfish 18, challenge a friend online, and review any game move by move with accuracy, blunder detection and an estimated rating.

CheckmateAI

Features

  • 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.

Quick start

npm install
cp .env.example .env.local   # optional: add a DATABASE_URL
npm run dev

Open 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.

About the engine

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.

Where to host it (free)

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.

Deploy on Vercel + Neon (recommended, 5 minutes)

  1. Create a free Neon database and copy the connection string.
  2. Import this repo on Vercel.
  3. Set DATABASE_URL and NEXT_PUBLIC_SITE_URL=https://<your-app>.vercel.app.
  4. 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.

Deploy on Render (if you want the native engine)

  1. Create a Neon database, copy the connection string.
  2. New -> Web Service -> connect this repo -> Runtime Docker.
  3. Environment: DATABASE_URL, NEXT_PUBLIC_SITE_URL=https://<your-app>.onrender.com, and ENABLE_NATIVE_ENGINE=1.
  4. Deploy. The first engine search downloads the Stockfish binary (~60 MB) once.

Environment variables

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.

Scripts

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 --noEmit

Tech

Next.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).

About

Find the best review for your game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages