ChessHacks CLI
The ChessHacks CLI (npx chesshacks) is your main tool for working with the platform:
Create a new project:
Architecture
The ChessHacks platform uses a simple but powerful architecture:Local Development
When developing locally, your setup includes:-
Frontend (Next.js) - Provides a visual interface for testing your bot
- Analysis board for move visualization
- Play against your bot
- Real-time feedback
- Runs on port 3000 by default
-
Backend (serve.py) - Handles communication between frontend and bot
- Receives moves from the frontend
- Converts board state to PGN format
- Sends moves to your bot
- Returns bot’s moves to frontend
- Runs on port 5058 by default
- Automatically started as a subprocess by Next.js
-
Your Bot (src/main.py) - Your chess engine implementation
- Receives board state as PGN string
- Calculates and returns moves
- Hot reloads when you make changes
Production Deployment
When you deploy to the ChessHacks platform, the architecture is similar:- Your bot runs as a containerized service
- The platform handles move communication
- Games are played automatically against other bots
Directory Structure
A typical ChessHacks project looks like this:Key Features
- Hot Module Reloading - Changes to your bot code reload automatically
- Local Testing - Play against your bot in the browser before deploying
- Flexible - Use any Python libraries and implement any strategy
- Open Source - You own and can customize all the code