How dsnext412-jpg/chess works
Chess Session is a browser-based, account-free multiplayer chess app. Players create or join a private room, connect peer-to-peer, play a synchronized match, and see its result. The graph separates navigation and room entry, session networking, chess rules/state, and the game interface and preferences. The sampled session and engine excerpts support their internal calls; several UI relationships and feature details are documented or listed in the source index but not shown in full source excerpts.
Main entry points: GameView.tsx Game View · App.tsx App Routing · SessionManager.ts Session Manager · useSession.ts Session Hook
Components 20
Entry and Rooms
- App Routing
src/App.tsx - Home Page
src/components/HomePage.tsx - Create Room
src/components/CreateRoom.tsx - Join Room
src/components/JoinRoom.tsx - Waiting Room
src/components/WaitingRoom.tsx
Session Networking
- Session Hook
src/hooks/useSession.ts - Session Manager
src/session/SessionManager.ts - PeerJS / WebRTC
- Message Protocol
src/lib/protocol.ts
Chess State
- Game Engine
src/lib/gameEngine.ts - Board Utilities
src/lib/board.ts
Game Experience
- Game View
src/components/GameView.tsx - Chess Board
src/components/ChessBoard.tsx - Move History
src/components/MoveHistory.tsx - Captured Pieces
src/components/CapturedPieces.tsx - Game Controls
src/components/GameControls.tsx - Game Settings
src/components/GameSettings.tsx - Preferences
src/hooks/usePreferences.ts - Board and Piece Themes
src/lib/themes.ts
Other components
- Player
Connections 26
- Player → App Routing: opens
- App Routing → Home Page: renders
src/App.tsx - App Routing → Create Room: renders
src/App.tsx - App Routing → Join Room: renders
src/App.tsx - App Routing → Waiting Room: renders
src/App.tsx - App Routing → Game View: renders
src/App.tsx - Player → Create Room: creates room
- Player → Join Room: joins room
- Create Room → Session Hook: starts hosting
src/components/CreateRoom.tsx - Join Room → Session Hook: requests join
src/components/JoinRoom.tsx - Waiting Room → Session Manager: reads session
src/components/WaitingRoom.tsx - Session Hook → Session Manager: dispatches actions
src/hooks/useSession.ts - Session Manager → PeerJS / WebRTC: connects peers
- Session Manager → Message Protocol: parses messages
src/session/SessionManager.ts - Session Manager → Game Engine: updates game
src/session/SessionManager.ts - Session Manager → PeerJS / WebRTC: exchanges messages
- Game View → Session Hook: reads session
src/components/GameView.tsx - Game View → Chess Board: renders
src/components/GameView.tsx - Game View → Move History: renders
src/components/GameView.tsx - Game View → Captured Pieces: renders
src/components/GameView.tsx - Game View → Game Controls: renders
src/components/GameView.tsx - Game View → Game Settings: renders
src/components/GameView.tsx - Chess Board → Game Engine: checks moves
src/components/ChessBoard.tsx - Game Engine → Board Utilities: uses coordinates
src/lib/gameEngine.ts - Game Settings → Preferences: updates options
src/components/GameSettings.tsx - Game Settings → Board and Piece Themes: offers themes
src/components/GameSettings.tsx