Real-time multiplayer chess game. Create room, share code, play chess.
Frontend: Next.js 14, TypeScript, Tailwind CSS, React Chessboard
Backend: Express.js, TypeScript, Socket.IO, Custom Chess Engine
Database: Supabase PostgreSQL
Real-time: WebSocket connections
AI Bots: LLM Integration (Gemini/OpenRouter) + Stockfish Fallback
Frontend (Vercel) Backend (Render) Database (Supabase)
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Next.js 14 │◄──┤ Express + Socket│◄──┤ PostgreSQL │
│ TypeScript │ │ Real-time WS │ │ Real-time API │
│ Tailwind CSS │ │ Chess Engine │ │ Row Level Sec │
│ Socket.IO Client│ │ Move Validation │ │ Auto-scaling │
│ Optimistic UI │ │ Room Management │ │ Persistence │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Player creates room, gets 6-digit code
Player shares code with friend
Friend joins using code
Chess game starts automatically
Custom engine validates all moves
WebSocket syncs moves instantly between players
git clone https://github.com/dushyant4665/gambit
cd gambit
# Terminal 1 - Server
cd server
npm install
npm run dev
# Terminal 2 - Client
cd client
npm install
npm run devConnect GitHub repo to both platforms. Auto-deploys on push.
All chess rules implemented
Move validation and checkmate detection
Player names and room codes
Mobile responsive design
Database persistence
Real-time WebSocket sync
No authentication required
AI Chess Bots: Michael Tal (aggressive) & Bobby Fischer (precise) with LLM + Stockfish integration
The application features two AI chess bots with distinct playing styles:
- Style: Aggressive, tactical, sacrifice-friendly
- Personality: Known for brilliant tactical sacrifices and attacking play
- Technology: Gemini LLM + Stockfish validation
- Sacrifice Tolerance: Up to 5 pawns for tactical advantage
- Style: Classical, precise, accuracy-first
- Personality: Perfect endgame technique and positional understanding
- Technology: OpenRouter/DeepSeek LLM + Stockfish validation
- Sacrifice Tolerance: Conservative, prefers high-evaluation moves
- LLM Analysis: Bot analyzes position with personality-specific prompts
- Move Suggestions: LLM provides 3 candidate moves with rationale
- Stockfish Validation: Each move validated for legality and evaluation
- Fallback System: Stockfish provides strong moves when LLM suggestions fail
- Authoritative Server: All moves validated server-side before persistence
- Free Tier Friendly: Works without API keys using Stockfish-only mode
- Rate Limited: 20 LLM calls per minute with automatic fallback
- Robust Fallback: Multiple layers ensure bots always provide legal moves
- Debug Endpoints: Analyze bot decisions and move sources
See /server/bots/README.md for detailed documentation.