How abineshkumarr/chessley works
Purpose and Entry Points
This is a browser-based chess game built as a Vite/React single-page application. Startup flows from index.html to src/main.jsx, which mounts the application root in src/App.jsx. Styling is application-wide in src/index.css, with Tailwind/PostCSS configuration available for the build pipeline.
Application Composition
src/App.jsx is the top-level composition boundary. The UI is organized around the playable game surface in src/components/ChessGame.jsx, with surrounding navigation and lobby/setup experiences in:
• src/components/TopNav.jsx
• src/components/SetupLobby.jsx
• src/components/ChessSidebar.jsx
The lobby likely collects game mode, player, bot, or theme choices before handing control to the active game view.
Game Session and Board Interaction
src/components/ChessGame.jsx is the central game-session coordinator: it should own or orchestrate board position, turn progression, selected pieces/squares, legal move application, and transitions into promotion or game-over states. Its direct presentation/control boundaries include:
• src/components/GameControls.jsx
• src/components/GameStatus.jsx
• src/components/PromotionModal.jsx
Promotion and terminal-game dialogs isolate exceptional game-state decisions from ordinary board interaction.
Player, Clock, and History Surfaces
The game shell exposes player-facing state through specialized components rather than embedding it in the board:
• src/components/ChessClock.jsx
• src/components/PlayerRibbon.jsx
• src/components/MoveHistory.jsx
Captured material and full historical review are separate views in src/components/CapturedPieces.jsx and src/components/GameHistoryModal.jsx. This division permits the core session state to drive multiple synchronized read-only displays, while controls send actions back to the game coordinator.
Engine and Bot Boundary
Chess-specific automated-opponent logic is isolated under src/engine, especially:
• src/engine/bot.js
• src/engine/pst.js
• src/engine/threats.js
bot.js is the likely decision boundary between UI state and computer moves. Piece-square tables in pst.js and tactical/threat evaluation in threats.js support move scoring or selection. Sound behavior is similarly separated in src/engine/sound.js, preventing audio effects from being coupled to React presentation components.
Configuration, Persistence, and Assets
Static game choices are centralized in src/constants/bots.js and src/constants/themes.js, allowing setup and game UI to consume shared bot/theme definitions. Browser persistence is abstracted behind src/utils/storage.js, likely for saved preferences or resumable game-related state.
Avatar assets reside in public/avatars; scripts/download-avatars.mjs is an asset-acquisition integration point and may contact an external avatar source during development or asset refresh, not at normal runtime.
Runtime and Build Infrastructure
The runtime is client-side JavaScript in the browser, packaged by Vite via vite.config.js. Dependency and script definitions are in package.json. Tailwind/PostCSS are configured through tailwind.config.js and postcss.config.js; they support the frontend styling pipeline rather than game execution. No backend, database, API client, or server-side service is represented in the supplied tree.
Main entry points: ChessGame.jsx Chess game · App.jsx App root · main.jsx React mount · SetupLobby.jsx Setup lobby
Components 22
React UI
- HTML entry
index.html - React mount
src/main.jsx - App root
src/App.jsx - Global styles
src/index.css - Top navigation
src/components/TopNav.jsx - Setup lobby
src/components/SetupLobby.jsx - Chess sidebar
src/components/ChessSidebar.jsx
Game Session
- Chess game · Owns board interaction, turn progression, and game-state transitions.
src/components/ChessGame.jsx - Game controls
src/components/GameControls.jsx - Game status
src/components/GameStatus.jsx - Promotion modal
src/components/PromotionModal.jsx - Chess clock
src/components/ChessClock.jsx - Player ribbon
src/components/PlayerRibbon.jsx - Move history
src/components/MoveHistory.jsx - Captured pieces
src/components/CapturedPieces.jsx - Game history modal
src/components/GameHistoryModal.jsx
Chess Engine
- Bot decision · Selects automated-opponent moves from game state.
src/engine/bot.js - Piece-square tables
src/engine/pst.js - Threat evaluation
src/engine/threats.js - Sound effects
src/engine/sound.js
Shared Runtime
- Bot and theme choices
src/constants/bots.js - Browser storage
src/utils/storage.js
Connections 24
- HTML entry → React mount: loads
- React mount → App root: mounts
- React mount → Global styles: imports
- App root → Top navigation: composes
- App root → Setup lobby: composes
- App root → Chess game: hosts
- App root → Chess sidebar: composes
- Setup lobby → Bot and theme choices: reads setup options
- Setup lobby → Chess game: starts session
- Chess game → Game controls: drives
- Chess game → Game status: drives
- Chess game → Promotion modal: opens when needed
- Chess game → Chess clock: drives
- Chess game → Player ribbon: drives
- Chess game → Move history: drives
- Chess game → Captured pieces: drives
- Chess game → Game history modal: opens
- Game controls → Chess game: sends actions
- Promotion modal → Chess game: selects piece
- Chess game → Bot decision: requests bot move
- Bot decision → Piece-square tables: scores with
- Bot decision → Threat evaluation: evaluates
- Chess game → Sound effects: triggers
- Chess game → Browser storage: persists state