Ironfish is a fault-tolerant, distributed chess analysis engine built with Rust. It serves as a powerful backend for chess applications, allowing you to offload heavy analysis tasks to a scalable cluster of workers.
Whether you are a developer building a chess GUI, a researcher analyzing games, or an enthusiast wanting to run your own analysis server, Ironfish provides a robust, self-healing platform.
- Flexible Deployment: Run it as a single node for personal use or scale out to a distributed cluster for enterprise-grade performance.
- Resilient: Built-in fault tolerance means if a node crashes, the cluster recovers automatically without losing your analysis requests.
- API First: Exposes your choice of REST, gRPC, or GraphQL APIs on a single port (8080).
- Secure: Token-based authentication ensures only authorized clients can submit expensive analysis jobs.
- Observable: Real-time metrics endpoint for monitoring CPU, memory, and engine load.
Ironfish operates on a peer-to-peer architecture using a Gossip Protocol for membership and state sharing.
- API Layer: Handles incoming requests (REST / gRPC / GraphQL) and authenticates users.
- Cluster Service: Manages node discovery, failure detection, and leader election (Hybrid Raft/Bully algorithm).
- Load Balancer: Smartly routes analysis requests to the least loaded node in the cluster.
- Stockfish Pool: Manages a local pool of Stockfish engine processes to execute the actual chess analysis.
You can run Ironfish in two modes: Single Node (Standalone) or Cluster Mode.
- Docker & Docker Compose (Recommended for easiest setup)
- Alternatively: Rust toolchain (cargo) and Stockfish binary installed locally.
Ideal for local development or personal use.
# Start a single Ironfish node
docker run -d -p 8080:8080 --name ironfish \
-e IRONFISH_ADMIN_KEY="secret-admin-key" \
ghcr.io/hekpyto/ironfish:latestYour server is now ready at http://localhost:8080
Ideal for high-availability and parallel processing.
-
Clone the repo:
git clone https://github.com/HEKPYTO/IRONFISH.git cd IRONFISH -
Start the cluster:
docker compose up -d
This spins up 3 nodes (
node1,node2,node3) that automatically discover each other.
Ironfish is secure by default. You need an Admin Key to manage tokens and an API Token to perform analysis.
Use your Admin Key (defined in env vars) to generate a token for your application.
curl -X POST http://localhost:8080/_admin/tokens \
-H "X-Admin-Key: cluster-admin-secret" \
-H "Content-Type: application/json" \
-d '{"name": "my-chess-app"}'Response:
{
"id": "...",
"token": "iff_abc123...",
"expires_at": null
}Use the generated token to submit a chess position (FEN) for analysis.
curl -X POST http://localhost:8080/v1/analyze \
-H "Authorization: Bearer iff_abc123..." \
-H "Content-Type: application/json" \
-d
"{
\"fen\": \"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\",
\"depth\": 20
}"| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/v1/health |
Check node health status | No |
GET |
/v1/metrics |
Real-time system & cluster metrics | Bearer Token |
POST |
/v1/analyze |
Submit analysis job (JSON) | Bearer Token |
POST |
/v1/bestmove |
Submit fast best move job (JSON) | Bearer Token |
WS |
/v1/ws |
WebSocket connection for real-time analysis | Bearer Token |
POST |
/graphql |
GraphQL Query/Mutation endpoint | Bearer Token |
POST |
/_admin/tokens |
Create a new API token | Admin Key |
DELETE |
/_admin/tokens/:id |
Revoke an existing token | Admin Key |
We use husky to ensure code quality. The pre-commit hook runs cargo fmt and cargo clippy automatically.
# The hooks are configured to use the local .husky directory
# Ensure the script is executable
chmod +x .husky/pre-commitTo run the full test suite, including integration tests:
cargo test --workspaceNote: Docker integration tests run sequentially to avoid port conflicts.
MIT
