# muhammad-usman-911/stampsheet-electronapp-videotoexcel architecture

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

- Interactive diagram: https://gitdiagram.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel
- Repository: https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel

## Overview

StampSheet is an Electron desktop app that reads timestamp overlays in CCTV/NVR videos and exports a reviewable Excel log. The primary workflow is: users select local or cloud videos, the app resolves camera names and streams remote file pieces as needed, OCR analyzes video frames, and users review results before exporting or appending an Excel register. The app also maintains device-local history and supports updates. The source excerpts show the main-process analysis dispatch and source handling; UI-to-main IPC details are not shown, so those links are marked unverified.

Main entry points: [`main.js`](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/main.js) (Electron controller), [`ui/src/App.tsx`](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/App.tsx) (App workspace), [`src/sources.js`](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/sources.js) (Source resolver), [`ui/src/Sources.tsx`](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/Sources.tsx) (Source browser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app_ui["App workspace<br/>[App.tsx]"]
  node_source_ui["Source browser<br/>[Sources.tsx]"]
  node_video_table["Video review<br/>[VideoTable.tsx]"]
  node_video_state["Video queue<br/>[useVideos.ts]"]
  node_history_ui["History view<br/>[History.tsx]"]
end

subgraph group_sources["Video sources"]
  node_source_resolver["Source resolver<br/>[sources.js]"]
  node_stream_bridge["Range stream bridge<br/>[streamBridge.js]"]
end

subgraph group_analysis["Analysis and export"]
  node_ocr["Video OCR<br/>[videoMeta.js]"]
  node_excel["Excel writer<br/>[excel.js]"]
end

subgraph group_accounts["Cloud accounts"]
  node_mega["MEGA account<br/>[megaAccount.js]"]
  node_drive["Drive account<br/>[driveAccount.js]"]
end

subgraph group_device["Device services"]
  node_main["Electron controller<br/>[main.js]"]
  node_history[("Local history<br/>[history.js]")]
  node_updates["Update service<br/>[updates.js]"]
end

node_user(("User"))
node_local_files["Local videos"]
node_mega_service["MEGA"]
node_google_drive["Google Drive"]
node_excel_file["Excel register"]
node_github["GitHub Releases"]

node_user -->|"uses"| node_app_ui
node_app_ui -->|"renders"| node_source_ui
node_app_ui -->|"renders"| node_video_table
node_app_ui -->|"uses"| node_video_state
node_app_ui -->|"renders"| node_history_ui
node_source_ui -.->|"requests sources"| node_main
node_video_state -.->|"requests analysis"| node_main
node_history_ui -.->|"requests history"| node_main
node_local_files -->|"selects videos"| node_main
node_main -->|"resolves sources"| node_source_resolver
node_source_resolver -->|"reads account data"| node_mega
node_source_resolver -->|"lists Drive videos"| node_drive
node_mega_service -->|"authenticates and lists"| node_mega
node_google_drive -->|"authenticates and lists"| node_drive
node_main -->|"creates stream URLs"| node_stream_bridge
node_main -->|"analyzes video"| node_ocr
node_stream_bridge -.->|"serves byte ranges"| node_ocr
node_main -->|"records reads"| node_history
node_main -->|"writes export"| node_excel
node_excel -->|"writes workbook"| node_excel_file
node_main -->|"checks updates"| node_updates
node_updates -->|"gets releases"| node_github

click node_app_ui "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/App.tsx"
click node_source_ui "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/Sources.tsx"
click node_video_table "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/VideoTable.tsx"
click node_video_state "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/useVideos.ts"
click node_history_ui "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/History.tsx"
click node_main "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/main.js"
click node_source_resolver "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/sources.js"
click node_stream_bridge "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/streamBridge.js"
click node_mega "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/megaAccount.js"
click node_drive "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/driveAccount.js"
click node_ocr "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/videoMeta.js"
click node_excel "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/excel.js"
click node_history "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/history.js"
click node_updates "https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/updates.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_app_ui,node_source_ui,node_video_table,node_video_state,node_history_ui,node_user toneBlue
class node_source_resolver,node_stream_bridge toneAmber
class node_ocr,node_excel toneMint
class node_mega,node_drive toneRose
class node_main,node_history,node_updates,node_local_files,node_mega_service,node_google_drive,node_excel_file,node_github toneIndigo
```

## Components

### User interface

- [App workspace](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/App.tsx): `ui/src/App.tsx`
- [Source browser](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/Sources.tsx): `ui/src/Sources.tsx`
- [Video review](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/VideoTable.tsx): `ui/src/VideoTable.tsx`
- [Video queue](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/useVideos.ts): `ui/src/useVideos.ts`
- [History view](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/ui/src/History.tsx): `ui/src/History.tsx`

### Video sources

- [Source resolver](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/sources.js): `src/sources.js`
- [Range stream bridge](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/streamBridge.js): `src/streamBridge.js`

### Analysis and export

- [Video OCR](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/videoMeta.js): `src/videoMeta.js`
- [Excel writer](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/excel.js): `src/excel.js`

### Cloud accounts

- [MEGA account](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/megaAccount.js): `src/megaAccount.js`
- [Drive account](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/driveAccount.js): `src/driveAccount.js`

### Device services

- [Electron controller](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/main.js): `main.js`
- [Local history](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/history.js): `src/history.js`
- [Update service](https://github.com/muhammad-usman-911/stampsheet-electronapp-videotoexcel/blob/main/src/updates.js): `src/updates.js`

### Other components

- **User**
- **Local videos**
- **MEGA**
- **Google Drive**
- **Excel register**
- **GitHub Releases**

## Connections

- User → App workspace: uses (evidence: `README.md`)
- App workspace → Source browser: renders (evidence: `ui/src/App.tsx`)
- App workspace → Video review: renders (evidence: `ui/src/App.tsx`)
- App workspace → Video queue: uses (evidence: `ui/src/App.tsx`)
- App workspace → History view: renders (evidence: `ui/src/App.tsx`)
- Source browser → Electron controller: requests sources
- Video queue → Electron controller: requests analysis
- History view → Electron controller: requests history
- Local videos → Electron controller: selects videos (evidence: `main.js`)
- Electron controller → Source resolver: resolves sources (evidence: `main.js`)
- Source resolver → MEGA account: reads account data (evidence: `src/sources.js`)
- Source resolver → Drive account: lists Drive videos (evidence: `src/sources.js`)
- MEGA → MEGA account: authenticates and lists (evidence: `README.md`)
- Google Drive → Drive account: authenticates and lists (evidence: `README.md`)
- Electron controller → Range stream bridge: creates stream URLs (evidence: `main.js`)
- Electron controller → Video OCR: analyzes video (evidence: `main.js`)
- Range stream bridge → Video OCR: serves byte ranges
- Electron controller → Local history: records reads (evidence: `main.js`)
- Electron controller → Excel writer: writes export (evidence: `main.js`)
- Excel writer → Excel register: writes workbook (evidence: `README.md`)
- Electron controller → Update service: checks updates (evidence: `main.js`)
- Update service → GitHub Releases: gets releases (evidence: `README.md`)
