The ChessClouds Chess Engine service provides an HTTP API wrapper around the Stockfish chess engine, enabling computer opponent gameplay and move analysis.
- Stockfish Integration - Interface with the powerful Stockfish chess engine
- HTTP API - RESTful endpoints for chess move calculations
- Best Move Analysis - Calculate optimal moves for any position
- Engine Evaluation - Assess position strength and advantage
- FEN Support - Analysis using Forsyth-Edwards Notation for board positions
The Engine service is built as a Rust application using:
- Hyper - Fast HTTP implementation
- Tokio - Asynchronous runtime
- Shakmaty - Chess move validation and board state management
- Stockfish - The underlying chess engine executable
- Socat - For communication between the API and Stockfish process
Get status of the engine API.
Response:
{
"message": "Stockfish API is running"
}Test connection to the Stockfish engine.
Response:
{
"status": "success",
"message": "Connected to Stockfish successfully",
"response": "uciok"
}Get the best move for a given position.
Parameters:
fen: Board position in FEN notation
Response:
{
"best_move": "e2e4",
"new_fen": "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1"
}The chess engine runs in its own Docker container with the following components:
- Stockfish - The chess engine binary
- Socat - Acts as a proxy to communicate with Stockfish
- API Server - The Hyper-based HTTP server
- Supervisord - Process manager to keep both services running
- Rust 1.65+
- Docker (for containerized deployment)
- Navigate to the engine directory
cd engine- Build the Rust project
cargo build --release- Run the API server
cargo run --releasedocker build -t chessclouds-engine .
docker run -p 4000:4000 chessclouds-engineThe Engine service communicates with the Stockfish process using UCI (Universal Chess Interface) protocol. The API server sends commands to Stockfish and processes the responses to provide a simple HTTP interface for the frontend application.
