A real-time multiplayer chess game where AI plays against the community. Built with Node.js, Socket.IO, and Three.js.
Node Chess AI is an innovative chess platform where:
- White (AI): Powered by various AI models (Claude Sonnet, Grok, Gemini, GPT-3.5)
- Black (Community): Played collectively by users through voting
Users can suggest moves via the website or through PumpFun live chat integration. The most voted move is played when the timer ends.
- Multiple AI models rotate as White player
- Community votes on moves for Black
- Real-time voting system with configurable duration
- Tie-breaker: Random selection among top-voted moves
- Write moves in plain English: "move the rightmost pawn forward"
- AI translates natural language to chess notation
- Supports both standard notation (e5, Nf3) and descriptive input
- Connect to PumpFun live chat for move suggestions
- Wallet addresses are automatically masked (abc1...xyz9)
- Distinguishes between chat messages and move requests
- Beautiful Three.js rendered chess board
- Smooth piece animations
- Camera fixed on Black's perspective
- Live vote counting and display
- Countdown timer on board and side panel
- Move announcements with animations
- AI thinking log
- Backend: Node.js, Express.js
- Real-time: Socket.IO
- Chess Logic: chess.js
- AI: OpenRouter API (supports multiple models)
- 3D Graphics: Three.js
- External Chat: PumpFun WebSocket integration
- Node.js 18+
- npm or yarn
- OpenRouter API key
- Clone the repository:
git clone https://github.com/devaiacc/npm-run-chess.git
cd npm-run-chess- Install dependencies:
npm install- Create
.envfile:
OPENROUTER_API_KEY=your_openrouter_api_key
AI_LOG=true
CONTRACT=your_contract_address
DEV=https://x.com/your_handle
LIVE_CHAT=true
HYBRID_CHAT=true
VOTE_DURATION=60- Start the server:
npm start- Open browser at
http://localhost:3000
| Variable | Description | Default |
|---|---|---|
OPENROUTER_API_KEY |
API key for OpenRouter | Required |
AI_LOG |
Enable AI debug logging | false |
CONTRACT |
Token contract address (displayed in UI) | - |
DEV |
Developer Twitter/X link | - |
LIVE_CHAT |
Enable PumpFun chat integration | false |
HYBRID_CHAT |
Allow both website and PumpFun input | false |
VOTE_DURATION |
Voting duration in seconds | 30 |
- AI (White) makes the first move
- Community voting begins for Black's response
- Users suggest moves via:
- Direct chess notation (e.g.,
e5,Nxd4) - Natural language (e.g., "move knight to f6")
- Direct chess notation (e.g.,
- Timer counts down (configurable duration)
- Most voted legal move is played
- If no votes received, timer restarts
- Repeat until game ends
- Each message counts as one vote
- Users can submit multiple suggestions
- Invalid moves are rejected and highlighted in red
- Ties resolved by random selection
The AI randomly selects from:
- Claude Sonnet 4.5
- Grok 4.1 Fast
- Gemini 3 Flash
- GPT-3.5 Turbo
Move translation uses GPT-4o-mini for accuracy.
node-chess-ai/
├── server.js # Main server & game logic
├── package.json
├── Procfile # Heroku deployment
├── public/
│ ├── index.html # Main HTML
│ ├── main.js # Frontend logic
│ ├── style.css # Styles
│ └── chess3d.js # Three.js chess board
└── services/
└── pumpFunChatClient.js # PumpFun chat integration
| Event | Description |
|---|---|
suggestMove |
Submit a move suggestion |
| Event | Description |
|---|---|
gameState |
Current game state (FEN, players, etc.) |
moveMade |
A move was played |
voteUpdate |
Vote counts updated |
voteTimerStart |
Voting period started |
voteTimerEnd |
Voting period ended |
communityMove |
Community's move was played |
moveRejected |
Invalid move rejected |
pumpfunStatus |
PumpFun connection status |
heroku create your-app-name
heroku config:set OPENROUTER_API_KEY=your_key
heroku config:set LIVE_CHAT=true
heroku config:set VOTE_DURATION=60
git push heroku mainISC License
Built with by @llmxbt