# alexprofmutua/foreverchess architecture

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

- Interactive diagram: https://gitdiagram.com/alexprofmutua/foreverchess
- Repository: https://github.com/alexprofmutua/foreverchess

## Overview

ForeverChess is a local chess-scoresheet dashboard and scanner. The README also describes an editable-game, recognition, replay, and PGN workflow, but explicitly says those changes await a separate commit; the supplied source shows the earlier dashboard and scanner, so those later stages are not mapped as implemented. The graph follows the evidenced capture/import, crop, and session-save flow. Some scanner relationships are supported only by the SOURCE INDEX; unsampled modules are not assumed to implement additional capabilities.

Main entry points: [`src/scanner/Scanner.tsx`](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/Scanner.tsx) (Scanner flow), [`src/scanner/images.ts`](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/images.ts) (Image import), [`src/App.tsx`](https://github.com/alexprofmutua/foreverchess/blob/main/src/App.tsx) (App shell), [`src/scanner/CameraView.tsx`](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/CameraView.tsx) (Camera capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Dashboard workspace"]
  node_app["App shell<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_dashboard_data[("Demo data<br/>[dashboard.ts]")]
end

subgraph group_capture["Scoresheet scanning"]
  node_scanner["Scanner flow<br/>[Scanner.tsx]"]
  node_camera["Camera capture<br/>[CameraView.tsx]"]
  node_crop["Crop editor<br/>[CropEditor.tsx]"]
end

subgraph group_processing["Image processing"]
  node_image_io["Image import<br/>[images.ts]"]
  node_pdf_import["PDF import<br/>[pdf.ts]"]
  node_geometry["Scan geometry<br/>[geometry.ts]"]
  node_vision_client["Vision client<br/>[vision.ts]"]
  node_vision_worker["Vision worker<br/>[vision.worker.ts]"]
end

subgraph group_session["Session scans"]
  node_scan_library["Scan library<br/>[ScanLibrary.tsx]"]
  node_saved_scans[("Session scans<br/>[types.ts]")]
  node_blob_url["Blob URL hook<br/>[useBlobURL.ts]"]
end

node_player(("User"))

node_player -->|"uses"| node_app
node_app -->|"renders"| node_dashboard
node_dashboard -->|"reads"| node_dashboard_data
node_app -->|"searches"| node_dashboard_data
node_app -->|"opens"| node_scanner
node_scanner -->|"renders"| node_camera
node_scanner -->|"uses"| node_crop
node_scanner -->|"renders"| node_scan_library
node_camera -->|"delivers capture"| node_scanner
node_scanner -->|"imports files"| node_image_io
node_scanner -->|"detects edges"| node_vision_client
node_crop -->|"processes image"| node_vision_client
node_crop -->|"reads and rotates"| node_image_io
node_scanner -->|"saves scans"| node_scan_library
node_image_io -->|"imports PDF"| node_pdf_import
node_image_io -->|"uses limits"| node_geometry
node_camera -->|"checks stability"| node_geometry
node_camera -->|"normalizes capture"| node_image_io
node_vision_client -->|"dispatches work"| node_vision_worker
node_vision_worker -->|"uses geometry"| node_geometry
node_scan_library -->|"displays"| node_saved_scans
node_scan_library -->|"creates image URLs"| node_blob_url

click node_app "https://github.com/alexprofmutua/foreverchess/blob/main/src/App.tsx"
click node_dashboard "https://github.com/alexprofmutua/foreverchess/blob/main/src/Dashboard.tsx"
click node_dashboard_data "https://github.com/alexprofmutua/foreverchess/blob/main/src/data/dashboard.ts"
click node_scanner "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/Scanner.tsx"
click node_camera "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/CameraView.tsx"
click node_crop "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/CropEditor.tsx"
click node_scan_library "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/ScanLibrary.tsx"
click node_saved_scans "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/types.ts"
click node_blob_url "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/useBlobURL.ts"
click node_image_io "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/images.ts"
click node_pdf_import "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/pdf.ts"
click node_geometry "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/geometry.ts"
click node_vision_client "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/vision.ts"
click node_vision_worker "https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/vision.worker.ts"

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_app,node_dashboard,node_dashboard_data,node_player toneBlue
class node_scanner,node_camera,node_crop toneAmber
class node_image_io,node_pdf_import,node_geometry,node_vision_client,node_vision_worker toneMint
class node_scan_library,node_saved_scans,node_blob_url toneRose
```

## Components

### Dashboard workspace

- [App shell](https://github.com/alexprofmutua/foreverchess/blob/main/src/App.tsx): `src/App.tsx`
- [Dashboard](https://github.com/alexprofmutua/foreverchess/blob/main/src/Dashboard.tsx): `src/Dashboard.tsx`
- [Demo data](https://github.com/alexprofmutua/foreverchess/blob/main/src/data/dashboard.ts): `src/data/dashboard.ts`

### Scoresheet scanning

- [Scanner flow](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/Scanner.tsx): `src/scanner/Scanner.tsx`
- [Camera capture](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/CameraView.tsx): `src/scanner/CameraView.tsx`
- [Crop editor](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/CropEditor.tsx): `src/scanner/CropEditor.tsx`

### Image processing

- [Image import](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/images.ts): `src/scanner/images.ts`
- [PDF import](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/pdf.ts): `src/scanner/pdf.ts`
- [Scan geometry](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/geometry.ts): `src/scanner/geometry.ts`
- [Vision client](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/vision.ts): `src/scanner/vision.ts`
- [Vision worker](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/vision.worker.ts): `src/scanner/vision.worker.ts`

### Session scans

- [Scan library](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/ScanLibrary.tsx): `src/scanner/ScanLibrary.tsx`
- [Session scans](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/types.ts): `src/scanner/types.ts`
- [Blob URL hook](https://github.com/alexprofmutua/foreverchess/blob/main/src/scanner/useBlobURL.ts): `src/scanner/useBlobURL.ts`

### Other components

- **User**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Dashboard: renders (evidence: `src/App.tsx`)
- Dashboard → Demo data: reads (evidence: `src/Dashboard.tsx`)
- App shell → Demo data: searches (evidence: `src/App.tsx`)
- App shell → Scanner flow: opens (evidence: `src/App.tsx`)
- Scanner flow → Camera capture: renders (evidence: `src/scanner/Scanner.tsx`)
- Scanner flow → Crop editor: uses (evidence: `src/scanner/Scanner.tsx`)
- Scanner flow → Scan library: renders (evidence: `src/scanner/Scanner.tsx`)
- Camera capture → Scanner flow: delivers capture (evidence: `src/scanner/Scanner.tsx`)
- Scanner flow → Image import: imports files (evidence: `src/scanner/Scanner.tsx`)
- Scanner flow → Vision client: detects edges (evidence: `src/scanner/Scanner.tsx`)
- Crop editor → Vision client: processes image (evidence: `src/scanner/CropEditor.tsx`)
- Crop editor → Image import: reads and rotates (evidence: `src/scanner/CropEditor.tsx`)
- Scanner flow → Scan library: saves scans (evidence: `src/App.tsx`)
- Image import → PDF import: imports PDF (evidence: `src/scanner/images.ts`)
- Image import → Scan geometry: uses limits (evidence: `src/scanner/images.ts`)
- Camera capture → Scan geometry: checks stability (evidence: `src/scanner/CameraView.tsx`)
- Camera capture → Image import: normalizes capture (evidence: `src/scanner/CameraView.tsx`)
- Vision client → Vision worker: dispatches work (evidence: `src/scanner/vision.ts`)
- Vision worker → Scan geometry: uses geometry (evidence: `src/scanner/vision.worker.ts`)
- Scan library → Session scans: displays (evidence: `src/scanner/ScanLibrary.tsx`)
- Scan library → Blob URL hook: creates image URLs (evidence: `src/scanner/ScanLibrary.tsx`)
