Skip to content

shauryasingh0302/Chess.com

Repository files navigation

Chess.com Clone

A real-time multiplayer chess game built with Node.js, Express, Socket.IO, and Chess.js.

Description

Repository Description: Real-time multiplayer chess game with drag-and-drop functionality, built using Node.js, Express, Socket.IO, and Chess.js. Features live game synchronization, player roles (white/black/spectator), and a responsive chessboard UI.

Features

  • Real-time Multiplayer - Play chess with another player in real-time using WebSockets
  • Drag and Drop - Intuitive piece movement with drag-and-drop functionality
  • Player Roles - Automatic assignment of white/black roles; additional users join as spectators
  • Board Flipping - Board automatically flips for the black player
  • Move Validation - All moves are validated using Chess.js library
  • Live Synchronization - Board state syncs instantly across all connected clients

Tech Stack

  • Backend: Node.js, Express.js
  • Real-time Communication: Socket.IO
  • Chess Logic: Chess.js
  • Templating: EJS
  • Styling: Tailwind CSS

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/chess.com.git
    cd chess.com
  2. Install dependencies

    npm install
  3. Start the server

    node app.js

    Or with nodemon for development:

    npx nodemon
  4. Open your browser and navigate to http://localhost:3000

How to Play

  1. Open the game in two browser windows/tabs
  2. First player is assigned White, second player is assigned Black
  3. Additional connections become Spectators
  4. Drag and drop pieces to make moves
  5. Only valid chess moves are allowed

Project Structure

Chess.com/
├── app.js              # Express server & Socket.IO logic
├── package.json        # Dependencies
├── public/
│   ├── css/            # Stylesheets
│   └── js/
│       └── chessgame.js # Client-side game logic
└── views/
    └── index.ejs       # Main game view

License

MIT

About

Real-time multiplayer chess game with drag-and-drop functionality, built using Node.js, Express, Socket.IO, and Chess.js. Features live game synchronization, player roles (white/black/spectator), and a responsive chessboard UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors