v0.3.0 storage with sqlite3 and pid management added

This commit is contained in:
2025-10-30 09:52:23 -04:00
parent 0ad608293e
commit b79900b1bf
18 changed files with 1570 additions and 69 deletions

View File

@ -12,21 +12,25 @@
# Chess
Go backend server providing a RESTful API for chess gameplay. Integrates Stockfish engine for move validation and AI opponents.
Go backend server providing a RESTful API for chess gameplay. Integrates Stockfish engine for move validation and computer opponents.
## Features
- RESTful API for chess operations
- Stockfish engine integration for validation and AI
- Stockfish engine integration for validation
- Human vs human, human vs computer, computer vs computer modes
- Custom FEN position support
- Asynchronous AI move calculation
- Configurable AI strength and thinking time
- Asynchronous engine move calculation
- Configurable engine strength and thinking time
- Optional SQLite persistence with async writes
- PID file management for singleton enforcement
- Database CLI for storage administration
## Requirements
- Go 1.24+
- Stockfish chess engine (`stockfish` in PATH)
- SQLite3 (for persistence features)
### Installation
@ -45,14 +49,17 @@ git clone https://git.lixen.com/lixen/chess
cd chess
go build ./cmd/chessd
# Standard mode (1 request/second/IP)
./chessd
# Standard mode with persistence
./chessd -storage-path chess.db
# Development mode (10 requests/second/IP)
./chessd -dev
# Development mode with PID lock on localhost custom port
./chessd -dev -pid /tmp/chessd.pid -pid-lock -port 9090
# Run tests (requires dev mode)
./test/test-api.sh
# Database initialization (doesn't run server)
./chessd db init -path chess.db
# Query stored games (doesn't run server)
./chessd db query -path chess.db -gameId "*"
```
Server listens on `http://localhost:8080`. See [API Reference](./doc/api.md) for endpoints.