Skip to content

Real-Time Chess Platform – A full-stack, multiplayer chess experience featuring live gameplay, in-game chat, and move history tracking. Designed with a dedicated WebSocket architecture for instant, smooth UI updates while keeping the server as the single source of truth for secure move validation. Built with performance, fairness, & user experience

Notifications You must be signed in to change notification settings

rudraprasaaad/chess-app

Repository files navigation

Chess Game - Real-time Multiplayer Chess Application

A modern, full-stack, real-time multiplayer chess application built with a powerful combination of Node.js, React, PostgreSQL, and WebSocket technology. It features a comprehensive authentication system, intelligent matchmaking, and a seamless, responsive gameplay experience.

React Node.js TypeScript PostgreSQL Redis Tailwind CSS

This chess application provides a complete multiplayer experience, designed from the ground up for performance and scalability. The responsive frontend built with React and the robust Node.js backend support thousands of concurrent players with sub-second move latency.

✨ Key Features

  • 🔐 Dual Authentication System – Secure session-based access for guests & Google OAuth integration.
  • Seamless Real-time Gameplay – WebSocket-powered instant move synchronization for a fluid experience.
  • 🎨 Responsive & Animated UI – Modern interface built with Tailwind CSS and Framer Motion that works flawlessly on all devices.
  • 🧠 Smart MatchmakingRedis-powered queues for pairing players based on ELO rating.
  • ♟️ Complete Chess Engine – Full rule validation including en passant, castling, and promotions via Chess.js.
  • 💬 In-Game Chat – Real-time messaging between players with typing indicators.
  • 🏠 Flexible Room System – Public rooms for quick matches and private, invite-only rooms for friends.
  • 🔄 Robust Reconnection Handling – Seamless game continuity after network disconnections.
  • 🛡️ Anti-abuse Protection – Backend rate limiting and illegal move detection to ensure fair play.

🚀 Tech Stack

Frontend

  • Core Framework: React.js 18+ with Vite
  • Styling: Tailwind CSS with Radix UI for accessible components
  • State Management: Zustand for simple, centralized global state
  • Data Fetching & Caching: TanStack Query (React Query) for server state management
  • Animations: Framer Motion for fluid UI transitions and animations
  • Real-time Client: Native WebSocket API for live communication

Backend

  • Core: Node.js 18+ with TypeScript
  • API Framework: Express.js with comprehensive middleware
  • Database: PostgreSQL with Prisma ORM for type-safe database access
  • In-Memory Caching & Queues: Redis for high-performance caching of active game state, session management, and powering the real-time matchmaking queues.
  • Real-time Server: ws library for a high-performance WebSocket server
  • Authentication: JWT with Passport.js for Google OAuth strategy
  • Game Logic: Chess.js for robust move validation

📊 System Design Diagrams

Entity Relationship Diagram

erDiagram
    User ||--o{ GamePlayer : has
    Game ||--o{ GamePlayer : includes
    Game ||--o{ Room : belongs_to
    Room ||--o{ Game : contains

    User {
        string id PK
        string username
        string name
        string email
        enum provider
        string providerId
        string password
        int elo
        int wins
        int losses
        int draws
        enum status
        boolean banned
        datetime createdAt
    }

    Game {
        string id PK
        string roomId FK
        string fen
        json[] moveHistory
        json timers
        enum status
        json[] chat
        string winnerId
        datetime createdAt
        datetime updatedAt
        datetime endedAt
        string userId
    }

    Room {
        string id PK
        enum type
        enum status
        json[] players
        string inviteCode
        datetime createdAt
        datetime updatedAt
    }

    GamePlayer {
        string gameId FK
        string userId FK
        string color
    }
Loading

🧭 Class Diagram (OOP Perspective)

classDiagram
    class User {
        +String id
        +String username
        +String name
        +String email
        +AuthProvider provider
        +String providerId
        +String password
        +Int elo
        +Int wins
        +Int losses
        +Int draws
        +UserStatus status
        +Boolean banned
        +DateTime createdAt
    }

    class Game {
        +String id
        +String roomId
        +String fen
        +Json[] moveHistory
        +Json timers
        +GameStatus status
        +Json[] chat
        +String winnerId
        +DateTime createdAt
        +DateTime updatedAt
        +DateTime endedAt
        +String userId
    }

    class Room {
        +String id
        +RoomType type
        +RoomStatus status
        +Json[] players
        +String inviteCode
        +DateTime createdAt
        +DateTime updatedAt
    }

    class GamePlayer {
        +String gameId
        +String userId
        +String color
    }

    User "1" --> "*" GamePlayer : plays
    Game "1" --> "*" GamePlayer : includes
    Room "1" --> "*" Game : contains
    Game "1" --> "1" Room : uses
Loading

About

Real-Time Chess Platform – A full-stack, multiplayer chess experience featuring live gameplay, in-game chat, and move history tracking. Designed with a dedicated WebSocket architecture for instant, smooth UI updates while keeping the server as the single source of truth for secure move validation. Built with performance, fairness, & user experience

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages