# jiotv-go/jiotv_go architecture

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

- Interactive diagram: https://gitdiagram.com/jiotv-go/jiotv_go
- Repository: https://github.com/jiotv-go/jiotv_go

## Overview

JioTV Go is a Go server and web wrapper for JioTV: users authenticate, browse channels or EPG, then play live, catch-up, or premium streams through web and IPTV-facing routes. The graph includes the CLI/server entry, distinct playback and guide stages, and the television API, credential store, URL handling, and scheduler beneath them. The README documents M3U, quality selection, and background operation; sampled excerpts do not show every route’s internal calls, so uncertain links are omitted or dashed.

Main entry points: [`cmd/jiotv_go.go`](https://github.com/jiotv-go/jiotv_go/blob/develop/cmd/jiotv_go.go) (HTTP Server), [`pkg/television/television.go`](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/television/television.go) (JioTV API Client), [`internal/handlers/auth.go`](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/auth.go) (Login and Tokens), [`pkg/epg/epg.go`](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/epg/epg.go) (Guide Generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Server and CLI"]
  node_cli["CLI Commands<br/>[main.go]"]
  node_server["HTTP Server<br/>[jiotv_go.go]"]
end

subgraph group_handlers["HTTP Workflows"]
  node_auth["Login and Tokens<br/>[auth.go]"]
  node_channels["Channel and Play Routes<br/>[handlers.go]"]
  node_catchup["Catch-up Playback<br/>[catchup.go]"]
  node_drm["DASH and DRM<br/>[drm.go]"]
  node_epghttp["EPG Routes<br/>[epg.go]"]
  node_middleware["CORS Middleware<br/>[cors.go]"]
end

subgraph group_services["Domain Services"]
  node_television["JioTV API Client<br/>[television.go]"]
  node_epg["Guide Generation<br/>[epg.go]"]
  node_scheduler["Task Scheduler<br/>[scheduler.go]"]
  node_store[("Credential Store<br/>[store.go]")]
  node_secureurl["URL Encryption<br/>[secureurl.go]"]
  node_httputils["HTTP Utilities<br/>[handlers.go]"]
  node_config["Configuration<br/>[config.go]"]
end

subgraph group_clients["Web Client"]
  node_webapp["Web Interface"]
end

node_user(("Viewer / Operator"))
node_jio["JioTV Service"]
node_guidefile["EPG Output File"]

node_user -->|"runs commands"| node_cli
node_cli -.->|"starts server"| node_server
node_server -->|"routes requests"| node_auth
node_server -->|"routes requests"| node_channels
node_server -->|"routes requests"| node_catchup
node_server -->|"routes requests"| node_drm
node_server -->|"routes requests"| node_epghttp
node_server -->|"installs middleware"| node_middleware
node_user -->|"watches streams"| node_webapp
node_webapp -.->|"requests pages"| node_server
node_auth -->|"initializes client"| node_television
node_auth -.->|"persists credentials"| node_store
node_auth -->|"requests OTP"| node_jio
node_channels -->|"fetches streams"| node_television
node_channels -->|"decrypts URLs"| node_secureurl
node_catchup -->|"fetches playback"| node_television
node_catchup -->|"decrypts URLs"| node_secureurl
node_drm -->|"fetches manifests"| node_television
node_drm -->|"decrypts URLs"| node_secureurl
node_epghttp -->|"serves guide data"| node_epg
node_epg -->|"fetches schedules"| node_jio
node_epg -->|"schedules generation"| node_scheduler
node_epg -->|"writes guide"| node_guidefile
node_television -->|"uses persistence"| node_store
node_store -->|"reads path settings"| node_config
node_httputils -->|"decrypts parameters"| node_secureurl
node_server -.->|"loads settings"| node_config

click node_cli "https://github.com/jiotv-go/jiotv_go/blob/develop/main.go"
click node_server "https://github.com/jiotv-go/jiotv_go/blob/develop/cmd/jiotv_go.go"
click node_webapp "https://github.com/jiotv-go/jiotv_go/tree/develop/web/static/internal"
click node_auth "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/auth.go"
click node_channels "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/handlers.go"
click node_catchup "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/catchup.go"
click node_drm "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/drm.go"
click node_epghttp "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/epg.go"
click node_middleware "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/middleware/cors.go"
click node_television "https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/television/television.go"
click node_epg "https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/epg/epg.go"
click node_scheduler "https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/scheduler/scheduler.go"
click node_store "https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/store/store.go"
click node_secureurl "https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/secureurl/secureurl.go"
click node_httputils "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/utils/handlers.go"
click node_config "https://github.com/jiotv-go/jiotv_go/blob/develop/internal/config/config.go"

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_cli,node_server,node_user toneBlue
class node_auth,node_channels,node_catchup,node_drm,node_epghttp,node_middleware toneAmber
class node_television,node_epg,node_scheduler,node_store,node_secureurl,node_httputils,node_config toneMint
class node_webapp toneRose
class node_jio,node_guidefile toneIndigo
```

## Components

### Server and CLI

- [CLI Commands](https://github.com/jiotv-go/jiotv_go/blob/develop/main.go): `main.go`
- [HTTP Server](https://github.com/jiotv-go/jiotv_go/blob/develop/cmd/jiotv_go.go): `cmd/jiotv_go.go`

### HTTP Workflows

- [Login and Tokens](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/auth.go): `internal/handlers/auth.go`
- [Channel and Play Routes](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/handlers.go): `internal/handlers/handlers.go`
- [Catch-up Playback](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/catchup.go): `internal/handlers/catchup.go`
- [DASH and DRM](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/drm.go): `internal/handlers/drm.go`
- [EPG Routes](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/handlers/epg.go): `internal/handlers/epg.go`
- [CORS Middleware](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/middleware/cors.go): `internal/middleware/cors.go`

### Domain Services

- [JioTV API Client](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/television/television.go): `pkg/television/television.go`
- [Guide Generation](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/epg/epg.go): `pkg/epg/epg.go`
- [Task Scheduler](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/scheduler/scheduler.go): `pkg/scheduler/scheduler.go`
- [Credential Store](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/store/store.go): `pkg/store/store.go`
- [URL Encryption](https://github.com/jiotv-go/jiotv_go/blob/develop/pkg/secureurl/secureurl.go): `pkg/secureurl/secureurl.go`
- [HTTP Utilities](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/utils/handlers.go): `internal/utils/handlers.go`
- [Configuration](https://github.com/jiotv-go/jiotv_go/blob/develop/internal/config/config.go): `internal/config/config.go`

### Web Client

- [Web Interface](https://github.com/jiotv-go/jiotv_go/tree/develop/web/static/internal): `web/static/internal`

### Other components

- **Viewer / Operator**
- **JioTV Service**
- **EPG Output File**

## Connections

- Viewer / Operator → CLI Commands: runs commands (evidence: `main.go`)
- CLI Commands → HTTP Server: starts server
- HTTP Server → Login and Tokens: routes requests (evidence: `cmd/jiotv_go.go`)
- HTTP Server → Channel and Play Routes: routes requests (evidence: `cmd/jiotv_go.go`)
- HTTP Server → Catch-up Playback: routes requests (evidence: `cmd/jiotv_go.go`)
- HTTP Server → DASH and DRM: routes requests (evidence: `cmd/jiotv_go.go`)
- HTTP Server → EPG Routes: routes requests (evidence: `cmd/jiotv_go.go`)
- HTTP Server → CORS Middleware: installs middleware (evidence: `cmd/jiotv_go.go`)
- Viewer / Operator → Web Interface: watches streams (evidence: `README.md`)
- Web Interface → HTTP Server: requests pages
- Login and Tokens → JioTV API Client: initializes client (evidence: `internal/handlers/auth.go`)
- Login and Tokens → Credential Store: persists credentials
- Login and Tokens → JioTV Service: requests OTP (evidence: `internal/handlers/auth.go`)
- Channel and Play Routes → JioTV API Client: fetches streams (evidence: `internal/handlers/handlers.go`)
- Channel and Play Routes → URL Encryption: decrypts URLs (evidence: `internal/handlers/handlers.go`)
- Catch-up Playback → JioTV API Client: fetches playback (evidence: `internal/handlers/catchup.go`)
- Catch-up Playback → URL Encryption: decrypts URLs (evidence: `internal/handlers/catchup.go`)
- DASH and DRM → JioTV API Client: fetches manifests (evidence: `internal/handlers/drm.go`)
- DASH and DRM → URL Encryption: decrypts URLs (evidence: `internal/handlers/drm.go`)
- EPG Routes → Guide Generation: serves guide data (evidence: `internal/handlers/epg.go`)
- Guide Generation → JioTV Service: fetches schedules (evidence: `pkg/epg/epg.go`)
- Guide Generation → Task Scheduler: schedules generation (evidence: `pkg/epg/epg.go`)
- Guide Generation → EPG Output File: writes guide (evidence: `pkg/epg/epg.go`)
- JioTV API Client → Credential Store: uses persistence (evidence: `pkg/television/television.go`)
- Credential Store → Configuration: reads path settings (evidence: `pkg/store/store.go`)
- HTTP Utilities → URL Encryption: decrypts parameters (evidence: `internal/utils/handlers.go`)
- HTTP Server → Configuration: loads settings
