A modern chess web app with a React frontend and FastAPI backend powered by Stockfish. Play against the engine, see real‑time evaluations, run on‑demand analysis, and unlimited review (unlike chess.com's paywall) for PGN files with chess.com‑style review comments.
- Frontend: React (Vite) + react-chessboard
- Backend: FastAPI + python‑chess + Stockfish
- Live evaluation: WebSocket stream
- PGN review: quick mode or full review with comments
For full API reference, see the API documentation:
- API docs: API_DOCUMENTATION
- Play vs AI (engine replies automatically)
- Real-time evaluation bar via WebSocket
- On-demand analysis (best move, PV, depth)
- PGN review with “Brilliant/Mistake/Blunder/…” comments
- Resign and restart controls
- Random user color assignment (white/black) on start/restart
- Robust game state: FEN, status flags, last move, legal moves
- Frontend (default: http://localhost:5173)
- React + Vite, chessboard UI, WebSocket evaluation bar
- Backend (default: http://localhost:8000)
- FastAPI service, Stockfish engine controller, session manager
- Engine
- Stockfish (resolved via STOCKFISH_PATH or found in PATH)
CORS is enabled for the frontend origin(s) on 5173.
- Node.js 18+ and npm (or pnpm/yarn)
- Python 3.10+
- Stockfish chess engine installed and accessible:
- macOS:
brew install stockfish - Ubuntu/Debian:
sudo apt-get install stockfish - Windows: install and add to PATH (Scoop/Choco or manual)
- macOS:
- Optional: Docker/Docker Compose (if you prefer containers)
Set the engine path if not in PATH:
- macOS/Linux:
export STOCKFISH_PATH=/usr/local/bin/stockfish - Windows (PowerShell):
$env:STOCKFISH_PATH="C:\\path\\to\\stockfish.exe"
Frontend (Vite):
VITE_API_BASE_URL(optional; defaulthttp://localhost:8000)VITE_WS_BASE_URL(optional; defaultws://localhost:8000)
Backend:
STOCKFISH_PATH(optional; defaultstockfishin PATH)
- Backend
- Create and activate a virtual environment (recommended)
- Install dependencies (example):
If you have a
pip install fastapi uvicorn python-chess
requirements.txt, use:pip install -r requirements.txt
- Run the server:
The backend will resolve Stockfish from
uvicorn backend.app:app --host 0.0.0.0 --port 8000 --reload
STOCKFISH_PATHor PATH.
- Frontend
- From the frontend directory:
npm install npm run dev
- Open http://localhost:5173
If you have a Dockerfile for the backend:
docker build -t nochess-backend .
docker run --rm -p 8000:8000 \
-e STOCKFISH_PATH=/usr/bin/stockfish \
nochess-backendEnsure the container has Stockfish installed (either in the image or mounted).
backend/
app.py
engine.py
chess_game.py
models.py
pgnReview.py
utils.py
ui/terminal_ui.py
frontend/
src/
components/
styles/
api.js (or api/index.js)
- The engine is analyzed at a configurable depth internally. The WebSocket stream emits the latest analysis ~1s cadence.
- PGN review supports quick mode (faster, lower depth) and normal mode (deeper).
- In headless environments (e.g., Docker), terminal UI calls are automatically disabled to avoid TERM warnings.
- Engine not found
- Set
STOCKFISH_PATHor install Stockfish into PATH.
- Set
- WebSocket disconnects
- Ensure
VITE_WS_BASE_URLmatches the backend host and protocol (ws://for local,wss://for TLS).
- Ensure
Add your license here.
- python-chess
- FastAPI
- react-chessboard
- Stockfish authors and contributors