Skip to content

abeshahsan/ChessDuel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

21 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ™Ÿ๏ธ ChessDuel - Real-Time Multiplayer Chess Platform

A sophisticated real-time chess application showcasing modern web development expertise and clean architecture principles

Next.js TypeScript React Socket.io Material-UI Redux

๐ŸŽฏ Project Overview

ChessDuel is a production-ready, real-time multiplayer chess platform built with cutting-edge web technologies. This project demonstrates advanced full-stack development skills, emphasizing clean architecture, real-time communication, and modern UI/UX principles.

๐ŸŒŸ Key Highlights

  • ๐Ÿ—๏ธ Modern Architecture: Built with Next.js 15 App Router and React 19 Server Components
  • โšก Real-Time Multiplayer: WebSocket-based gameplay using Socket.IO for instant move synchronization
  • ๐ŸŽจ Professional UI: Material-UI design system with custom theming and responsive layouts
  • ๐Ÿ” Authentication: Secure OAuth integration with GitHub and Google providers
  • โ™Ÿ๏ธ Chess Logic: Comprehensive game validation using chess.js with move history and game state management
  • ๐Ÿ“ฑ Responsive Design: Mobile-first approach with adaptive layouts for all screen sizes
  • ๐Ÿงฉ Modular Codebase: SOLID principles implementation with clean component separation

๐Ÿš€ Technical Stack

Frontend

  • โš›๏ธ React 19 - Latest React with concurrent features and server components
  • ๐Ÿ“˜ TypeScript 5 - Strict type safety and modern ES features
  • ๐ŸŽจ Material-UI 6.3.1 - Professional component library with custom theming
  • ๐Ÿ’… TailwindCSS 3.4 - Utility-first CSS framework for rapid styling
  • ๐ŸŽฒ Redux Toolkit 2.5 - State management with modern Redux patterns
  • โ™ž react-chessboard 4.7 - Interactive chess board component

Backend & Infrastructure

  • โšก Next.js 15.5.6 - Full-stack framework with App Router and Turbopack
  • ๐Ÿ”Œ Socket.IO 4.8.1 - Real-time bidirectional communication
  • ๐Ÿ” NextAuth 5.0 - Secure authentication with multiple providers
  • ๐ŸŽฏ chess.js 1.0 - Chess game logic and move validation
  • ๐Ÿ“ฆ Node.js - Server-side runtime environment

Development Tools

  • ๐Ÿ› ๏ธ ESLint - Code quality and consistency
  • ๐ŸŽจ PostCSS - Advanced CSS processing
  • ๐Ÿ“ฑ Responsive Design - Mobile-first development approach

โœจ Core Features

๐ŸŽฎ Gameplay Features

  • Real-time Chess Matches - Instant move synchronization between players
  • Move Validation - Complete chess rule enforcement with illegal move prevention
  • Game History - Full move tracking and game state persistence
  • Match Creation & Joining - Seamless multiplayer match setup
  • Captured Pieces Display - Visual tracking of captured pieces
  • Game Status Indicators - Check, checkmate, and draw detection

๐ŸŽจ User Interface

  • Dark/Light Theme Toggle - Persistent theme preference with system detection
  • Responsive Design - Optimized for desktop, tablet, and mobile devices
  • Interactive Chessboard - Drag-and-drop piece movement with visual feedback
  • Navigation Drawer - Clean sidebar navigation with Material Design
  • Loading States - Smooth transitions and loading indicators
  • Modal Dialogs - Professional game creation and join interfaces

๐Ÿ”’ Authentication & Security

  • OAuth Integration - GitHub and Google provider authentication
  • Session Management - Secure server-side session handling
  • Protected Routes - Authentication-based route protection
  • Error Handling - Comprehensive error boundaries and user feedback

๐Ÿ—๏ธ Architecture Highlights

๐Ÿงฉ SOLID Principles Implementation

The codebase demonstrates professional software architecture through:

  • Single Responsibility: Components have focused, single purposes
  • Open/Closed: Modular design allowing extension without modification
  • Dependency Inversion: Abstractions control dependencies, not concretions

๐Ÿ“ Project Structure

src/
โ”œโ”€โ”€ app/                          # Next.js App Router
โ”‚   โ”œโ”€โ”€ api/                      # API routes and endpoints
โ”‚   โ”‚   โ”œโ”€โ”€ auth/                 # Authentication endpoints
โ”‚   โ”‚   โ””โ”€โ”€ matches/              # Match management API
โ”‚   โ”œโ”€โ”€ auth/                     # Authentication pages
โ”‚   โ”œโ”€โ”€ components/               # Shared components
โ”‚   โ”œโ”€โ”€ global-components/        # Global UI components
โ”‚   โ”‚   โ”œโ”€โ”€ chessboard/          # Modular chess components
โ”‚   โ”‚   โ”œโ”€โ”€ navbar/              # Navigation components
โ”‚   โ”‚   โ””โ”€โ”€ sidebar/             # Sidebar components
โ”‚   โ”œโ”€โ”€ match/                    # Match-specific pages and components
โ”‚   โ”œโ”€โ”€ providers/                # Context providers
โ”‚   โ””โ”€โ”€ store/                    # Redux store configuration
โ”œโ”€โ”€ lib/                          # Utility libraries
โ””โ”€โ”€ pages/api/                    # Socket.IO API handlers

๐Ÿ”„ State Management Architecture

  • Redux Toolkit for global state management
  • Custom hooks for component-level logic
  • Socket.IO integration with Redux middleware
  • Persistent client ID management for reconnection handling

๐Ÿ› ๏ธ Installation & Setup

Prerequisites

  • Node.js 18.x or higher
  • npm, yarn, pnpm, or bun package manager
  • Git for version control

Quick Start

  1. Clone the repository

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

    npm install
    # or
    yarn install
    # or
    pnpm install
  3. Environment Configuration

    # Create environment file
    cp .env.example .env.local
    
    # Configure authentication providers
    NEXTAUTH_SECRET=your_nextauth_secret
    GITHUB_CLIENT_ID=your_github_client_id
    GITHUB_CLIENT_SECRET=your_github_client_secret
    GOOGLE_CLIENT_ID=your_google_client_id
    GOOGLE_CLIENT_SECRET=your_google_client_secret
  4. Start the development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  5. Open the application Navigate to http://localhost:3000 to start playing!

๐ŸŽฏ Usage Guide

Creating a Match

  1. Sign in using GitHub or Google authentication
  2. Navigate to "New Match" from the sidebar
  3. Share the generated match URL with your opponent
  4. Start playing once both players have joined

Joining a Match

  1. Sign in to your account
  2. Use the match URL provided by your opponent
  3. Automatically join the game session
  4. Begin playing immediately

Game Controls

  • Click and drag pieces to make moves
  • Valid moves are highlighted in green
  • Active square is highlighted in blue
  • Captured pieces are displayed alongside the board

๐Ÿš€ Deployment

Vercel Deployment (Recommended)

# Install Vercel CLI
npm i -g vercel

# Deploy to Vercel
vercel

# Configure environment variables in Vercel dashboard

Docker Deployment

# Build Docker image
docker build -t chessduel .

# Run container
docker run -p 3000:3000 chessduel

Manual Deployment

# Build production bundle
npm run build

# Start production server
npm start

๐Ÿงช Testing & Quality Assurance

Code Quality

  • ESLint configuration for consistent code style
  • TypeScript strict mode for type safety
  • Component testing with React Testing Library
  • E2E testing capabilities with Playwright

Performance Optimization

  • Next.js optimization with automatic code splitting
  • Image optimization with next/image
  • Font optimization with next/font
  • Bundle analysis for size optimization

๐Ÿ“ˆ Technical Achievements

๐Ÿ”ง Advanced Patterns Implemented

  • Server Components with Next.js 15 App Router
  • Custom Hook Architecture for reusable logic
  • Redux Toolkit with modern patterns
  • WebSocket Integration with state synchronization
  • Theme Provider with system preference detection
  • Route Protection with authentication middleware

๐Ÿ† Development Best Practices

  • TypeScript for complete type safety
  • Component Composition over inheritance
  • Custom Hooks for logic separation
  • Error Boundaries for robust error handling
  • Responsive Design with mobile-first approach
  • Performance Optimization with React 19 features

๐Ÿค Contributing

This project welcomes contributions! Please feel free to:

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages