# akhil0924/telefilemanager architecture

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

- Interactive diagram: https://gitdiagram.com/akhil0924/telefilemanager
- Repository: https://github.com/akhil0924/telefilemanager

## Overview

TeleUpload manages files in Telegram forum topics and channels through a React console backed by an aiohttp service. The main workflow is sign in, browse indexed chats/topics and files, review an upload, then upload to Telegram; public download links can stream files independently with byte-range support. Telegram remains the media source of truth while SQLite stores the searchable metadata index. The README also documents preview, thumbnail caching, upload-task controls and chat/topic management. Several route and service details are unsampled, so links for those capabilities are limited to relationships stated in the README.

Main entry points: [`frontend/src/App.jsx`](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/App.jsx) (Workspace UI), [`backend/routes.py`](https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py) (HTTP routes), [`backend/app.py`](https://github.com/akhil0924/telefilemanager/blob/main/backend/app.py) (App lifecycle), [`frontend/src/api.js`](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Management console"]
  node_app["Workspace UI<br/>[App.jsx]"]
  node_api["API client<br/>[api.js]"]
  node_browser["File browser<br/>[FileBrowser.jsx]"]
  node_sidebar["Topic sidebar<br/>[TopicSidebar.jsx]"]
  node_review["Upload review"]
  node_activity["Upload activity"]
  node_previewui["File preview"]
  node_thumbnail["File thumbnail<br/>[FileThumbnail.jsx]"]
  node_format["Format helpers<br/>[format.js]"]
end

subgraph group_http["HTTP service"]
  node_httpapp["App lifecycle<br/>[app.py]"]
  node_routes["HTTP routes<br/>[routes.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_index["Metadata and security"]
  node_database[("SQLite index<br/>[db.py]")]
  node_security["Token and range security<br/>[security.py]"]
end

subgraph group_telegram["Telegram integration"]
  node_telegramservice["Sync and upload service"]
  node_telegram{{"Telegram"}}
end

subgraph group_media["Media delivery"]
  node_preview["Preview processing<br/>[preview.py]"]
  node_stream["Media streaming<br/>[routes.py]"]
  node_thumbcache["Thumbnail cache<br/>[routes.py]"]
end

node_admin(("Manager"))
node_downloader(("Public downloader"))

node_admin -->|"uses console"| node_app
node_app -->|"requests data"| node_api
node_app -->|"renders"| node_browser
node_app -->|"renders"| node_sidebar
node_app -->|"opens"| node_review
node_app -->|"renders"| node_activity
node_app -->|"opens"| node_previewui
node_browser -->|"renders"| node_thumbnail
node_previewui -->|"renders"| node_thumbnail
node_review -->|"normalizes names"| node_format
node_api -->|"normalizes names"| node_format
node_api -->|"calls API"| node_routes
node_httpapp -->|"receives config"| node_config
node_httpapp -->|"initializes"| node_database
node_httpapp -->|"starts service"| node_telegramservice
node_httpapp -->|"registers routes"| node_routes
node_routes -->|"queries index"| node_database
node_routes -->|"manages topics"| node_telegramservice
node_routes -->|"verifies sessions"| node_security
node_routes -->|"builds previews"| node_preview
node_telegramservice -->|"updates index"| node_database
node_telegramservice -->|"syncs and transfers"| node_telegram
node_routes -->|"changes topics"| node_telegram
node_downloader -->|"requests download"| node_stream
node_stream -->|"looks up file"| node_database
node_stream -->|"checks link and range"| node_security
node_stream -->|"streams media"| node_telegram
node_api -.->|"requests thumbnail"| node_thumbcache
node_thumbcache -->|"fetches thumbnail"| node_telegram
node_previewui -->|"opens inline media"| node_stream

click node_app "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/api.js"
click node_browser "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/FileBrowser.jsx"
click node_sidebar "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/TopicSidebar.jsx"
click node_review "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/UploadReviewModal.jsx"
click node_activity "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/UploadActivityArea.jsx"
click node_previewui "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/FilePreviewModal.jsx"
click node_thumbnail "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/FileThumbnail.jsx"
click node_format "https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/utils/format.js"
click node_httpapp "https://github.com/akhil0924/telefilemanager/blob/main/backend/app.py"
click node_routes "https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py"
click node_config "https://github.com/akhil0924/telefilemanager/blob/main/backend/config.py"
click node_database "https://github.com/akhil0924/telefilemanager/blob/main/backend/db.py"
click node_security "https://github.com/akhil0924/telefilemanager/blob/main/backend/security.py"
click node_telegramservice "https://github.com/akhil0924/telefilemanager/blob/main/backend/telegram_service.py"
click node_preview "https://github.com/akhil0924/telefilemanager/blob/main/backend/preview.py"
click node_stream "https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py"
click node_thumbcache "https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py"

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_api,node_browser,node_sidebar,node_review,node_activity,node_previewui,node_thumbnail,node_format toneBlue
class node_httpapp,node_routes,node_config toneAmber
class node_database,node_security toneMint
class node_telegramservice,node_telegram toneRose
class node_preview,node_stream,node_thumbcache,node_admin,node_downloader toneIndigo
```

## Components

### Management console

- [Workspace UI](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [File browser](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/FileBrowser.jsx): `frontend/src/components/FileBrowser.jsx`
- [Topic sidebar](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/TopicSidebar.jsx): `frontend/src/components/TopicSidebar.jsx`
- [Upload review](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/UploadReviewModal.jsx): `frontend/src/components/UploadReviewModal.jsx`
- [Upload activity](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/UploadActivityArea.jsx): `frontend/src/components/UploadActivityArea.jsx`
- [File preview](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/FilePreviewModal.jsx): `frontend/src/components/FilePreviewModal.jsx`
- [File thumbnail](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/components/FileThumbnail.jsx): `frontend/src/components/FileThumbnail.jsx`
- [Format helpers](https://github.com/akhil0924/telefilemanager/blob/main/frontend/src/utils/format.js): `frontend/src/utils/format.js`

### HTTP service

- [App lifecycle](https://github.com/akhil0924/telefilemanager/blob/main/backend/app.py): `backend/app.py`
- [HTTP routes](https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py): `backend/routes.py`
- [Runtime configuration](https://github.com/akhil0924/telefilemanager/blob/main/backend/config.py): `backend/config.py`

### Metadata and security

- [SQLite index](https://github.com/akhil0924/telefilemanager/blob/main/backend/db.py): `backend/db.py`
- [Token and range security](https://github.com/akhil0924/telefilemanager/blob/main/backend/security.py): `backend/security.py`

### Telegram integration

- [Sync and upload service](https://github.com/akhil0924/telefilemanager/blob/main/backend/telegram_service.py): `backend/telegram_service.py`
- **Telegram**

### Media delivery

- [Preview processing](https://github.com/akhil0924/telefilemanager/blob/main/backend/preview.py): `backend/preview.py`
- [Media streaming](https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py): `backend/routes.py`
- [Thumbnail cache](https://github.com/akhil0924/telefilemanager/blob/main/backend/routes.py): `backend/routes.py`

### Other components

- **Manager**
- **Public downloader**

## Connections

- Manager → Workspace UI: uses console (evidence: `README.md`)
- Workspace UI → API client: requests data (evidence: `frontend/src/App.jsx`)
- Workspace UI → File browser: renders (evidence: `frontend/src/App.jsx`)
- Workspace UI → Topic sidebar: renders (evidence: `frontend/src/App.jsx`)
- Workspace UI → Upload review: opens (evidence: `frontend/src/App.jsx`)
- Workspace UI → Upload activity: renders (evidence: `frontend/src/App.jsx`)
- Workspace UI → File preview: opens (evidence: `frontend/src/App.jsx`)
- File browser → File thumbnail: renders (evidence: `frontend/src/components/FileBrowser.jsx`)
- File preview → File thumbnail: renders (evidence: `frontend/src/components/FilePreviewModal.jsx`)
- Upload review → Format helpers: normalizes names (evidence: `frontend/src/components/UploadReviewModal.jsx`)
- API client → Format helpers: normalizes names (evidence: `frontend/src/api.js`)
- API client → HTTP routes: calls API (evidence: `frontend/src/api.js`)
- App lifecycle → Runtime configuration: receives config (evidence: `backend/app.py`)
- App lifecycle → SQLite index: initializes (evidence: `backend/app.py`)
- App lifecycle → Sync and upload service: starts service (evidence: `backend/app.py`)
- App lifecycle → HTTP routes: registers routes (evidence: `backend/app.py`)
- HTTP routes → SQLite index: queries index (evidence: `backend/routes.py`)
- HTTP routes → Sync and upload service: manages topics (evidence: `backend/routes.py`)
- HTTP routes → Token and range security: verifies sessions (evidence: `backend/routes.py`)
- HTTP routes → Preview processing: builds previews (evidence: `backend/routes.py`)
- Sync and upload service → SQLite index: updates index (evidence: `backend/telegram_service.py`)
- Sync and upload service → Telegram: syncs and transfers (evidence: `README.md`)
- HTTP routes → Telegram: changes topics (evidence: `backend/routes.py`)
- Public downloader → Media streaming: requests download (evidence: `README.md`)
- Media streaming → SQLite index: looks up file (evidence: `backend/routes.py`)
- Media streaming → Token and range security: checks link and range (evidence: `README.md`)
- Media streaming → Telegram: streams media (evidence: `README.md`)
- API client → Thumbnail cache: requests thumbnail (evidence: `README.md`)
- Thumbnail cache → Telegram: fetches thumbnail (evidence: `README.md`)
- File preview → Media streaming: opens inline media (evidence: `frontend/src/components/FilePreviewModal.jsx`)
