# n3urda/hongguotv architecture

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

- Interactive diagram: https://gitdiagram.com/n3urda/hongguotv
- Repository: https://github.com/n3urda/hongguotv

## Overview

hongguoTV is now primarily a standalone Kotlin Android TV app: viewers browse and search short dramas, inspect episode details, and watch streams with TV-remote controls. Native code also maintains favorites and viewing progress, supports library transfer/search utilities, and checks for app updates. A retained React Native client and Node bridge form a separate legacy deployment path. Relationships below follow the README and SOURCE INDEX references; unsampled implementations are represented only where their subsystem is clear from the tree.

Main entry points: [`kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt) (TV app coordinator), [`kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt`](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt) (Content repository), [`App.tsx`](https://github.com/n3urda/hongguotv/blob/main/App.tsx) (React Native app), [`kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/Library.kt`](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/Library.kt) (Local library)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_native["Native TV app"]
  node_native_app["TV app coordinator<br/>[MainActivity.kt]"]
  node_home["Browse screens<br/>[HomeScreen.kt]"]
  node_episode_panel["Episode details<br/>[EpisodePanel.kt]"]
  node_artwork["Artwork loading<br/>[ArtworkLoader.kt]"]
  node_tv_style["TV styling<br/>[TvStyle.kt]"]
  node_updater["App updates<br/>[AppUpdater.kt]"]
  node_media_session["Media session<br/>[TvMediaSession.kt]"]
end

subgraph group_content["Content and playback"]
  node_repository["Content repository"]
  node_signer["Request signing<br/>[Signer.kt]"]
  node_request_scope["Request handling<br/>[RequestScope.kt]"]
  node_comic_rank["Comic ranking<br/>[ComicRank.kt]"]
  node_remote_video["Stream resolution<br/>[RemoteVideo.kt]"]
  node_video_source["Video data source<br/>[VideoDataSource.kt]"]
end

subgraph group_library["Library and utilities"]
  node_library_store[("Local library<br/>[Library.kt]")]
  node_favorite_monitor["Favorite monitor<br/>[FavoriteMonitor.kt]"]
  node_tv_tools["TV tools<br/>[TvTools.kt]"]
  node_phone_search["Phone search service"]
  node_library_transfer["Library transfer service"]
  node_backup["Library backup<br/>[LibraryBackup.kt]"]
end

subgraph group_legacy["Legacy client and bridge"]
  node_legacy_app["React Native app<br/>[App.tsx]"]
  node_legacy_catalog["Catalog state<br/>[useCatalog.ts]"]
  node_legacy_provider["Bridge client<br/>[provider.ts]"]
  node_legacy_player["TV player<br/>[Player.tsx]"]
  node_legacy_storage[("Local preferences<br/>[storage.ts]")]
  node_bridge_server["Node bridge<br/>[index.mjs]"]
  node_bridge_http["HTTP API<br/>[http.mjs]"]
  node_bridge_provider["Platform provider<br/>[provider.mjs]"]
end

node_viewer(("TV viewer"))
node_content_service["Content platform"]
node_media_service["Media host"]
node_update_host["Update host"]

node_viewer -->|"operates"| node_native_app
node_native_app -->|"renders"| node_home
node_native_app -->|"opens"| node_episode_panel
node_native_app -->|"requests catalog"| node_repository
node_native_app -->|"reads and updates"| node_library_store
node_native_app -->|"loads artwork"| node_artwork
node_native_app -->|"checks updates"| node_updater
node_native_app -->|"registers controls"| node_media_session
node_native_app -->|"starts monitoring"| node_favorite_monitor
node_native_app -->|"opens tools"| node_tv_tools
node_home -->|"uses styles"| node_tv_style
node_episode_panel -->|"uses styles"| node_tv_style
node_artwork -.->|"fetches images"| node_content_service
node_repository -->|"signs requests"| node_signer
node_repository -->|"executes requests"| node_request_scope
node_repository -->|"uses ranking"| node_comic_rank
node_repository -->|"requests catalog"| node_content_service
node_repository -->|"resolves streams"| node_remote_video
node_remote_video -.->|"fetches media"| node_media_service
node_native_app -->|"prepares playback"| node_video_source
node_video_source -->|"uses stream source"| node_remote_video
node_favorite_monitor -->|"refreshes favorites"| node_repository
node_favorite_monitor -->|"updates labels"| node_library_store
node_library_store -->|"uses backup"| node_backup
node_tv_tools -->|"starts service"| node_phone_search
node_tv_tools -->|"starts service"| node_library_transfer
node_library_transfer -.->|"transfers records"| node_library_store
node_updater -.->|"checks releases"| node_update_host
node_viewer -->|"uses legacy client"| node_legacy_app
node_legacy_app -->|"loads catalog"| node_legacy_catalog
node_legacy_app -->|"loads preferences"| node_legacy_storage
node_legacy_app -->|"renders playback"| node_legacy_player
node_legacy_catalog -->|"requests pages"| node_legacy_provider
node_legacy_app -->|"checks connection"| node_legacy_provider
node_legacy_player -.->|"saves progress"| node_legacy_storage
node_legacy_provider -.->|"calls API"| node_bridge_server
node_bridge_server -->|"routes requests"| node_bridge_http
node_bridge_server -->|"configures provider"| node_bridge_provider
node_bridge_http -.->|"dispatches requests"| node_bridge_provider
node_bridge_provider -.->|"fetches content"| node_content_service

click node_native_app "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt"
click node_home "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/HomeScreen.kt"
click node_episode_panel "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/EpisodePanel.kt"
click node_artwork "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/ArtworkLoader.kt"
click node_tv_style "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvStyle.kt"
click node_updater "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/AppUpdater.kt"
click node_media_session "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvMediaSession.kt"
click node_repository "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt"
click node_signer "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/Signer.kt"
click node_request_scope "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/RequestScope.kt"
click node_comic_rank "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ComicRank.kt"
click node_remote_video "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/RemoteVideo.kt"
click node_video_source "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/VideoDataSource.kt"
click node_library_store "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/Library.kt"
click node_favorite_monitor "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/FavoriteMonitor.kt"
click node_tv_tools "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvTools.kt"
click node_phone_search "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/PhoneSearchServer.kt"
click node_library_transfer "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/LibraryTransferServer.kt"
click node_backup "https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/LibraryBackup.kt"
click node_legacy_app "https://github.com/n3urda/hongguotv/blob/main/App.tsx"
click node_legacy_catalog "https://github.com/n3urda/hongguotv/blob/main/src/data/useCatalog.ts"
click node_legacy_provider "https://github.com/n3urda/hongguotv/blob/main/src/data/provider.ts"
click node_legacy_player "https://github.com/n3urda/hongguotv/blob/main/src/ui/Player.tsx"
click node_legacy_storage "https://github.com/n3urda/hongguotv/blob/main/src/data/storage.ts"
click node_bridge_server "https://github.com/n3urda/hongguotv/blob/main/server/index.mjs"
click node_bridge_http "https://github.com/n3urda/hongguotv/blob/main/server/http.mjs"
click node_bridge_provider "https://github.com/n3urda/hongguotv/blob/main/server/provider.mjs"

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_native_app,node_home,node_episode_panel,node_artwork,node_tv_style,node_updater,node_media_session,node_viewer toneBlue
class node_repository,node_signer,node_request_scope,node_comic_rank,node_remote_video,node_video_source toneAmber
class node_library_store,node_favorite_monitor,node_tv_tools,node_phone_search,node_library_transfer,node_backup toneMint
class node_legacy_app,node_legacy_catalog,node_legacy_provider,node_legacy_player,node_legacy_storage,node_bridge_server,node_bridge_http,node_bridge_provider toneRose
class node_content_service,node_media_service,node_update_host toneIndigo
```

## Components

### Native TV app

- [TV app coordinator](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`
- [Browse screens](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/HomeScreen.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/HomeScreen.kt`
- [Episode details](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/EpisodePanel.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/EpisodePanel.kt`
- [Artwork loading](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/ArtworkLoader.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/ArtworkLoader.kt`
- [TV styling](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvStyle.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvStyle.kt`
- [App updates](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/AppUpdater.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/AppUpdater.kt`
- [Media session](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvMediaSession.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvMediaSession.kt`

### Content and playback

- [Content repository](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt`
- [Request signing](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/Signer.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/Signer.kt`
- [Request handling](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/RequestScope.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/RequestScope.kt`
- [Comic ranking](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ComicRank.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ComicRank.kt`
- [Stream resolution](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/RemoteVideo.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/RemoteVideo.kt`
- [Video data source](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/VideoDataSource.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/VideoDataSource.kt`

### Library and utilities

- [Local library](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/Library.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/Library.kt`
- [Favorite monitor](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/FavoriteMonitor.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/FavoriteMonitor.kt`
- [TV tools](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvTools.kt): `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvTools.kt`
- [Phone search service](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/PhoneSearchServer.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/PhoneSearchServer.kt`
- [Library transfer service](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/LibraryTransferServer.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/LibraryTransferServer.kt`
- [Library backup](https://github.com/n3urda/hongguotv/blob/main/kotlin-tv/core/src/main/kotlin/com/hongguotv/core/LibraryBackup.kt): `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/LibraryBackup.kt`

### Legacy client and bridge

- [React Native app](https://github.com/n3urda/hongguotv/blob/main/App.tsx): `App.tsx`
- [Catalog state](https://github.com/n3urda/hongguotv/blob/main/src/data/useCatalog.ts): `src/data/useCatalog.ts`
- [Bridge client](https://github.com/n3urda/hongguotv/blob/main/src/data/provider.ts): `src/data/provider.ts`
- [TV player](https://github.com/n3urda/hongguotv/blob/main/src/ui/Player.tsx): `src/ui/Player.tsx`
- [Local preferences](https://github.com/n3urda/hongguotv/blob/main/src/data/storage.ts): `src/data/storage.ts`
- [Node bridge](https://github.com/n3urda/hongguotv/blob/main/server/index.mjs): `server/index.mjs`
- [HTTP API](https://github.com/n3urda/hongguotv/blob/main/server/http.mjs): `server/http.mjs`
- [Platform provider](https://github.com/n3urda/hongguotv/blob/main/server/provider.mjs): `server/provider.mjs`

### Other components

- **TV viewer**
- **Content platform**
- **Media host**
- **Update host**

## Connections

- TV viewer → TV app coordinator: operates (evidence: `README.md`)
- TV app coordinator → Browse screens: renders (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → Episode details: opens (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → Content repository: requests catalog (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → Local library: reads and updates (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → Artwork loading: loads artwork (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → App updates: checks updates (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → Media session: registers controls (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → Favorite monitor: starts monitoring (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- TV app coordinator → TV tools: opens tools (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- Browse screens → TV styling: uses styles (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/HomeScreen.kt`)
- Episode details → TV styling: uses styles (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/EpisodePanel.kt`)
- Artwork loading → Content platform: fetches images
- Content repository → Request signing: signs requests (evidence: `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt`)
- Content repository → Request handling: executes requests (evidence: `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt`)
- Content repository → Comic ranking: uses ranking (evidence: `kotlin-tv/core/src/main/kotlin/com/hongguotv/core/ContentRepository.kt`)
- Content repository → Content platform: requests catalog (evidence: `README.md`)
- Content repository → Stream resolution: resolves streams (evidence: `README.md`)
- Stream resolution → Media host: fetches media
- TV app coordinator → Video data source: prepares playback (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/MainActivity.kt`)
- Video data source → Stream resolution: uses stream source (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/VideoDataSource.kt`)
- Favorite monitor → Content repository: refreshes favorites (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/FavoriteMonitor.kt`)
- Favorite monitor → Local library: updates labels (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/FavoriteMonitor.kt`)
- Local library → Library backup: uses backup (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/Library.kt`)
- TV tools → Phone search service: starts service (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvTools.kt`)
- TV tools → Library transfer service: starts service (evidence: `kotlin-tv/app/src/main/kotlin/com/hongguotv/nativeapp/TvTools.kt`)
- Library transfer service → Local library: transfers records
- App updates → Update host: checks releases
- TV viewer → React Native app: uses legacy client (evidence: `README.md`)
- React Native app → Catalog state: loads catalog (evidence: `App.tsx`)
- React Native app → Local preferences: loads preferences (evidence: `App.tsx`)
- React Native app → TV player: renders playback (evidence: `App.tsx`)
- Catalog state → Bridge client: requests pages (evidence: `src/data/useCatalog.ts`)
- React Native app → Bridge client: checks connection (evidence: `App.tsx`)
- TV player → Local preferences: saves progress
- Bridge client → Node bridge: calls API
- Node bridge → HTTP API: routes requests (evidence: `server/index.mjs`)
- Node bridge → Platform provider: configures provider (evidence: `server/index.mjs`)
- HTTP API → Platform provider: dispatches requests
- Platform provider → Content platform: fetches content
