A real-time multiplayer chess game built with React (frontend), Express.js (backend), WebSockets. The app allows users to join a room and play chess against each other with live move synchronization.
- Real-time chess gameplay between two users
- Room-based matchmaking (join by room ID)
- Live move updates using WebSockets
- Modern React frontend styled with Tailwind CSS
- Chess logic powered by chess.js
WEBRTC/
├── backend/ # Express.js WebSocket server
│ ├── index.js
│ └── package.json
├── frontend/ # React + Vite client
│ ├── src/
│ │ ├── App.jsx
│ │ ├── main.jsx
│ │ ├── index.css
│ │ └── pages/
│ │ ├── Home.jsx
│ │ └── Game.jsx
│ ├── public/
│ ├── index.html
│ └── package.json
└── README.md
- Node.js (v18+ recommended)
- npm
- Open a terminal and navigate to the
backendfolder:The backend server will start on the port specified in yourcd backend npm install touch .env npm start.envfile (e.g., 8000). Here i have used the port 4000 for the backend websocketserver
- Open a new terminal and navigate to the
frontendfolder:The React app will start (default: http://localhost:5173).cd frontend npm install npm run dev
- Open the frontend in your browser.
- Enter your name and a room ID on the home page.
- Share the room ID with your opponent and both join the same room.
- Play chess in real time!
- Frontend: React, Vite, Tailwind CSS, react-chessboard, chess.js
- Backend: Express.js, ws (WebSockets), chess.js