# cahyomahardika91/telegram-drive architecture

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

- Interactive diagram: https://gitdiagram.com/cahyomahardika91/telegram-drive
- Repository: https://github.com/cahyomahardika91/telegram-drive

## Overview

Telegram Drive is a local-first workspace for managing files stored in a user’s Telegram account. The main workflow is sign-in, browse and organize Telegram files, then transfer or preview them; desktop queues and Android background services support durable transfers. The Rust backend also provides optional encryption, folder sync, sharing, local API/WebDAV, and media streaming. Edges reflect shown calls or README-documented behavior; several feature implementations were not sampled, so their internal connections are omitted.

Main entry points: [`app/src-tauri/src/commands/fs.rs`](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/fs.rs) (File operations), [`app/src-tauri/src/db.rs`](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/db.rs) (Local database), [`app/src/App.tsx`](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/App.tsx) (App shell), [`app/src-tauri/src/transfer_engine.rs`](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/transfer_engine.rs) (Transfer engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_desktop["Desktop workspace"]
  node_mobile["Mobile workspace"]
end

subgraph group_backend["Telegram operations"]
  node_auth["Authentication<br/>[auth.rs]"]
  node_fileops["File operations<br/>[fs.rs]"]
  node_foldergroups["Folder groups<br/>[folder_groups.rs]"]
  node_inventory["File inventory<br/>[file_inventory.rs]"]
  node_database[("Local database<br/>[db.rs]")]
end

subgraph group_transfer["Transfers and sync"]
  node_transfers["Transfer engine<br/>[transfer_engine.rs]"]
  node_bandwidth["Bandwidth controls<br/>[bandwidth.rs]"]
  node_androidbg["Android background"]
  node_recovery["Transfer recovery"]
  node_sync["Folder sync"]
end

subgraph group_media["Media and protection"]
  node_preview["Preview and cache<br/>[preview.rs]"]
  node_streaming["Media streaming<br/>[streaming.rs]"]
  node_crypto["Encryption vault<br/>[state.rs]"]
end

subgraph group_integrations["Local integrations"]
  node_localapi["Local REST API<br/>[api_routes.rs]"]
  node_server["Local server<br/>[server.rs]"]
  node_sharing["Share links<br/>[share_routes.rs]"]
  node_webdav["WebDAV<br/>[webdav.rs]"]
end

node_user(("User"))
node_telegram(("Telegram account"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_desktop
node_app -->|"renders"| node_mobile
node_app -->|"invokes startup"| node_auth
node_desktop -.->|"manages files"| node_fileops
node_mobile -.->|"manages files"| node_fileops
node_auth -->|"authenticates"| node_telegram
node_fileops -->|"reads and writes"| node_telegram
node_fileops -->|"uses limits"| node_bandwidth
node_fileops -->|"uses encryption"| node_crypto
node_fileops -->|"records metadata"| node_database
node_foldergroups -.->|"stores groups"| node_database
node_inventory -.->|"stores inventory"| node_database
node_transfers -->|"executes jobs"| node_fileops
node_transfers -->|"persists jobs"| node_database
node_transfers -->|"reserves capacity"| node_bandwidth
node_androidbg -->|"schedules recovery"| node_recovery
node_recovery -.->|"resumes transfers"| node_androidbg
node_sync -->|"reconciles files"| node_telegram
node_preview -->|"fetches previews"| node_telegram
node_preview -->|"uses cache metadata"| node_database
node_streaming -->|"streams media"| node_telegram
node_crypto -->|"protects transfers"| node_fileops
node_localapi -->|"serves file operations"| node_telegram
node_server -.->|"hosts routes"| node_localapi
node_server -->|"serves share routes"| node_sharing
node_server -.->|"serves media"| node_streaming
node_webdav -->|"exposes files"| node_telegram

click node_app "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/App.tsx"
click node_desktop "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/components/desktop/DesktopDashboard.tsx"
click node_mobile "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/components/mobile/MobileDashboard.tsx"
click node_auth "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/auth.rs"
click node_fileops "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/fs.rs"
click node_foldergroups "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/folder_groups.rs"
click node_inventory "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/file_inventory.rs"
click node_transfers "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/transfer_engine.rs"
click node_bandwidth "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/bandwidth.rs"
click node_androidbg "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferJobService.kt"
click node_recovery "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferRecoveryWorker.kt"
click node_sync "https://github.com/cahyomahardika91/telegram-drive/tree/main/app/src-tauri/src/sync_engine"
click node_preview "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/preview.rs"
click node_streaming "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/streaming.rs"
click node_crypto "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/crypto/state.rs"
click node_database "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/db.rs"
click node_localapi "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/api_routes.rs"
click node_server "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/server.rs"
click node_sharing "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/share_routes.rs"
click node_webdav "https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/webdav.rs"

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_desktop,node_mobile,node_user toneBlue
class node_auth,node_fileops,node_foldergroups,node_inventory,node_database toneAmber
class node_transfers,node_bandwidth,node_androidbg,node_recovery,node_sync toneMint
class node_preview,node_streaming,node_crypto toneRose
class node_localapi,node_server,node_sharing,node_webdav,node_telegram toneIndigo
```

## Components

### Client experience

- [App shell](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/App.tsx): `app/src/App.tsx`
- [Desktop workspace](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/components/desktop/DesktopDashboard.tsx): `app/src/components/desktop/DesktopDashboard.tsx`
- [Mobile workspace](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src/components/mobile/MobileDashboard.tsx): `app/src/components/mobile/MobileDashboard.tsx`

### Telegram operations

- [Authentication](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/auth.rs): `app/src-tauri/src/commands/auth.rs`
- [File operations](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/fs.rs): `app/src-tauri/src/commands/fs.rs`
- [Folder groups](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/folder_groups.rs): `app/src-tauri/src/commands/folder_groups.rs`
- [File inventory](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/file_inventory.rs): `app/src-tauri/src/commands/file_inventory.rs`
- [Local database](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/db.rs): `app/src-tauri/src/db.rs`

### Transfers and sync

- [Transfer engine](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/transfer_engine.rs): `app/src-tauri/src/transfer_engine.rs`
- [Bandwidth controls](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/bandwidth.rs): `app/src-tauri/src/bandwidth.rs`
- [Android background](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferJobService.kt): `app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferJobService.kt`
- [Transfer recovery](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferRecoveryWorker.kt): `app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferRecoveryWorker.kt`
- [Folder sync](https://github.com/cahyomahardika91/telegram-drive/tree/main/app/src-tauri/src/sync_engine): `app/src-tauri/src/sync_engine`

### Media and protection

- [Preview and cache](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/preview.rs): `app/src-tauri/src/commands/preview.rs`
- [Media streaming](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/commands/streaming.rs): `app/src-tauri/src/commands/streaming.rs`
- [Encryption vault](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/crypto/state.rs): `app/src-tauri/src/crypto/state.rs`

### Local integrations

- [Local REST API](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/api_routes.rs): `app/src-tauri/src/api_routes.rs`
- [Local server](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/server.rs): `app/src-tauri/src/server.rs`
- [Share links](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/share_routes.rs): `app/src-tauri/src/share_routes.rs`
- [WebDAV](https://github.com/cahyomahardika91/telegram-drive/blob/main/app/src-tauri/src/webdav.rs): `app/src-tauri/src/webdav.rs`

### Other components

- **User**
- **Telegram account**

## Connections

- User → App shell: uses (evidence: `README.md`)
- App shell → Desktop workspace: renders (evidence: `app/src/App.tsx`)
- App shell → Mobile workspace: renders (evidence: `app/src/App.tsx`)
- App shell → Authentication: invokes startup (evidence: `app/src/App.tsx`)
- Desktop workspace → File operations: manages files
- Mobile workspace → File operations: manages files
- Authentication → Telegram account: authenticates (evidence: `README.md`)
- File operations → Telegram account: reads and writes (evidence: `README.md`)
- File operations → Bandwidth controls: uses limits (evidence: `app/src-tauri/src/commands/fs.rs`)
- File operations → Encryption vault: uses encryption (evidence: `app/src-tauri/src/commands/fs.rs`)
- File operations → Local database: records metadata (evidence: `app/src-tauri/src/commands/fs.rs`)
- Folder groups → Local database: stores groups
- File inventory → Local database: stores inventory
- Transfer engine → File operations: executes jobs (evidence: `app/src-tauri/src/transfer_engine.rs`)
- Transfer engine → Local database: persists jobs (evidence: `app/src-tauri/src/transfer_engine.rs`)
- Transfer engine → Bandwidth controls: reserves capacity (evidence: `app/src-tauri/src/transfer_engine.rs`)
- Android background → Transfer recovery: schedules recovery (evidence: `app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferJobService.kt`)
- Transfer recovery → Android background: resumes transfers (evidence: `app/android-overrides/app/src/main/java/com/cameronamer/telegramdrive/TransferJobService.kt`)
- Folder sync → Telegram account: reconciles files (evidence: `README.md`)
- Preview and cache → Telegram account: fetches previews (evidence: `app/src-tauri/src/commands/preview.rs`)
- Preview and cache → Local database: uses cache metadata (evidence: `app/src-tauri/src/commands/preview.rs`)
- Media streaming → Telegram account: streams media (evidence: `README.md`)
- Encryption vault → File operations: protects transfers (evidence: `README.md`)
- Local REST API → Telegram account: serves file operations (evidence: `app/src-tauri/src/api_routes.rs`)
- Local server → Local REST API: hosts routes (evidence: `app/src-tauri/src/api_routes.rs`)
- Local server → Share links: serves share routes (evidence: `app/src-tauri/src/server.rs`)
- Local server → Media streaming: serves media
- WebDAV → Telegram account: exposes files (evidence: `README.md`)
