# alinaline982/no.chess architecture

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

- Interactive diagram: https://gitdiagram.com/alinaline982/no.chess
- Repository: https://github.com/alinaline982/no.chess

## Overview

Chess vs Stockfish is a browser chess game: the player configures a game, makes legal moves, and receives Stockfish replies and evaluation, all on-device. The app also supports saved settings and resumable games, move history, undo, promotion, and engine-strength controls. The source excerpts show app.js coordinating the rules library and engine worker; the README documents the game capabilities and the service worker’s multithreading role. index.html and pieces/ are present in the tree, but their contents were not sampled, so UI links are limited to the app’s observed DOM interaction.

Main entry points: [`app.js`](https://github.com/alinaline982/no.chess/blob/main/app.js) (Game State), [`index.html`](https://github.com/alinaline982/no.chess/blob/main/index.html) (Game Interface), [`engine/stockfish-19.js`](https://github.com/alinaline982/no.chess/blob/main/engine/stockfish-19.js) (Stockfish Worker), [`coi-serviceworker.js`](https://github.com/alinaline982/no.chess/blob/main/coi-serviceworker.js) (COI Service Worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Chess Gameplay"]
  node_game_ui["Game Interface<br/>[index.html]"]
  node_board_render["Board and Pieces<br/>[app.js]"]
  node_move_input["Move Input<br/>[app.js]"]
  node_game_state["Game State<br/>[app.js]"]
  node_chess_rules["Chess Rules"]
  node_history["Move History<br/>[app.js]"]
  node_promotion["Promotion Choice<br/>[app.js]"]
  node_game_flow["Game Flow and Undo<br/>[app.js]"]
end

subgraph group_engine["Engine Analysis"]
  node_engine_worker["Stockfish Worker<br/>[stockfish-19.js]"]
  node_engine_wasm["Stockfish WebAssembly<br/>[stockfish-19.wasm]"]
  node_engine_protocol["Engine Commands and Results<br/>[app.js]"]
  node_evaluation["Position Evaluation<br/>[app.js]"]
end

subgraph group_settings["Settings and State"]
  node_settings_ui["Game Settings<br/>[index.html]"]
  node_settings_logic["Settings and Engine Options<br/>[app.js]"]
  node_persistence["Saved Settings and Game<br/>[app.js]"]
  node_browser_storage[("Browser Local Storage")]
end

subgraph group_runtime["Browser Runtime"]
  node_coi_worker["COI Service Worker"]
end

node_player(("Player"))
node_browser(("Browser"))
node_network["Resource Fetch"]

node_player -->|"uses"| node_game_ui
node_game_ui -->|"accepts moves"| node_move_input
node_game_ui -->|"sets options"| node_settings_logic
node_move_input -->|"updates position"| node_game_state
node_move_input -->|"requests legal moves"| node_chess_rules
node_game_flow -->|"starts or undoes"| node_game_state
node_game_state -->|"applies moves"| node_chess_rules
node_game_state -->|"renders position"| node_board_render
node_game_state -->|"supplies moves"| node_history
node_move_input -->|"offers promotion"| node_promotion
node_promotion -->|"completes move"| node_game_state
node_game_state -->|"requests reply"| node_engine_protocol
node_engine_protocol -->|"sends UCI commands"| node_engine_worker
node_engine_worker -->|"returns best move"| node_engine_protocol
node_engine_protocol -->|"applies reply"| node_game_state
node_engine_protocol -->|"parses scores"| node_evaluation
node_evaluation -->|"updates readout"| node_game_ui
node_settings_ui -->|"provides choices"| node_settings_logic
node_settings_logic -->|"configures engine"| node_engine_protocol
node_settings_logic -->|"saves options"| node_persistence
node_game_state -->|"saves game"| node_persistence
node_persistence -->|"reads and writes"| node_browser_storage
node_browser -->|"registers"| node_coi_worker
node_coi_worker -->|"fetches resources"| node_network

click node_game_ui "https://github.com/alinaline982/no.chess/blob/main/index.html"
click node_board_render "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_move_input "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_game_state "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_history "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_promotion "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_game_flow "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_engine_worker "https://github.com/alinaline982/no.chess/blob/main/engine/stockfish-19.js"
click node_engine_wasm "https://github.com/alinaline982/no.chess/blob/main/engine/stockfish-19.wasm"
click node_engine_protocol "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_evaluation "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_settings_ui "https://github.com/alinaline982/no.chess/blob/main/index.html"
click node_settings_logic "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_persistence "https://github.com/alinaline982/no.chess/blob/main/app.js"
click node_coi_worker "https://github.com/alinaline982/no.chess/blob/main/coi-serviceworker.js"

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_game_ui,node_board_render,node_move_input,node_game_state,node_chess_rules,node_history,node_promotion,node_game_flow,node_browser toneBlue
class node_engine_worker,node_engine_wasm,node_engine_protocol,node_evaluation toneAmber
class node_settings_ui,node_settings_logic,node_persistence,node_browser_storage toneMint
class node_coi_worker toneRose
class node_player,node_network toneIndigo
```

## Components

### Chess Gameplay

- [Game Interface](https://github.com/alinaline982/no.chess/blob/main/index.html): `index.html`
- [Board and Pieces](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- [Move Input](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- [Game State](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- **Chess Rules**
- [Move History](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- [Promotion Choice](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- [Game Flow and Undo](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`

### Engine Analysis

- [Stockfish Worker](https://github.com/alinaline982/no.chess/blob/main/engine/stockfish-19.js): `engine/stockfish-19.js`
- [Stockfish WebAssembly](https://github.com/alinaline982/no.chess/blob/main/engine/stockfish-19.wasm): `engine/stockfish-19.wasm`
- [Engine Commands and Results](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- [Position Evaluation](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`

### Settings and State

- [Game Settings](https://github.com/alinaline982/no.chess/blob/main/index.html): `index.html`
- [Settings and Engine Options](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- [Saved Settings and Game](https://github.com/alinaline982/no.chess/blob/main/app.js): `app.js`
- **Browser Local Storage**

### Browser Runtime

- [COI Service Worker](https://github.com/alinaline982/no.chess/blob/main/coi-serviceworker.js): `coi-serviceworker.js`

### Other components

- **Player**
- **Browser**
- **Resource Fetch**

## Connections

- Player → Game Interface: uses
- Game Interface → Move Input: accepts moves (evidence: `app.js`)
- Game Interface → Settings and Engine Options: sets options (evidence: `app.js`)
- Move Input → Game State: updates position (evidence: `app.js`)
- Move Input → Chess Rules: requests legal moves (evidence: `app.js`)
- Game Flow and Undo → Game State: starts or undoes (evidence: `app.js`)
- Game State → Chess Rules: applies moves (evidence: `app.js`)
- Game State → Board and Pieces: renders position (evidence: `app.js`)
- Game State → Move History: supplies moves (evidence: `app.js`)
- Move Input → Promotion Choice: offers promotion (evidence: `app.js`)
- Promotion Choice → Game State: completes move (evidence: `app.js`)
- Game State → Engine Commands and Results: requests reply (evidence: `app.js`)
- Engine Commands and Results → Stockfish Worker: sends UCI commands (evidence: `app.js`)
- Stockfish Worker → Engine Commands and Results: returns best move (evidence: `app.js`)
- Engine Commands and Results → Game State: applies reply (evidence: `app.js`)
- Engine Commands and Results → Position Evaluation: parses scores (evidence: `app.js`)
- Position Evaluation → Game Interface: updates readout (evidence: `app.js`)
- Game Settings → Settings and Engine Options: provides choices (evidence: `app.js`)
- Settings and Engine Options → Engine Commands and Results: configures engine (evidence: `README.md`)
- Settings and Engine Options → Saved Settings and Game: saves options (evidence: `app.js`)
- Game State → Saved Settings and Game: saves game (evidence: `app.js`)
- Saved Settings and Game → Browser Local Storage: reads and writes (evidence: `app.js`)
- Browser → COI Service Worker: registers (evidence: `coi-serviceworker.js`)
- COI Service Worker → Resource Fetch: fetches resources (evidence: `coi-serviceworker.js`)
