# 5h0xib/chess-online architecture

> Architecture diagram of the GitHub repository 5h0xib/chess-online, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/5h0xib/chess-online
- Repository: https://github.com/5h0xib/chess-online

## Overview

Chess Online is a browser-based chess platform. Players authenticate, reach the dashboard, then start local AI games or find friends and challenge them; online games synchronize moves and status through Supabase. The product also includes profiles and presence, social requests, in-game chat, notifications, and finished-game history. The graph separates page workflows, game logic, social features, and backend configuration. Edges reflect calls or data access visible in excerpts, or capabilities explicitly documented in the README; unsampled wiring is omitted.

Main entry points: [`js/game.js`](https://github.com/5h0xib/chess-online/blob/main/js/game.js) (Game orchestration), [`js/friends.js`](https://github.com/5h0xib/chess-online/blob/main/js/friends.js) (Friend management), [`dashboard.html`](https://github.com/5h0xib/chess-online/blob/main/dashboard.html) (Player dashboard), [`friends.html`](https://github.com/5h0xib/chess-online/blob/main/friends.html) (Friends page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pages["Player workflows"]
  node_login["Sign-in page<br/>[index.html]"]
  node_dashboard["Player dashboard<br/>[dashboard.html]"]
  node_friends_page["Friends page<br/>[friends.html]"]
  node_game_page["Game page<br/>[game.html]"]
  node_history_page["History page<br/>[history.html]"]
  node_dashboard_logic["Dashboard logic<br/>[dashboard.js]"]
end

subgraph group_gameplay["Chess gameplay"]
  node_chess["Chess rules and AI<br/>[chess-engine.js]"]
  node_game["Game orchestration<br/>[game.js]"]
  node_chat["Game chat<br/>[chat.js]"]
  node_layout["Game layout preferences<br/>[layout.js]"]
end

subgraph group_social["Social and history"]
  node_friends["Friend management<br/>[friends.js]"]
  node_notifications["Notifications and challenges<br/>[notifications.js]"]
  node_history["Game history<br/>[history.js]"]
end

subgraph group_backend["Backend and presentation"]
  node_auth["Authentication<br/>[auth.js]"]
  node_theme["Theme preferences<br/>[theme.js]"]
  node_client["Supabase client setup<br/>[supabase-client.js]"]
  node_schema["Database schema and RLS<br/>[schema.sql]"]
end

node_player(("Player"))
node_supabase[("Supabase services")]

node_player -->|"signs in"| node_login
node_player -->|"opens hub"| node_dashboard
node_player -->|"finds friends"| node_friends_page
node_player -->|"plays chess"| node_game_page
node_player -->|"reviews games"| node_history_page
node_dashboard -->|"runs"| node_dashboard_logic
node_friends_page -->|"runs"| node_friends
node_game_page -->|"runs"| node_game
node_history_page -->|"runs"| node_history
node_game -->|"uses rules and AI"| node_chess
node_game -->|"syncs moves and status"| node_supabase
node_chat -->|"reads and sends chat"| node_supabase
node_friends -->|"subscribes to requests"| node_notifications
node_friends -->|"manages social data"| node_supabase
node_notifications -->|"handles challenges"| node_supabase
node_dashboard_logic -->|"reads games and friends"| node_supabase
node_history -->|"loads finished games"| node_supabase
node_auth -->|"authenticates and updates profiles"| node_supabase
node_client -->|"configures client"| node_supabase
node_schema -->|"defines tables and policies"| node_supabase
node_game -.->|"enables online chat"| node_chat
node_player -->|"customizes layout"| node_layout
node_player -->|"switches theme"| node_theme

click node_login "https://github.com/5h0xib/chess-online/blob/main/index.html"
click node_dashboard "https://github.com/5h0xib/chess-online/blob/main/dashboard.html"
click node_friends_page "https://github.com/5h0xib/chess-online/blob/main/friends.html"
click node_game_page "https://github.com/5h0xib/chess-online/blob/main/game.html"
click node_history_page "https://github.com/5h0xib/chess-online/blob/main/history.html"
click node_auth "https://github.com/5h0xib/chess-online/blob/main/js/auth.js"
click node_dashboard_logic "https://github.com/5h0xib/chess-online/blob/main/js/dashboard.js"
click node_chess "https://github.com/5h0xib/chess-online/blob/main/js/chess-engine.js"
click node_game "https://github.com/5h0xib/chess-online/blob/main/js/game.js"
click node_chat "https://github.com/5h0xib/chess-online/blob/main/js/chat.js"
click node_friends "https://github.com/5h0xib/chess-online/blob/main/js/friends.js"
click node_notifications "https://github.com/5h0xib/chess-online/blob/main/js/notifications.js"
click node_history "https://github.com/5h0xib/chess-online/blob/main/js/history.js"
click node_layout "https://github.com/5h0xib/chess-online/blob/main/js/layout.js"
click node_theme "https://github.com/5h0xib/chess-online/blob/main/js/theme.js"
click node_client "https://github.com/5h0xib/chess-online/blob/main/js/supabase-client.js"
click node_schema "https://github.com/5h0xib/chess-online/blob/main/supabase/schema.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_login,node_dashboard,node_friends_page,node_game_page,node_history_page,node_dashboard_logic toneBlue
class node_chess,node_game,node_chat,node_layout,node_supabase toneAmber
class node_friends,node_notifications,node_history toneMint
class node_auth,node_theme,node_client,node_schema toneRose
class node_player toneIndigo
```

## Components

### Player workflows

- [Sign-in page](https://github.com/5h0xib/chess-online/blob/main/index.html): `index.html`
- [Player dashboard](https://github.com/5h0xib/chess-online/blob/main/dashboard.html): `dashboard.html`
- [Friends page](https://github.com/5h0xib/chess-online/blob/main/friends.html): `friends.html`
- [Game page](https://github.com/5h0xib/chess-online/blob/main/game.html): `game.html`
- [History page](https://github.com/5h0xib/chess-online/blob/main/history.html): `history.html`
- [Dashboard logic](https://github.com/5h0xib/chess-online/blob/main/js/dashboard.js): `js/dashboard.js`

### Chess gameplay

- [Chess rules and AI](https://github.com/5h0xib/chess-online/blob/main/js/chess-engine.js): `js/chess-engine.js`
- [Game orchestration](https://github.com/5h0xib/chess-online/blob/main/js/game.js): `js/game.js`
- [Game chat](https://github.com/5h0xib/chess-online/blob/main/js/chat.js): `js/chat.js`
- [Game layout preferences](https://github.com/5h0xib/chess-online/blob/main/js/layout.js): `js/layout.js`

### Social and history

- [Friend management](https://github.com/5h0xib/chess-online/blob/main/js/friends.js): `js/friends.js`
- [Notifications and challenges](https://github.com/5h0xib/chess-online/blob/main/js/notifications.js): `js/notifications.js`
- [Game history](https://github.com/5h0xib/chess-online/blob/main/js/history.js): `js/history.js`

### Backend and presentation

- [Authentication](https://github.com/5h0xib/chess-online/blob/main/js/auth.js): `js/auth.js`
- [Theme preferences](https://github.com/5h0xib/chess-online/blob/main/js/theme.js): `js/theme.js`
- [Supabase client setup](https://github.com/5h0xib/chess-online/blob/main/js/supabase-client.js): `js/supabase-client.js`
- [Database schema and RLS](https://github.com/5h0xib/chess-online/blob/main/supabase/schema.sql): `supabase/schema.sql`

### Other components

- **Player**
- **Supabase services**

## Connections

- Player → Sign-in page: signs in (evidence: `README.md`)
- Player → Player dashboard: opens hub (evidence: `README.md`)
- Player → Friends page: finds friends (evidence: `README.md`)
- Player → Game page: plays chess (evidence: `README.md`)
- Player → History page: reviews games (evidence: `README.md`)
- Player dashboard → Dashboard logic: runs (evidence: `README.md`)
- Friends page → Friend management: runs (evidence: `README.md`)
- Game page → Game orchestration: runs (evidence: `README.md`)
- History page → Game history: runs (evidence: `README.md`)
- Game orchestration → Chess rules and AI: uses rules and AI (evidence: `README.md`)
- Game orchestration → Supabase services: syncs moves and status (evidence: `js/game.js`)
- Game chat → Supabase services: reads and sends chat (evidence: `js/chat.js`)
- Friend management → Notifications and challenges: subscribes to requests (evidence: `js/friends.js`)
- Friend management → Supabase services: manages social data (evidence: `js/friends.js`)
- Notifications and challenges → Supabase services: handles challenges (evidence: `js/notifications.js`)
- Dashboard logic → Supabase services: reads games and friends (evidence: `js/dashboard.js`)
- Game history → Supabase services: loads finished games (evidence: `js/history.js`)
- Authentication → Supabase services: authenticates and updates profiles (evidence: `js/auth.js`)
- Supabase client setup → Supabase services: configures client (evidence: `js/supabase-client.js`)
- Database schema and RLS → Supabase services: defines tables and policies (evidence: `README.md`)
- Game orchestration → Game chat: enables online chat
- Player → Game layout preferences: customizes layout (evidence: `js/layout.js`)
- Player → Theme preferences: switches theme (evidence: `js/theme.js`)
