A sophisticated real-time chess application showcasing modern web development expertise and clean architecture principles
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.
- ๐๏ธ 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
- โ๏ธ 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
- โก 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
- ๐ ๏ธ ESLint - Code quality and consistency
- ๐จ PostCSS - Advanced CSS processing
- ๐ฑ Responsive Design - Mobile-first development approach
- 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
- 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
- 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
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
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
- 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
- Node.js 18.x or higher
- npm, yarn, pnpm, or bun package manager
- Git for version control
-
Clone the repository
git clone https://github.com/yourusername/chessduel.git cd chessduel -
Install dependencies
npm install # or yarn install # or pnpm install
-
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
-
Start the development server
npm run dev # or yarn dev # or pnpm dev
-
Open the application Navigate to http://localhost:3000 to start playing!
- Sign in using GitHub or Google authentication
- Navigate to "New Match" from the sidebar
- Share the generated match URL with your opponent
- Start playing once both players have joined
- Sign in to your account
- Use the match URL provided by your opponent
- Automatically join the game session
- Begin playing immediately
- 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
# Install Vercel CLI
npm i -g vercel
# Deploy to Vercel
vercel
# Configure environment variables in Vercel dashboard# Build Docker image
docker build -t chessduel .
# Run container
docker run -p 3000:3000 chessduel# Build production bundle
npm run build
# Start production server
npm start- ESLint configuration for consistent code style
- TypeScript strict mode for type safety
- Component testing with React Testing Library
- E2E testing capabilities with Playwright
- Next.js optimization with automatic code splitting
- Image optimization with next/image
- Font optimization with next/font
- Bundle analysis for size optimization
- 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
- 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
This project welcomes contributions! Please feel free to:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request