You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modern, fully client-side chess application built with **React + TypeScript + Vite**, powered by the custom engine [@rumenx/chess](https://www.npmjs.com/package/@rumenx/chess).
8
+
Modern chess application built with **React + TypeScript + Vite**, powered by the custom engine [@rumenx/chess](https://www.npmjs.com/package/@rumenx/chess).
9
+
10
+
Supports **multiple backend engines** — play offline in the browser or connect to [rust-chess](https://github.com/RumenDamyanov/rust-chess), [go-chess](https://github.com/RumenDamyanov/go-chess), or [npm-chess](https://github.com/RumenDamyanov/npm-chess) REST APIs.
9
11
10
12
---
11
13
12
14
## ✨ Features
13
15
14
-
- Legal move generation & game state via \`@rumenx/chess\`
16
+
- Legal move generation & game state via `@rumenx/chess`
17
+
-**Multi-backend support** — switch between Local (in-browser), Rust, Go, and JS engines
18
+
- Backend picker with live connection status & health checking
15
19
- Move history with time-travel (jump to any ply)
16
20
- AI opponent with multiple difficulty tiers (random → depth 5 minimax w/ alpha-beta & capture ordering)
17
21
- Hint system (on-demand best move preview)
@@ -53,21 +57,115 @@ npm run dev
53
57
54
58
Then open: [http://localhost:5173](http://localhost:5173)
55
59
60
+
## 🔀 Switching Backends
61
+
62
+
React Chess supports **four chess engines** — you can switch between them at any time without losing your current game position.
63
+
64
+
| Backend | Engine | Runs In | Default URL |
65
+
|---------|--------|---------|-------------|
66
+
|**Local**|`@rumenx/chess`| Browser (no server) | — |
67
+
|**Rust**|`rumenx-chess`| REST API |`http://localhost:8082`|
68
+
|**Go**|`go-chess`| REST API |`http://localhost:8080`|
69
+
|**JS**|`npm-chess`| REST API |`http://localhost:8081`|
70
+
71
+
### Method 1: Settings Panel (UI)
72
+
73
+
1. Open the app at [http://localhost:5173](http://localhost:5173)
74
+
2. In the left sidebar, find the **Backend Engine** section
75
+
3. Select an engine from the **Engine** dropdown (Local, Rust, Go, or JS)
76
+
4. For remote backends, a **URL** field appears — edit it if your server runs on a different host/port
77
+
5. A connection indicator shows the status:
78
+
- ⏳ **Checking…** — health check in progress
79
+
- ✅ **Connected** — backend is reachable
80
+
- ❌ **Disconnected** — server unreachable; click **🔄 Retry**
81
+
6. Start playing — the game resets with the new engine
82
+
83
+
Your selection is persisted in `localStorage`, so it survives page reloads.
84
+
85
+
### Method 2: Environment Variables
86
+
87
+
Set the default backend before starting the dev server:
88
+
89
+
```bash
90
+
cp .env.example .env
91
+
```
92
+
93
+
Edit `.env`:
94
+
95
+
```env
96
+
# Options: local | rust | go | js
97
+
VITE_CHESS_BACKEND=rust
98
+
99
+
# Override default URLs (optional)
100
+
VITE_CHESS_RUST_URL=http://localhost:8082
101
+
VITE_CHESS_GO_URL=http://localhost:8080
102
+
VITE_CHESS_JS_URL=http://localhost:8081
103
+
```
104
+
105
+
Then run `npm run dev` — the app opens with the chosen backend pre-selected.
106
+
107
+
### Method 3: Docker Compose (all backends)
108
+
109
+
Start the frontend and all three remote backends together:
@@ -141,6 +245,8 @@ Explore other libraries and tools from the same developer:
141
245
### NPM Packages
142
246
143
247
-**[@rumenx/chess](https://github.com/RumenDamyanov/npm-chess)** - TypeScript chess engine with legal move generation ([npm](https://www.npmjs.com/package/@rumenx/chess))
248
+
-**[rust-chess](https://github.com/RumenDamyanov/rust-chess)** - Rust chess engine + REST API ([crates.io](https://crates.io/crates/rumenx-chess))
249
+
-**[go-chess](https://github.com/RumenDamyanov/go-chess)** - Go chess engine + REST API
144
250
-**[@rumenx/chatbot](https://github.com/RumenDamyanov/npm-chatbot)** - AI chatbot integration library ([npm](https://www.npmjs.com/package/@rumenx/chatbot))
145
251
-**[@rumenx/seo](https://github.com/RumenDamyanov/npm-seo)** - SEO analysis and optimization toolkit ([npm](https://www.npmjs.com/package/@rumenx/seo))
0 commit comments