How l1ghtweight/lightchess works
Main Components
A. Frontend Layer:
• React Application (TypeScript/JavaScript)
• Key Components:
• Game Components (Chessboard, Timer, GameInfo)
• Authentication Components (Login, Register, SignIn, SignUp)
• User Interface Components (Dashboard, Leaderboard, Profile)
• Real-time Components (Chat, Matchmaking)
B. Backend Layer:
• Express.js Server (TypeScript)
• Authentication System
• Game Logic Module
• WebSocket Server (Socket.io)
C. Database Layer:
• MariaDB with Sequelize ORM
• Key Models:
• User Model
• Games Model
• Federated User Model (for OAuth)
D. External Services:
• Google OAuth
• Email Service
Component Relationships
• Backend → Database: Database queries through Sequelize
• Backend → External Services: OAuth and email service connections
Specific Implementation Details
Architectural patterns:
• MVC Pattern in Backend (visible in controllers/models structure)
• Component-based architecture in Frontend
• Token-based authentication flow
• Real-time game state management
┌─────────────────────────────────────────────┐
• Client Layer (Browser) │
• ┌─────────────────┐ ┌────────────────┐ │
• React Frontend │ │ Static Assets │ │
• ┘ └────────────────┘ │
• ┘
• ↕ HTTP/WebSocket
┌─────────────────────────────────────────────┐
• Server Layer │
• ┌─────────────┐ ┌────────────┐ ┌──────┐ │
• Express API │ │Socket.io │ │Auth │ │
• ┘ └────────────┘ └──────┘ │
• ┘
• ↕ Sequelize ORM
┌─────────────────────────────────────────────┐
• Data Layer │
• ┌─────────────┐ ┌──────────────────┐ │
• MariaDB │ │ External Services│ │
• ┘ └──────────────────┘ │
• ┘
Important Details to Highlight
• Authentication flow with JWT tokens
• Real-time game state management via Socket.io
• Database relationships between Users and Games
• Integration points with external services
• Static asset handling (sounds, images)
• API routes and controllers structure