# f-e-n-y-x/jiotv-androidtv- architecture

> Architecture diagram of the GitHub repository f-e-n-y-x/jiotv-androidtv-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/f-e-n-y-x/jiotv-androidtv-
- Repository: https://github.com/f-e-n-y-x/jiotv-androidtv-

## Overview

JTV is an Android live-TV app for Android TV, phones, and tablets, with an optional companion server and web player. The main journey is sign-in or server setup, browse/search the channel lineup and guide, then play live or replay content; settings, favorites, and device sync support that journey. The graph preserves the documented playback, guide, search, remote-control, and cross-device capabilities. Some Android UI and server subsystems were not sampled, so their internal links are omitted or marked unverified rather than inferred.

Main entry points: [`server/src/api/routes.ts`](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/api/routes.ts) (Account routes), [`server/src/refresh.ts`](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/refresh.ts) (Token refresh), [`android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt`](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt) (Jio API client), [`server/src/server.ts`](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/server.ts) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_android["Android app"]
  node_activity["App entry<br/>[MainActivity.kt]"]
  node_navigation["App navigation<br/>[Navigation.kt]"]
  node_home["Home and channels<br/>[MainScreen.kt]"]
  node_viewmodel["Channel state<br/>[MainViewModel.kt]"]
  node_search["Channel search<br/>[SearchScreen.kt]"]
  node_jioapi["Jio API client<br/>[JioApiClient.kt]"]
  node_zeedata["Zee channels<br/>[ZeeRepository.kt]"]
  node_settings[("Preferences<br/>[SettingsManager.kt]")]
  node_sync["LAN device sync<br/>[SyncClient.kt]"]
end

subgraph group_playback["Playback and guide"]
  node_guide["Program guide<br/>[GuideScreen.kt]"]
  node_playerui["Player interface<br/>[TvPlayerScreen.kt]"]
  node_player["Player engine"]
  node_catchup["Replay data<br/>[Catchup.kt]"]
end

subgraph group_server["Companion server"]
  node_serverentry["HTTP server<br/>[server.ts]"]
  node_routes["Account routes<br/>[routes.ts]"]
  node_auth["Jio sign-in<br/>[auth.ts]"]
  node_refresh["Token refresh<br/>[refresh.ts]"]
  node_db[("Server data store<br/>[db.ts]")]
  node_streamproxy["Stream proxy<br/>[streamProxy.ts]"]
  node_playlist["Playlist API<br/>[playlist.ts]"]
end

subgraph group_web["Web player"]
  node_webapp["Web app routes<br/>[App.tsx]"]
  node_webapi["Web API client<br/>[api.ts]"]
  node_webguide["Web guide<br/>[Guide.tsx]"]
  node_webplayer["Web playback<br/>[Player.tsx]"]
end

node_viewer(("Viewer"))
node_jio{{"Jio services"}}

node_viewer -->|"opens"| node_activity
node_activity -->|"reads settings"| node_settings
node_activity -.->|"starts app"| node_navigation
node_home -.->|"uses state"| node_viewmodel
node_search -->|"uses channel state"| node_viewmodel
node_viewer -->|"browses listings"| node_guide
node_viewer -->|"searches channels"| node_search
node_viewer -->|"chooses channel"| node_playerui
node_playerui -.->|"plays stream"| node_player
node_playerui -.->|"requests replay"| node_catchup
node_jioapi -.->|"requests data"| node_jio
node_jioapi -->|"uses channel sources"| node_zeedata
node_jioapi -->|"reads preferences"| node_settings
node_viewer -->|"pairs devices"| node_sync
node_serverentry -->|"registers routes"| node_routes
node_serverentry -->|"registers routes"| node_playlist
node_serverentry -->|"starts scheduler"| node_refresh
node_routes -->|"sends OTP"| node_auth
node_routes -->|"manages credentials"| node_db
node_routes -->|"requests refresh"| node_refresh
node_auth -->|"verifies sign-in"| node_jio
node_refresh -->|"updates tokens"| node_db
node_refresh -->|"refreshes tokens"| node_jio
node_streamproxy -->|"resolves streams"| node_jio
node_viewer -->|"opens web player"| node_webapp
node_webapp -->|"routes to guide"| node_webguide
node_webapp -->|"routes to player"| node_webplayer
node_webguide -->|"loads guide data"| node_webapi
node_webplayer -->|"requests playback"| node_webapi

click node_activity "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/MainActivity.kt"
click node_navigation "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/Navigation.kt"
click node_home "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/main/MainScreen.kt"
click node_viewmodel "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/main/MainViewModel.kt"
click node_search "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/search/SearchScreen.kt"
click node_guide "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/guide/GuideScreen.kt"
click node_playerui "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/player/TvPlayerScreen.kt"
click node_player "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/player/JioExoPlayerFactory.kt"
click node_catchup "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/Catchup.kt"
click node_jioapi "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt"
click node_zeedata "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/ZeeRepository.kt"
click node_settings "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/SettingsManager.kt"
click node_sync "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/sync/SyncClient.kt"
click node_serverentry "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/server.ts"
click node_routes "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/api/routes.ts"
click node_auth "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/jio/auth.ts"
click node_refresh "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/refresh.ts"
click node_db "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/store/db.ts"
click node_streamproxy "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/proxy/streamProxy.ts"
click node_playlist "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/api/playlist.ts"
click node_webapp "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/App.tsx"
click node_webapi "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/api.ts"
click node_webguide "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/Guide.tsx"
click node_webplayer "https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/Player.tsx"

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_activity,node_navigation,node_home,node_viewmodel,node_search,node_jioapi,node_zeedata,node_settings,node_sync,node_viewer toneBlue
class node_guide,node_playerui,node_player,node_catchup toneAmber
class node_serverentry,node_routes,node_auth,node_refresh,node_db,node_streamproxy,node_playlist toneMint
class node_webapp,node_webapi,node_webguide,node_webplayer toneRose
class node_jio toneIndigo
```

## Components

### Android app

- [App entry](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/MainActivity.kt): `android/app/src/main/java/com/fenyx/jtv/MainActivity.kt`
- [App navigation](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/Navigation.kt): `android/app/src/main/java/com/fenyx/jtv/Navigation.kt`
- [Home and channels](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/main/MainScreen.kt): `android/app/src/main/java/com/fenyx/jtv/ui/main/MainScreen.kt`
- [Channel state](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/main/MainViewModel.kt): `android/app/src/main/java/com/fenyx/jtv/ui/main/MainViewModel.kt`
- [Channel search](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/search/SearchScreen.kt): `android/app/src/main/java/com/fenyx/jtv/ui/search/SearchScreen.kt`
- [Jio API client](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt): `android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt`
- [Zee channels](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/ZeeRepository.kt): `android/app/src/main/java/com/fenyx/jtv/data/ZeeRepository.kt`
- [Preferences](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/SettingsManager.kt): `android/app/src/main/java/com/fenyx/jtv/data/SettingsManager.kt`
- [LAN device sync](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/sync/SyncClient.kt): `android/app/src/main/java/com/fenyx/jtv/sync/SyncClient.kt`

### Playback and guide

- [Program guide](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/guide/GuideScreen.kt): `android/app/src/main/java/com/fenyx/jtv/ui/guide/GuideScreen.kt`
- [Player interface](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/ui/player/TvPlayerScreen.kt): `android/app/src/main/java/com/fenyx/jtv/ui/player/TvPlayerScreen.kt`
- [Player engine](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/player/JioExoPlayerFactory.kt): `android/app/src/main/java/com/fenyx/jtv/player/JioExoPlayerFactory.kt`
- [Replay data](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/android/app/src/main/java/com/fenyx/jtv/data/Catchup.kt): `android/app/src/main/java/com/fenyx/jtv/data/Catchup.kt`

### Companion server

- [HTTP server](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/server.ts): `server/src/server.ts`
- [Account routes](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/api/routes.ts): `server/src/api/routes.ts`
- [Jio sign-in](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/jio/auth.ts): `server/src/jio/auth.ts`
- [Token refresh](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/refresh.ts): `server/src/refresh.ts`
- [Server data store](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/store/db.ts): `server/src/store/db.ts`
- [Stream proxy](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/proxy/streamProxy.ts): `server/src/proxy/streamProxy.ts`
- [Playlist API](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/src/api/playlist.ts): `server/src/api/playlist.ts`

### Web player

- [Web app routes](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/App.tsx): `server/web/src/App.tsx`
- [Web API client](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/api.ts): `server/web/src/api.ts`
- [Web guide](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/Guide.tsx): `server/web/src/Guide.tsx`
- [Web playback](https://github.com/f-e-n-y-x/jiotv-androidtv-/blob/main/server/web/src/Player.tsx): `server/web/src/Player.tsx`

### Other components

- **Viewer**
- **Jio services**

## Connections

- Viewer → App entry: opens
- App entry → Preferences: reads settings (evidence: `android/app/src/main/java/com/fenyx/jtv/MainActivity.kt`)
- App entry → App navigation: starts app
- Home and channels → Channel state: uses state
- Channel search → Channel state: uses channel state (evidence: `android/app/src/main/java/com/fenyx/jtv/ui/search/SearchScreen.kt`)
- Viewer → Program guide: browses listings
- Viewer → Channel search: searches channels
- Viewer → Player interface: chooses channel
- Player interface → Player engine: plays stream
- Player interface → Replay data: requests replay
- Jio API client → Jio services: requests data
- Jio API client → Zee channels: uses channel sources (evidence: `android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt`)
- Jio API client → Preferences: reads preferences (evidence: `android/app/src/main/java/com/fenyx/jtv/data/JioApiClient.kt`)
- Viewer → LAN device sync: pairs devices
- HTTP server → Account routes: registers routes (evidence: `server/src/server.ts`)
- HTTP server → Playlist API: registers routes (evidence: `server/src/server.ts`)
- HTTP server → Token refresh: starts scheduler (evidence: `server/src/server.ts`)
- Account routes → Jio sign-in: sends OTP (evidence: `server/src/api/routes.ts`)
- Account routes → Server data store: manages credentials (evidence: `server/src/api/routes.ts`)
- Account routes → Token refresh: requests refresh (evidence: `server/src/api/routes.ts`)
- Jio sign-in → Jio services: verifies sign-in (evidence: `server/src/jio/auth.ts`)
- Token refresh → Server data store: updates tokens (evidence: `server/src/refresh.ts`)
- Token refresh → Jio services: refreshes tokens (evidence: `server/src/refresh.ts`)
- Stream proxy → Jio services: resolves streams (evidence: `server/src/proxy/streamProxy.ts`)
- Viewer → Web app routes: opens web player
- Web app routes → Web guide: routes to guide (evidence: `server/web/src/App.tsx`)
- Web app routes → Web playback: routes to player (evidence: `server/web/src/App.tsx`)
- Web guide → Web API client: loads guide data (evidence: `server/web/src/Guide.tsx`)
- Web playback → Web API client: requests playback (evidence: `server/web/src/Player.tsx`)
