# kirasync2748/kiraiptv architecture

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

- Interactive diagram: https://gitdiagram.com/kirasync2748/kiraiptv
- Repository: https://github.com/kirasync2748/kiraiptv

## Overview

KiraIPTV is an anonymous browser-based IPTV directory and player. The main journey is browsing and filtering a channel catalog, selecting a channel, and playing its stream with mirror failover; users can also verify channels and manage their viewing order. Catalog data is maintained by a separate collection workflow. The graph preserves documented proxying, presence, and PWA capabilities, but some route and client wiring is not shown in the excerpts, so those links are omitted or marked unverified.

Main entry points: [`components/KiraIptvApp.tsx`](https://github.com/kirasync2748/kiraiptv/blob/main/components/KiraIptvApp.tsx) (Channel browser), [`lib/channels-server.ts`](https://github.com/kirasync2748/kiraiptv/blob/main/lib/channels-server.ts) (Catalog loader), [`channels/collect_channels.py`](https://github.com/kirasync2748/kiraiptv/blob/main/channels/collect_channels.py) (Channel collector), [`app/page.tsx`](https://github.com/kirasync2748/kiraiptv/blob/main/app/page.tsx) (Live TV entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog pipeline"]
  node_catalog_runtime["Catalog loader<br/>[channels-server.ts]"]
  node_catalog_data[("Channel index")]
  node_channel_logic["Filtering and health<br/>[channel-logic.ts]"]
  node_collector["Channel collector"]
  node_seeds["Curated seed sources<br/>[seed_sources.json]"]
end

subgraph group_web["Web experience"]
  node_home["Live TV entry<br/>[page.tsx]"]
  node_app["Channel browser<br/>[KiraIptvApp.tsx]"]
  node_ordering["Saved channel order"]
  node_channel_card["Channel cards<br/>[ChannelCard.tsx]"]
  node_channel_icon["Channel identity<br/>[ChannelIcon.tsx]"]
  node_verify_ui["Verification panel<br/>[VerifyModal.tsx]"]
  node_service_worker["Offline app support<br/>[sw.js]"]
  node_worker_registrar["Service worker setup"]
end

subgraph group_playback["Playback services"]
  node_player["Video player<br/>[VideoPlayer.tsx]"]
  node_proxy_api["Stream proxy<br/>[route.ts]"]
end

subgraph group_operations["Live operations"]
  node_verify_api["Stream verification<br/>[route.ts]"]
  node_presence_api["Viewer presence<br/>[route.ts]"]
end

node_viewer(("Viewer"))
node_upstream["Public playlists"]

node_viewer -->|"opens"| node_home
node_home -->|"loads catalog"| node_catalog_runtime
node_home -->|"renders"| node_app
node_catalog_runtime -->|"loads index"| node_catalog_data
node_catalog_runtime -->|"deduplicates"| node_channel_logic
node_app -->|"filters channels"| node_channel_logic
node_app -->|"manages order"| node_ordering
node_app -->|"renders cards"| node_channel_card
node_channel_card -->|"renders identity"| node_channel_icon
node_app -->|"renders playback"| node_player
node_player -->|"selects mirrors"| node_channel_logic
node_player -.->|"may relay streams"| node_proxy_api
node_app -->|"opens verification"| node_verify_ui
node_verify_api -->|"loads channels"| node_catalog_runtime
node_app -->|"sends heartbeat"| node_presence_api
node_worker_registrar -->|"registers worker"| node_service_worker
node_collector -->|"reads seeds"| node_seeds
node_upstream -.->|"provides playlists"| node_collector
node_collector -->|"rebuilds index"| node_catalog_data

click node_home "https://github.com/kirasync2748/kiraiptv/blob/main/app/page.tsx"
click node_app "https://github.com/kirasync2748/kiraiptv/blob/main/components/KiraIptvApp.tsx"
click node_catalog_runtime "https://github.com/kirasync2748/kiraiptv/blob/main/lib/channels-server.ts"
click node_catalog_data "https://github.com/kirasync2748/kiraiptv/blob/main/channels/channels_index.json"
click node_channel_logic "https://github.com/kirasync2748/kiraiptv/blob/main/lib/channel-logic.ts"
click node_ordering "https://github.com/kirasync2748/kiraiptv/blob/main/lib/use-channel-order.ts"
click node_channel_card "https://github.com/kirasync2748/kiraiptv/blob/main/components/ChannelCard.tsx"
click node_channel_icon "https://github.com/kirasync2748/kiraiptv/blob/main/components/ChannelIcon.tsx"
click node_player "https://github.com/kirasync2748/kiraiptv/blob/main/components/VideoPlayer.tsx"
click node_verify_ui "https://github.com/kirasync2748/kiraiptv/blob/main/components/VerifyModal.tsx"
click node_verify_api "https://github.com/kirasync2748/kiraiptv/blob/main/app/api/verify/route.ts"
click node_presence_api "https://github.com/kirasync2748/kiraiptv/blob/main/app/api/presence/route.ts"
click node_proxy_api "https://github.com/kirasync2748/kiraiptv/blob/main/app/api/stream-proxy/route.ts"
click node_service_worker "https://github.com/kirasync2748/kiraiptv/blob/main/public/sw.js"
click node_worker_registrar "https://github.com/kirasync2748/kiraiptv/blob/main/components/ServiceWorkerRegistrar.tsx"
click node_collector "https://github.com/kirasync2748/kiraiptv/blob/main/channels/collect_channels.py"
click node_seeds "https://github.com/kirasync2748/kiraiptv/blob/main/channels/seed_sources.json"

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_catalog_runtime,node_catalog_data,node_channel_logic,node_collector,node_seeds,node_viewer toneBlue
class node_home,node_app,node_ordering,node_channel_card,node_channel_icon,node_verify_ui,node_service_worker,node_worker_registrar toneAmber
class node_player,node_proxy_api toneMint
class node_verify_api,node_presence_api toneRose
class node_upstream toneIndigo
```

## Components

### Catalog pipeline

- [Catalog loader](https://github.com/kirasync2748/kiraiptv/blob/main/lib/channels-server.ts): `lib/channels-server.ts`
- [Channel index](https://github.com/kirasync2748/kiraiptv/blob/main/channels/channels_index.json): `channels/channels_index.json`
- [Filtering and health](https://github.com/kirasync2748/kiraiptv/blob/main/lib/channel-logic.ts): `lib/channel-logic.ts`
- [Channel collector](https://github.com/kirasync2748/kiraiptv/blob/main/channels/collect_channels.py): `channels/collect_channels.py`
- [Curated seed sources](https://github.com/kirasync2748/kiraiptv/blob/main/channels/seed_sources.json): `channels/seed_sources.json`

### Web experience

- [Live TV entry](https://github.com/kirasync2748/kiraiptv/blob/main/app/page.tsx): `app/page.tsx`
- [Channel browser](https://github.com/kirasync2748/kiraiptv/blob/main/components/KiraIptvApp.tsx): `components/KiraIptvApp.tsx`
- [Saved channel order](https://github.com/kirasync2748/kiraiptv/blob/main/lib/use-channel-order.ts): `lib/use-channel-order.ts`
- [Channel cards](https://github.com/kirasync2748/kiraiptv/blob/main/components/ChannelCard.tsx): `components/ChannelCard.tsx`
- [Channel identity](https://github.com/kirasync2748/kiraiptv/blob/main/components/ChannelIcon.tsx): `components/ChannelIcon.tsx`
- [Verification panel](https://github.com/kirasync2748/kiraiptv/blob/main/components/VerifyModal.tsx): `components/VerifyModal.tsx`
- [Offline app support](https://github.com/kirasync2748/kiraiptv/blob/main/public/sw.js): `public/sw.js`
- [Service worker setup](https://github.com/kirasync2748/kiraiptv/blob/main/components/ServiceWorkerRegistrar.tsx): `components/ServiceWorkerRegistrar.tsx`

### Playback services

- [Video player](https://github.com/kirasync2748/kiraiptv/blob/main/components/VideoPlayer.tsx): `components/VideoPlayer.tsx`
- [Stream proxy](https://github.com/kirasync2748/kiraiptv/blob/main/app/api/stream-proxy/route.ts): `app/api/stream-proxy/route.ts`

### Live operations

- [Stream verification](https://github.com/kirasync2748/kiraiptv/blob/main/app/api/verify/route.ts): `app/api/verify/route.ts`
- [Viewer presence](https://github.com/kirasync2748/kiraiptv/blob/main/app/api/presence/route.ts): `app/api/presence/route.ts`

### Other components

- **Viewer**
- **Public playlists**

## Connections

- Viewer → Live TV entry: opens (evidence: `README.md`)
- Live TV entry → Catalog loader: loads catalog (evidence: `app/page.tsx`)
- Live TV entry → Channel browser: renders (evidence: `app/page.tsx`)
- Catalog loader → Channel index: loads index (evidence: `lib/channels-server.ts`)
- Catalog loader → Filtering and health: deduplicates (evidence: `lib/channels-server.ts`)
- Channel browser → Filtering and health: filters channels (evidence: `components/KiraIptvApp.tsx`)
- Channel browser → Saved channel order: manages order (evidence: `components/KiraIptvApp.tsx`)
- Channel browser → Channel cards: renders cards (evidence: `components/KiraIptvApp.tsx`)
- Channel cards → Channel identity: renders identity (evidence: `components/ChannelCard.tsx`)
- Channel browser → Video player: renders playback (evidence: `components/KiraIptvApp.tsx`)
- Video player → Filtering and health: selects mirrors (evidence: `components/VideoPlayer.tsx`)
- Video player → Stream proxy: may relay streams
- Channel browser → Verification panel: opens verification (evidence: `components/KiraIptvApp.tsx`)
- Stream verification → Catalog loader: loads channels (evidence: `app/api/verify/route.ts`)
- Channel browser → Viewer presence: sends heartbeat (evidence: `components/KiraIptvApp.tsx`)
- Service worker setup → Offline app support: registers worker (evidence: `components/ServiceWorkerRegistrar.tsx`)
- Channel collector → Curated seed sources: reads seeds (evidence: `channels/collect_channels.py`)
- Public playlists → Channel collector: provides playlists (evidence: `README.md`)
- Channel collector → Channel index: rebuilds index (evidence: `README.md`)
