# razercode-dev/hollow-chess architecture

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

- Interactive diagram: https://gitdiagram.com/razercode-dev/hollow-chess
- Repository: https://github.com/razercode-dev/hollow-chess

## Overview

Hollow Chess is a browser-based chess game. A player interacts with the board and controls; the JavaScript game logic uses Chess.js for chess state and rules, updates the interface, and supports promotion, move history, undo/redo, and saved games. The README identifies HTML, CSS, and Chess.js via CDN, while the sampled JavaScript shows localStorage persistence and piece and sound assets. The HTML and CSS were not sampled, so their detailed wiring is not represented.

Main entry points: [`js/main.js`](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js) (Game logic), [`index.html`](https://github.com/razercode-dev/hollow-chess/blob/master/index.html) (Board and controls), [`assets/pieces`](https://github.com/razercode-dev/hollow-chess/tree/master/assets/pieces) (Piece images), [`assets/sound`](https://github.com/razercode-dev/hollow-chess/tree/master/assets/sound) (Move sounds)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Game interface"]
  node_webpage["Game page<br/>[index.html]"]
  node_board_controls["Board and controls<br/>[index.html]"]
  node_status_display["Game status<br/>[main.js]"]
end

subgraph group_gameplay["Chess gameplay"]
  node_game_logic["Game logic<br/>[main.js]"]
  node_board_interaction["Board interaction<br/>[main.js]"]
  node_chess_rules["Chess.js rules"]
  node_promotion["Promotion choice<br/>[main.js]"]
  node_move_history["Move history<br/>[main.js]"]
  node_undo_redo["Undo and redo<br/>[main.js]"]
end

subgraph group_state["Game state and assets"]
  node_saved_game["Saved game<br/>[main.js]"]
  node_local_storage[("Browser storage")]
  node_piece_assets["Piece images"]
  node_sound_assets["Move sounds"]
end

node_player(("Player"))

node_player -->|"interacts with"| node_board_controls
node_board_controls -->|"handles input"| node_board_interaction
node_board_interaction -->|"checks legal moves"| node_chess_rules
node_game_logic -->|"creates game"| node_chess_rules
node_game_logic -->|"registers handlers"| node_board_interaction
node_game_logic -->|"routes promotion"| node_promotion
node_game_logic -->|"renders moves"| node_move_history
node_game_logic -->|"updates game"| node_undo_redo
node_game_logic -->|"updates status"| node_status_display
node_game_logic -->|"loads and saves"| node_saved_game
node_saved_game -->|"reads and writes"| node_local_storage
node_game_logic -->|"loads images"| node_piece_assets
node_game_logic -->|"loads audio"| node_sound_assets
node_webpage -.->|"uses"| node_game_logic

click node_webpage "https://github.com/razercode-dev/hollow-chess/blob/master/index.html"
click node_game_logic "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_board_controls "https://github.com/razercode-dev/hollow-chess/blob/master/index.html"
click node_board_interaction "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_promotion "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_move_history "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_undo_redo "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_status_display "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_saved_game "https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js"
click node_piece_assets "https://github.com/razercode-dev/hollow-chess/tree/master/assets/pieces"
click node_sound_assets "https://github.com/razercode-dev/hollow-chess/tree/master/assets/sound"

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_webpage,node_board_controls,node_status_display toneBlue
class node_game_logic,node_board_interaction,node_chess_rules,node_promotion,node_move_history,node_undo_redo toneAmber
class node_saved_game,node_local_storage,node_piece_assets,node_sound_assets toneMint
class node_player toneIndigo
```

## Components

### Game interface

- [Game page](https://github.com/razercode-dev/hollow-chess/blob/master/index.html): `index.html`
- [Board and controls](https://github.com/razercode-dev/hollow-chess/blob/master/index.html): `index.html`
- [Game status](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`

### Chess gameplay

- [Game logic](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`
- [Board interaction](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`
- **Chess.js rules**
- [Promotion choice](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`
- [Move history](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`
- [Undo and redo](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`

### Game state and assets

- [Saved game](https://github.com/razercode-dev/hollow-chess/blob/master/js/main.js): `js/main.js`
- **Browser storage**
- [Piece images](https://github.com/razercode-dev/hollow-chess/tree/master/assets/pieces): `assets/pieces`
- [Move sounds](https://github.com/razercode-dev/hollow-chess/tree/master/assets/sound): `assets/sound`

### Other components

- **Player**

## Connections

- Player → Board and controls: interacts with (evidence: `README.md`)
- Board and controls → Board interaction: handles input (evidence: `js/main.js`)
- Board interaction → Chess.js rules: checks legal moves (evidence: `js/main.js`)
- Game logic → Chess.js rules: creates game (evidence: `js/main.js`)
- Game logic → Board interaction: registers handlers (evidence: `js/main.js`)
- Game logic → Promotion choice: routes promotion (evidence: `js/main.js`)
- Game logic → Move history: renders moves (evidence: `js/main.js`)
- Game logic → Undo and redo: updates game (evidence: `js/main.js`)
- Game logic → Game status: updates status (evidence: `js/main.js`)
- Game logic → Saved game: loads and saves (evidence: `js/main.js`)
- Saved game → Browser storage: reads and writes (evidence: `js/main.js`)
- Game logic → Piece images: loads images (evidence: `js/main.js`)
- Game logic → Move sounds: loads audio (evidence: `js/main.js`)
- Game page → Game logic: uses (evidence: `README.md`)
