# wapborhan/live-tv architecture

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

- Interactive diagram: https://gitdiagram.com/wapborhan/live-tv
- Repository: https://github.com/wapborhan/live-tv

## Overview

1. **Project shape**
   - This is a **Next.js App Router** application, but architecturally it behaves like a **single-page, client-heavy media player** rather than a traditional server-rendered site.
   - The repo is organized around one main experience: browsing a channel list and playing live TV streams from an M3U playlist.

2. **Application shell**
   - `app/layout.tsx` defines the top-level document structure and global styling hooks.
   - `app/page.tsx` is the route entry point for the main experience.
   - `app/LiveTVClient.tsx` is the key client-side orchestration layer where most interactive behavior likely lives.

3. **Static content source**
   - `public/MinnatTv.m3u` is the central input artifact in the repo.
   - Because it lives under `public/`, it is served as a static file and can be fetched directly by the browser or app code.
   - This indicates the app’s primary data source is not a remote API, but a bundled playlist file.

4. **Playlist parsing layer**
   - `lib/parseM3U.ts` is the transformation boundary between raw playlist text and app-friendly data.
   - It likely converts M3U entries into structured channel objects used by the UI.
   - This is a clear separation between transport format and domain model.

5. **Shared domain model**
   - `types/channel.ts` defines the channel shape used across parsing, selection, favorites, and rendering.
   - This type boundary is important for keeping the playlist parser, list UI, and player synchronized.

6. **State management boundary**
   - `hooks/useFavourites.ts` suggests local client state for saving preferred channels.
   - Since there is no backend in the tree, favorites are likely managed in browser storage or in-memory state.
   - This makes personalization a purely client-side concern.

7. **UI composition**
   - `components/Header.tsx` provides the top-level navigation/branding area.
   - `components/ChannelList.tsx` renders the selectable channel catalog.
   - `components/VideoPlayer.tsx` is the playback surface for the currently selected stream.
   - `components/LoadModal.tsx` and `components/Toast.tsx` handle transient UI feedback and status messaging.

8. **End-to-end data flow**
   - The browser loads the Next.js page shell.
   - Client code fetches or reads `public/MinnatTv.m3u`.
   - `parseM3U` turns the raw playlist into channel objects.
   - The channel list is rendered, a user selects a channel, and the selected stream is passed to the video player.
   - Favorites and UI feedback are managed alongside selection state in the client.

9. **Client/server boundary**
   - The presence of a dedicated `LiveTVClient.tsx` strongly suggests the interactive experience runs on the client side.
   - The server-side role of Next.js is mainly to deliver the app shell and static assets, not to mediate channel data or playback.

10. **Styling and presentation**
   - `app/globals.css` provides global styling.
   - `postcss.config.mjs` and `next.config.ts` support the build/runtime setup for the Next.js app.
   - The UI is likely styled entirely within the app bundle rather than via a separate design system.

11. **Build and quality pipeline**
   - `.github/workflows/nextjs.yml` shows the repository has CI automation for the Next.js project.
   - This likely verifies install/build/lint behavior on pull requests or pushes, reinforcing that the app is meant to be deployed as a standard Next.js build artifact.

12. **Architecture summary**
   - The repo is a **frontend-only live TV browser/player** with a simple layered structure:
     - static playlist source,
     - parsing/domain conversion,
     - client state and favorites,
     - composed UI for browsing and playback.
   - There are no visible backend services, databases, or external APIs in the tree, so the main architectural boundaries are all within the Next.js client application.

Main entry points: [`app/LiveTVClient.tsx`](https://github.com/wapborhan/live-tv/blob/main/app/LiveTVClient.tsx) (LiveTV client), [`types/channel.ts`](https://github.com/wapborhan/live-tv/blob/main/types/channel.ts) (Channel type), [`app/page.tsx`](https://github.com/wapborhan/live-tv/blob/main/app/page.tsx) (Page entry), [`app/layout.tsx`](https://github.com/wapborhan/live-tv/blob/main/app/layout.tsx) (App layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["App shell"]
  node_n1["Page entry<br/>Next route<br/>[page.tsx]"]
  node_n2["App layout<br/>Next layout<br/>[layout.tsx]"]
  node_n3["Global styles<br/>CSS<br/>[globals.css]"]
end

subgraph group_g2["Client experience"]
  node_n4["LiveTV client<br/>client orchestrator<br/>[LiveTVClient.tsx]"]
  node_n5["Header<br/>UI component<br/>[Header.tsx]"]
  node_n6["Channel list<br/>UI component<br/>[ChannelList.tsx]"]
  node_n7["Video player<br/>UI component<br/>[VideoPlayer.tsx]"]
  node_n8["Load modal<br/>UI feedback<br/>[LoadModal.tsx]"]
  node_n9["Toast<br/>UI feedback<br/>[Toast.tsx]"]
  node_n10["Favorites<br/>client state<br/>[useFavourites.ts]"]
end

subgraph group_g3["Data boundary"]
  node_n11["Playlist file<br/>static M3U<br/>[MinnatTv.m3u]"]
  node_n12["M3U parser<br/>transform<br/>[parseM3U.ts]"]
  node_n13{{"Channel type<br/>domain model<br/>[channel.ts]"}}
end

subgraph group_g4["Build & ops"]
  node_n14["Next config<br/>build config<br/>[next.config.ts]"]
  node_n15["PostCSS config<br/>build config<br/>[postcss.config.mjs]"]
  node_n16["ESLint config<br/>[eslint.config.mjs]"]
  node_n17["CI workflow<br/>GitHub Actions<br/>[nextjs.yml]"]
end

node_n2 -->|"wraps"| node_n1
node_n2 -->|"applies"| node_n3
node_n1 -->|"renders"| node_n4
node_n4 -->|"reads"| node_n11
node_n4 -->|"parses"| node_n12
node_n12 -->|"produces"| node_n13
node_n4 -->|"consumes"| node_n13
node_n4 -->|"tracks"| node_n10
node_n4 -->|"composes"| node_n5
node_n4 -->|"composes"| node_n6
node_n4 -->|"drives"| node_n7
node_n4 -->|"shows"| node_n8
node_n4 -->|"shows"| node_n9
node_n6 -->|"lists"| node_n13
node_n7 -->|"plays"| node_n13
node_n10 -->|"references"| node_n13
node_n14 -->|"configures"| node_n1
node_n15 -->|"supports"| node_n3
node_n16 -->|"checks"| node_n4
node_n17 -->|"uses"| node_n14
node_n17 -->|"verifies"| node_n16

click node_n1 "https://github.com/wapborhan/live-tv/blob/main/app/page.tsx"
click node_n2 "https://github.com/wapborhan/live-tv/blob/main/app/layout.tsx"
click node_n3 "https://github.com/wapborhan/live-tv/blob/main/app/globals.css"
click node_n4 "https://github.com/wapborhan/live-tv/blob/main/app/LiveTVClient.tsx"
click node_n5 "https://github.com/wapborhan/live-tv/blob/main/components/Header.tsx"
click node_n6 "https://github.com/wapborhan/live-tv/blob/main/components/ChannelList.tsx"
click node_n7 "https://github.com/wapborhan/live-tv/blob/main/components/VideoPlayer.tsx"
click node_n8 "https://github.com/wapborhan/live-tv/blob/main/components/LoadModal.tsx"
click node_n9 "https://github.com/wapborhan/live-tv/blob/main/components/Toast.tsx"
click node_n10 "https://github.com/wapborhan/live-tv/blob/main/hooks/useFavourites.ts"
click node_n11 "https://github.com/wapborhan/live-tv/blob/main/public/MinnatTv.m3u"
click node_n12 "https://github.com/wapborhan/live-tv/blob/main/lib/parseM3U.ts"
click node_n13 "https://github.com/wapborhan/live-tv/blob/main/types/channel.ts"
click node_n14 "https://github.com/wapborhan/live-tv/blob/main/next.config.ts"
click node_n15 "https://github.com/wapborhan/live-tv/blob/main/postcss.config.mjs"
click node_n16 "https://github.com/wapborhan/live-tv/blob/main/eslint.config.mjs"
click node_n17 "https://github.com/wapborhan/live-tv/blob/main/.github/workflows/nextjs.yml"

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_n1,node_n2,node_n3 toneBlue
class node_n4,node_n5,node_n6,node_n7,node_n8,node_n9,node_n10 toneAmber
class node_n11,node_n12,node_n13 toneMint
class node_n14,node_n15,node_n16,node_n17 toneRose
```

## Components

### App shell

Next.js entry points and global presentation layer.

- [Page entry](https://github.com/wapborhan/live-tv/blob/main/app/page.tsx): Next route · Route entry point for the main experience. · `app/page.tsx`
- [App layout](https://github.com/wapborhan/live-tv/blob/main/app/layout.tsx): Next layout · Top-level document structure and app shell wiring. · `app/layout.tsx`
- [Global styles](https://github.com/wapborhan/live-tv/blob/main/app/globals.css): CSS · Global styling for the application. · `app/globals.css`

### Client experience

Interactive live TV browsing and playback.

- [LiveTV client](https://github.com/wapborhan/live-tv/blob/main/app/LiveTVClient.tsx): client orchestrator · Main interactive controller for playlist loading, selection, and UI state. · `app/LiveTVClient.tsx`
- [Header](https://github.com/wapborhan/live-tv/blob/main/components/Header.tsx): UI component · Top-level branding and navigation area. · `components/Header.tsx`
- [Channel list](https://github.com/wapborhan/live-tv/blob/main/components/ChannelList.tsx): UI component · Renders the selectable channel catalog. · `components/ChannelList.tsx`
- [Video player](https://github.com/wapborhan/live-tv/blob/main/components/VideoPlayer.tsx): UI component · Playback surface for the selected stream. · `components/VideoPlayer.tsx`
- [Load modal](https://github.com/wapborhan/live-tv/blob/main/components/LoadModal.tsx): UI feedback · Transient loading and status overlay. · `components/LoadModal.tsx`
- [Toast](https://github.com/wapborhan/live-tv/blob/main/components/Toast.tsx): UI feedback · Short-lived user notifications. · `components/Toast.tsx`
- [Favorites](https://github.com/wapborhan/live-tv/blob/main/hooks/useFavourites.ts): client state · Local favorites management for preferred channels. · `hooks/useFavourites.ts`

### Data boundary

Playlist input, parsing, and shared channel model.

- [Playlist file](https://github.com/wapborhan/live-tv/blob/main/public/MinnatTv.m3u): static M3U · Bundled live TV playlist served as a static asset. · `public/MinnatTv.m3u`
- [M3U parser](https://github.com/wapborhan/live-tv/blob/main/lib/parseM3U.ts): transform · Converts raw playlist text into structured channel data. · `lib/parseM3U.ts`
- [Channel type](https://github.com/wapborhan/live-tv/blob/main/types/channel.ts): domain model · Shared channel shape used by parsing, selection, favorites, and rendering. · `types/channel.ts`

### Build & ops

Project configuration and CI automation.

- [Next config](https://github.com/wapborhan/live-tv/blob/main/next.config.ts): build config · Next.js runtime and build configuration. · `next.config.ts`
- [PostCSS config](https://github.com/wapborhan/live-tv/blob/main/postcss.config.mjs): build config · PostCSS pipeline configuration for styling. · `postcss.config.mjs`
- [ESLint config](https://github.com/wapborhan/live-tv/blob/main/eslint.config.mjs): lint config · Repository linting rules and setup. · `eslint.config.mjs`
- [CI workflow](https://github.com/wapborhan/live-tv/blob/main/.github/workflows/nextjs.yml): GitHub Actions · Automation for install, build, and validation. · `.github/workflows/nextjs.yml`

## Connections

- App layout → Page entry: wraps · Layout provides the page shell.
- App layout → Global styles: applies · Global styles are loaded through the app shell.
- Page entry → LiveTV client: renders · The route entry mounts the client experience.
- LiveTV client → Playlist file: reads · Client loads the bundled playlist source.
- LiveTV client → M3U parser: parses · Raw playlist text is transformed into channel objects.
- M3U parser → Channel type: produces · Parser outputs the shared channel domain model.
- LiveTV client → Channel type: consumes · Client orchestration works with channel objects.
- LiveTV client → Favorites: tracks · Favorites are managed as client-side state.
- LiveTV client → Header: composes · Header is part of the main experience shell.
- LiveTV client → Channel list: composes · Channel list is rendered by the client controller.
- LiveTV client → Video player: drives · Selected channel is passed to the player.
- LiveTV client → Load modal: shows · Loading state is surfaced through modal feedback.
- LiveTV client → Toast: shows · User notifications are surfaced through toast feedback.
- Channel list → Channel type: lists · Channel list is built from the shared channel model.
- Video player → Channel type: plays · Player consumes selected channel metadata/stream info.
- Favorites → Channel type: references · Favorites are keyed by channel data.
- Next config → Page entry: configures · Next build/runtime settings affect the app entry.
- PostCSS config → Global styles: supports · PostCSS supports the styling pipeline.
- ESLint config → LiveTV client: checks · Linting applies to the client orchestration layer.
- CI workflow → Next config: uses · CI runs the Next.js project configuration.
- CI workflow → ESLint config: verifies · CI validates lint rules as part of automation.
