# varunparmar0206/chesssense-chrome-extension architecture

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

- Interactive diagram: https://gitdiagram.com/varunparmar0206/chesssense-chrome-extension
- Repository: https://github.com/varunparmar0206/chesssense-chrome-extension

## Overview

ChessSense is a Chrome extension for live chess-position analysis on Chess.com. Its documented workflow detects the active board, derives FEN, submits positions to a local Stockfish worker, parses evaluations and candidate lines, then updates an on-board overlay. The excerpts show these responsibilities within content.js and its worker setup; the README documents additional engine and display capabilities. Since the source is one principal file and excerpts omit implementation details, relationships are limited to those evidenced by the excerpt or README.

Main entry points: [`content.js`](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js) (Stockfish worker), [`stockfish.js`](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/stockfish.js) (Stockfish engine), [`stockfish.wasm`](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/stockfish.wasm) (Engine runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Board Capture"]
  node_board["Board detection<br/>[content.js]"]
  node_fen["FEN generation<br/>[content.js]"]
  node_turn["Turn and game state<br/>[content.js]"]
end

subgraph group_analysis["Engine Analysis"]
  node_worker["Stockfish worker<br/>[content.js]"]
  node_engine["Stockfish engine<br/>[stockfish.js]"]
  node_wasm["Engine runtime<br/>[stockfish.wasm]"]
  node_parser["Analysis parsing<br/>[content.js]"]
end

subgraph group_display["On-Board Display"]
  node_overlay["Analysis overlay<br/>[content.js]"]
  node_arrows["Move arrows<br/>[content.js]"]
end

node_player(("Chess.com player"))

node_player -->|"plays on"| node_board
node_board -->|"provides position"| node_fen
node_turn -.->|"supplies game state"| node_fen
node_fen -->|"submits position"| node_worker
node_worker -->|"loads"| node_engine
node_engine -->|"runs with"| node_wasm
node_engine -.->|"returns analysis"| node_worker
node_worker -->|"dispatches messages"| node_parser
node_parser -->|"updates results"| node_overlay
node_overlay -.->|"shows suggestions"| node_arrows

click node_board "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js"
click node_fen "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js"
click node_turn "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js"
click node_worker "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js"
click node_engine "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/stockfish.js"
click node_wasm "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/stockfish.wasm"
click node_parser "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js"
click node_overlay "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js"
click node_arrows "https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.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_board,node_fen,node_turn toneBlue
class node_worker,node_engine,node_wasm,node_parser toneAmber
class node_overlay,node_arrows toneMint
class node_player toneIndigo
```

## Components

### Board Capture

- [Board detection](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`
- [FEN generation](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`
- [Turn and game state](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`

### Engine Analysis

- [Stockfish worker](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`
- [Stockfish engine](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/stockfish.js): `stockfish.js`
- [Engine runtime](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/stockfish.wasm): `stockfish.wasm`
- [Analysis parsing](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`

### On-Board Display

- [Analysis overlay](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`
- [Move arrows](https://github.com/varunparmar0206/chesssense-chrome-extension/blob/main/content.js): `content.js`

### Other components

- **Chess.com player**

## Connections

- Chess.com player → Board detection: plays on (evidence: `README.md`)
- Board detection → FEN generation: provides position (evidence: `README.md`)
- Turn and game state → FEN generation: supplies game state (evidence: `content.js`)
- FEN generation → Stockfish worker: submits position (evidence: `README.md`)
- Stockfish worker → Stockfish engine: loads (evidence: `content.js`)
- Stockfish engine → Engine runtime: runs with (evidence: `README.md`)
- Stockfish engine → Stockfish worker: returns analysis
- Stockfish worker → Analysis parsing: dispatches messages (evidence: `content.js`)
- Analysis parsing → Analysis overlay: updates results (evidence: `README.md`)
- Analysis overlay → Move arrows: shows suggestions (evidence: `content.js`)
