A basic Rust-based backend server for managing chess-like game sessions, built with Axum and Tokio.
This project provides a simple HTTP API to simulate creating and playing moves in a game session. It is the starting point for a more complex multi-player game engine tailored for "Tempête" — a chess variant with extensible rules.
- Create a new game session (
POST /create-game) - Play a (simili) move in a game session (
POST /play-move) - Basic HTTP server running on port 8080
- JSON API with request/response serialization via Serde
- Rust
- Axum for HTTP server and routing
- Tokio async runtime
- Serde for JSON serialization/deserialization
- UUID for unique game identifiers
- Tracing for structured logging
- Rust toolchain
- Make
make build
make runThe server will start listening on http://0.0.0.0:8080.
POST /create-gameCreates a new game and returns a JSON response with a unique game ID.POST /play-moveAccepts JSON input withgame_id,from, andtofields to play a move in the specified game.
Example JSON payload for /play-move:
{
"game_id": "some-uuid",
"from": "e2",
"to": "e4"
}Create a new game:
curl -X POST http://localhost:8080/create-gamePlay a move:
curl -X POST http://localhost:8080/play-move -H "Content-Type: application/json" -d '{"game_id":"<id>","from":"e2","to":"e4"}'src/main.rs— Server setup and route mountingsrc/routes.rs— API routes definitionssrc/state.rs— Handlers and game state models
- Implement real game logic and state management
- Replace stub logic with actual chess rules engine
- Add persistence and multi-player support