Skip to content

RJDonnison/chess-bot-interface

Repository files navigation

Chess Bot Web Interface

A web interface for playing chess against bots. Play against the built-in Stockfish engine or challenge bots that follow the API spec. The interface also has built in teasting tool supporting the display of debug bitboards and analysing batch games.


Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn

Installation

git clone https://github.com/RJDonnison/chess-bot-interface.git
cd chess-bot-interface
npm install

Running locally

npm run dev

Then open http://localhost:5173 in your browser.


Adding a Host

A "host" is any chess engine exposed as an HTTP API.

In the interface

  1. Click Add Host
  2. Enter a name and the URL of the bot's API (e.g. https://my-chess-bot.dev)
  3. Click Add

The new host will appear in the dropdown and persist across sessions.

Removing or editing a host

Click the pencil icon next to any host in the Hosts panel to edit its name or URL, or the trash icon to remove it.

Note: The built-in host's cannot be removed.


Hosting Your Own Bot

If you want to run your own engine and add it as a host, your server must implement the Chess Bot API spec defined in api_spec.yml.

Quick summary

Your server needs a single endpoint:

GET /bestmove?fen=<fen-string>

It must return JSON in this shape:

{ "bestmove": "e2e4" }

The move must be in UCI notation.

FEN strings

The interface sends a complete FEN string with every request. FEN encodes the full board state so each request is stateless.

CORS

Your server must allow cross-origin requests from wherever the interface is hosted. At minimum, add this response header:

Access-Control-Allow-Origin: *

Resources


Built-in Stockfish Host

The interface ships with Stockfish running locally in the browser. You can adjust its strength via the Depth input and use it to test your bots.


Contributing

Pull requests welcome. Please open an issue first for any significant changes.

About

A simple chess web interface for testing custom chess bots

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages