ChessUp/README.md

57 lines
2.3 KiB
Markdown

# ChessUp
Lightweight Lichess-style chess server and Stockfish analysis web app built with **vanilla TypeScript**, **esbuild**, **Node.js (`node:http`, `node:sqlite`)**, **`ws`**, and **`stockfish`** — zero UI or server frameworks.
## Features
- **Simple, sharp, old-device-friendly UI**: Dark & Light themes, 4 board color palettes, inline SVG Staunton pieces, tap + mouse/touch drag, single premove, Web Audio sounds (ES2017 / Safari 12+ compatible).
- **Accounts (no email required)**: Username + password registration (`crypto.scrypt` + `HttpOnly` session cookies).
- **Glicko-2 Ratings**: Separate ratings for Bullet, Blitz, Rapid, and Classical, with rating history charts and leaderboards.
- **Multiplayer & Social**: Live Open Lobby seeks, shareable invite links (`/invite/<token>`), mutual friends, live online/in-game status, direct challenges, head-to-head records, live spectating, and in-game chat.
- **8 Stockfish Levels**: Play Stockfish Lv 1 (~800) through Lv 8 (~2800+) with selectable color, timed/unlimited clocks, and unlimited takebacks.
- **Game History & Stockfish Analytics**: Filterable game history, cached post-game analysis (eval bar, clickable SVG eval graph, accuracy %, ACPL, `?!` / `?` / `??` annotations), plus an interactive variation explorer with live MultiPV lines and PGN/FEN import/export.
## Local Development
Requires **Node.js 22+** (built on Node 24/26 with native `node:sqlite`).
```bash
npm install
npm run build
npm start
```
Server listens on `http://0.0.0.0:3000` by default and persists SQLite data in `./data/chessup.db`.
Run checks and tests:
```bash
npm run typecheck
npm test
```
## Docker + Cloudflare Tunnel Deployment (Zero Host Ports Exposed)
The included [docker-compose.yml](docker-compose.yml) runs `chessup` and `cloudflared` on a private bridge network (`chessup_bridge`) with no host ports published.
1. Copy the example environment file and add your Cloudflare Tunnel token:
```bash
cp .env.example .env
```
Edit `.env` and set `CLOUDFLARED_TOKEN=...`.
2. In the Cloudflare Zero Trust dashboard (**Networks -> Tunnels -> Public Hostname**), configure your hostname to forward HTTP traffic to:
```text
http://chessup:3000
```
3. Build and start both containers:
```bash
docker compose up -d --build
```
SQLite data is persisted in the named Docker volume `chessup_data`.