# recloudstream/cloudstream architecture

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

- Interactive diagram: https://gitdiagram.com/recloudstream/cloudstream
- Repository: https://github.com/recloudstream/cloudstream

## Overview

CloudStream is an extension-based media center: users browse or search provider-backed media, open a result, resolve a playable source, then stream/cast or download it. Extensions are essential because the app supplies no video sources by default. The graph also preserves the documented tracking, bookmarks, phone/TV layouts and Chromecast capability. Several screens and domain modules are represented from the tree and README; their internal call paths were not sampled, so those links are omitted rather than inferred.

Main entry points: [`app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt`](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt) (Plugin runtime), [`app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt`](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt) (Main activity), [`app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt`](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt) (Player), [`library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt`](https://github.com/recloudstream/cloudstream/blob/master/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt) (Provider API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App and navigation"]
  node_app["App lifecycle<br/>[CloudStreamApp.kt]"]
  node_activity["Main activity<br/>[MainActivity.kt]"]
  node_common["Activity support<br/>[CommonActivity.kt]"]
  node_layout["Phone and TV layout<br/>[Globals.kt]"]
end

subgraph group_content["Media discovery and playback"]
  node_home["Home browsing<br/>[HomeFragment.kt]"]
  node_search["Search<br/>[SearchFragment.kt]"]
  node_result["Media details<br/>[ResultFragment.kt]"]
  node_player["Player"]
  node_cast["Chromecast<br/>[CastHelper.kt]"]
  node_downloads["Download manager<br/>[DownloadManager.kt]"]
  node_download_queue["Download queue service"]
end

subgraph group_extensions["Extensions and providers"]
  node_api["Provider API<br/>[MainAPI.kt]"]
  node_plugin["Plugin runtime<br/>[PluginManager.kt]"]
  node_repositories["Extension repositories"]
  node_repo_ui["Extension settings"]
end

subgraph group_state["Persistence and accounts"]
  node_tracking["Tracking and sync<br/>[SyncRepo.kt]"]
  node_accounts["Account manager<br/>[AccountManager.kt]"]
  node_store[("App preferences<br/>[DataStoreHelper.kt]")]
  node_runtime["Coroutine utilities<br/>[Coroutines.kt]"]
  node_helper["Context utilities<br/>[AppContextUtils.kt]"]
  node_ui_helper["UI utilities<br/>[UIHelper.kt]"]
end

node_user(("Viewer"))
node_external_media(("Media sources"))
node_external_account(("Tracking services"))

node_user -->|"opens app"| node_activity
node_activity -->|"loads plugins"| node_plugin
node_repo_ui -->|"manages plugins"| node_plugin
node_repo_ui -->|"manages repositories"| node_repositories
node_plugin -->|"uses repository manager"| node_repositories
node_external_media -.->|"provides sources"| node_api
node_home -.->|"browses providers"| node_api
node_search -.->|"searches providers"| node_api
node_result -.->|"starts playback"| node_player
node_player -.->|"streams media"| node_external_media
node_player -.->|"casts playback"| node_cast
node_result -.->|"downloads media"| node_downloads
node_downloads -->|"queues downloads"| node_download_queue
node_activity -.->|"reads settings"| node_store
node_accounts -->|"reads and writes"| node_store
node_accounts -->|"exposes sync providers"| node_tracking
node_tracking -.->|"syncs activity"| node_external_account
node_app -.->|"initializes context"| node_helper
node_common -.->|"uses UI support"| node_ui_helper
node_download_queue -->|"waits for plugins"| node_plugin

click node_app "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/CloudStreamApp.kt"
click node_activity "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt"
click node_common "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt"
click node_layout "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/settings/Globals.kt"
click node_home "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt"
click node_search "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt"
click node_result "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt"
click node_player "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt"
click node_cast "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/CastHelper.kt"
click node_downloads "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/downloader/DownloadManager.kt"
click node_download_queue "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/services/DownloadQueueService.kt"
click node_api "https://github.com/recloudstream/cloudstream/blob/master/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt"
click node_plugin "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt"
click node_repositories "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt"
click node_repo_ui "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/AndroidRepositoryManager.kt"
click node_tracking "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt"
click node_accounts "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/syncproviders/AccountManager.kt"
click node_store "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt"
click node_runtime "https://github.com/recloudstream/cloudstream/blob/master/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/Coroutines.kt"
click node_helper "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt"
click node_ui_helper "https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt"

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_app,node_activity,node_common,node_layout,node_user toneBlue
class node_home,node_search,node_result,node_player,node_cast,node_downloads,node_download_queue toneAmber
class node_api,node_plugin,node_repositories,node_repo_ui toneMint
class node_tracking,node_accounts,node_store,node_runtime,node_helper,node_ui_helper toneRose
class node_external_media,node_external_account toneIndigo
```

## Components

### App and navigation

- [App lifecycle](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/CloudStreamApp.kt): `app/src/main/java/com/lagradost/cloudstream3/CloudStreamApp.kt`
- [Main activity](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt): `app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt`
- [Activity support](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt): `app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt`
- [Phone and TV layout](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/settings/Globals.kt): `app/src/main/java/com/lagradost/cloudstream3/ui/settings/Globals.kt`

### Media discovery and playback

- [Home browsing](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt): `app/src/main/java/com/lagradost/cloudstream3/ui/home/HomeFragment.kt`
- [Search](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt): `app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt`
- [Media details](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt): `app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt`
- [Player](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt): `app/src/main/java/com/lagradost/cloudstream3/ui/player/AbstractPlayerFragment.kt`
- [Chromecast](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/CastHelper.kt): `app/src/main/java/com/lagradost/cloudstream3/utils/CastHelper.kt`
- [Download manager](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/downloader/DownloadManager.kt): `app/src/main/java/com/lagradost/cloudstream3/utils/downloader/DownloadManager.kt`
- [Download queue service](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/services/DownloadQueueService.kt): `app/src/main/java/com/lagradost/cloudstream3/services/DownloadQueueService.kt`

### Extensions and providers

- [Provider API](https://github.com/recloudstream/cloudstream/blob/master/library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt): `library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt`
- [Plugin runtime](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt): `app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt`
- [Extension repositories](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt): `app/src/main/java/com/lagradost/cloudstream3/plugins/RepositoryManager.kt`
- [Extension settings](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/AndroidRepositoryManager.kt): `app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/AndroidRepositoryManager.kt`

### Persistence and accounts

- [Tracking and sync](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt): `app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncRepo.kt`
- [Account manager](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/syncproviders/AccountManager.kt): `app/src/main/java/com/lagradost/cloudstream3/syncproviders/AccountManager.kt`
- [App preferences](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt): `app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt`
- [Coroutine utilities](https://github.com/recloudstream/cloudstream/blob/master/library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/Coroutines.kt): `library/src/commonMain/kotlin/com/lagradost/cloudstream3/utils/Coroutines.kt`
- [Context utilities](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt): `app/src/main/java/com/lagradost/cloudstream3/utils/AppContextUtils.kt`
- [UI utilities](https://github.com/recloudstream/cloudstream/blob/master/app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt): `app/src/main/java/com/lagradost/cloudstream3/utils/UIHelper.kt`

### Other components

- **Viewer**
- **Media sources**
- **Tracking services**

## Connections

- Viewer → Main activity: opens app (evidence: `README.md`)
- Main activity → Plugin runtime: loads plugins (evidence: `app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt`)
- Extension settings → Plugin runtime: manages plugins (evidence: `app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/AndroidRepositoryManager.kt`)
- Extension settings → Extension repositories: manages repositories (evidence: `app/src/main/java/com/lagradost/cloudstream3/ui/settings/extensions/AndroidRepositoryManager.kt`)
- Plugin runtime → Extension repositories: uses repository manager (evidence: `app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt`)
- Media sources → Provider API: provides sources (evidence: `README.md`)
- Home browsing → Provider API: browses providers
- Search → Provider API: searches providers (evidence: `app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt`)
- Media details → Player: starts playback
- Player → Media sources: streams media (evidence: `README.md`)
- Player → Chromecast: casts playback (evidence: `README.md`)
- Media details → Download manager: downloads media
- Download manager → Download queue service: queues downloads (evidence: `app/src/main/java/com/lagradost/cloudstream3/services/DownloadQueueService.kt`)
- Main activity → App preferences: reads settings (evidence: `app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt`)
- Account manager → App preferences: reads and writes (evidence: `app/src/main/java/com/lagradost/cloudstream3/syncproviders/AccountManager.kt`)
- Account manager → Tracking and sync: exposes sync providers (evidence: `app/src/main/java/com/lagradost/cloudstream3/syncproviders/AccountManager.kt`)
- Tracking and sync → Tracking services: syncs activity (evidence: `README.md`)
- App lifecycle → Context utilities: initializes context (evidence: `app/src/main/java/com/lagradost/cloudstream3/CloudStreamApp.kt`)
- Activity support → UI utilities: uses UI support (evidence: `app/src/main/java/com/lagradost/cloudstream3/CommonActivity.kt`)
- Download queue service → Plugin runtime: waits for plugins (evidence: `app/src/main/java/com/lagradost/cloudstream3/services/DownloadQueueService.kt`)
