# harleythetech/iptv-scanner architecture

> Architecture diagram of the GitHub repository harleythetech/iptv-scanner, 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/harleythetech/iptv-scanner
- Repository: https://github.com/harleythetech/iptv-scanner

## Overview

iPTV-Scanner loads local or remote M3U playlists, parses their entries, probes stream endpoints, and presents and exports diagnostic results. In server mode, the browser can delegate playlist loading and scans to the Node API; browser mode probes directly. The README documents deeper HLS validation, retries, bounded reads, filtering, exports, and security behavior, though not every implementation detail was excerpted. `src/runtime.js` appears to be a separate browser scanner implementation; its relationship to the current UI is not established by the available evidence.

Main entry points: [`server.js`](https://github.com/harleythetech/iptv-scanner/blob/main/server.js) (HTTP API and static server), [`app.js`](https://github.com/harleythetech/iptv-scanner/blob/main/app.js) (Scanner interface), [`src/scanner.js`](https://github.com/harleythetech/iptv-scanner/blob/main/src/scanner.js) (HTTP and HLS probing), [`src/security.js`](https://github.com/harleythetech/iptv-scanner/blob/main/src/security.js) (Target validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webapp["Scanner interface<br/>[app.js]"]
  node_legacy["Standalone scanner runtime<br/>[runtime.js]"]
end

subgraph group_service["Server API"]
  node_nodeapi["HTTP API and static server<br/>[server.js]"]
  node_targetsecurity["Target validation<br/>[security.js]"]
end

subgraph group_playlist["Playlist handling"]
  node_playlistparser["M3U parser<br/>[m3u.js]"]
  node_exports["M3U and CSV exports<br/>[m3u.js]"]
end

subgraph group_probe["Stream probing"]
  node_scanorchestrator["Scan orchestration<br/>[scanner.js]"]
  node_endpointprobe["HTTP and HLS probing<br/>[scanner.js]"]
end

node_user(("Playlist user"))
node_streamendpoint(("Stream endpoints"))

node_user -->|"loads playlist"| node_webapp
node_webapp -->|"parses entries"| node_playlistparser
node_webapp -->|"scans entries"| node_scanorchestrator
node_webapp -->|"requests server mode"| node_nodeapi
node_nodeapi -->|"parses remote playlist"| node_playlistparser
node_nodeapi -->|"runs scan"| node_scanorchestrator
node_nodeapi -->|"validates playlist targets"| node_targetsecurity
node_scanorchestrator -->|"dispatches probes"| node_endpointprobe
node_endpointprobe -->|"guards redirects"| node_targetsecurity
node_endpointprobe -->|"probes HTTP"| node_streamendpoint
node_webapp -->|"builds exports"| node_exports
node_nodeapi -->|"builds scan exports"| node_exports
node_nodeapi -->|"serves static files"| node_webapp

click node_webapp "https://github.com/harleythetech/iptv-scanner/blob/main/app.js"
click node_legacy "https://github.com/harleythetech/iptv-scanner/blob/main/src/runtime.js"
click node_nodeapi "https://github.com/harleythetech/iptv-scanner/blob/main/server.js"
click node_playlistparser "https://github.com/harleythetech/iptv-scanner/blob/main/src/m3u.js"
click node_exports "https://github.com/harleythetech/iptv-scanner/blob/main/src/m3u.js"
click node_scanorchestrator "https://github.com/harleythetech/iptv-scanner/blob/main/src/scanner.js"
click node_endpointprobe "https://github.com/harleythetech/iptv-scanner/blob/main/src/scanner.js"
click node_targetsecurity "https://github.com/harleythetech/iptv-scanner/blob/main/src/security.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_webapp,node_legacy,node_user toneBlue
class node_nodeapi,node_targetsecurity toneAmber
class node_playlistparser,node_exports toneMint
class node_scanorchestrator,node_endpointprobe toneRose
class node_streamendpoint toneIndigo
```

## Components

### User interface

- [Scanner interface](https://github.com/harleythetech/iptv-scanner/blob/main/app.js): `app.js`
- [Standalone scanner runtime](https://github.com/harleythetech/iptv-scanner/blob/main/src/runtime.js): `src/runtime.js`

### Server API

- [HTTP API and static server](https://github.com/harleythetech/iptv-scanner/blob/main/server.js): `server.js`
- [Target validation](https://github.com/harleythetech/iptv-scanner/blob/main/src/security.js): `src/security.js`

### Playlist handling

- [M3U parser](https://github.com/harleythetech/iptv-scanner/blob/main/src/m3u.js): `src/m3u.js`
- [M3U and CSV exports](https://github.com/harleythetech/iptv-scanner/blob/main/src/m3u.js): `src/m3u.js`

### Stream probing

- [Scan orchestration](https://github.com/harleythetech/iptv-scanner/blob/main/src/scanner.js): `src/scanner.js`
- [HTTP and HLS probing](https://github.com/harleythetech/iptv-scanner/blob/main/src/scanner.js): `src/scanner.js`

### Other components

- **Playlist user**
- **Stream endpoints**

## Connections

- Playlist user → Scanner interface: loads playlist (evidence: `README.md`)
- Scanner interface → M3U parser: parses entries (evidence: `app.js`)
- Scanner interface → Scan orchestration: scans entries (evidence: `app.js`)
- Scanner interface → HTTP API and static server: requests server mode (evidence: `app.js`)
- HTTP API and static server → M3U parser: parses remote playlist (evidence: `server.js`)
- HTTP API and static server → Scan orchestration: runs scan (evidence: `server.js`)
- HTTP API and static server → Target validation: validates playlist targets (evidence: `server.js`)
- Scan orchestration → HTTP and HLS probing: dispatches probes (evidence: `src/scanner.js`)
- HTTP and HLS probing → Target validation: guards redirects (evidence: `server.js`)
- HTTP and HLS probing → Stream endpoints: probes HTTP (evidence: `README.md`)
- Scanner interface → M3U and CSV exports: builds exports (evidence: `app.js`)
- HTTP API and static server → M3U and CSV exports: builds scan exports (evidence: `server.js`)
- HTTP API and static server → Scanner interface: serves static files (evidence: `server.js`)
