# botstelegram7-cmyk/telegram-file-to-links- architecture

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

- Interactive diagram: https://gitdiagram.com/botstelegram7-cmyk/telegram-file-to-links-
- Repository: https://github.com/botstelegram7-cmyk/telegram-file-to-links-

## Overview

File 2 Links is a Telegram bot and aiohttp web app that turns uploaded media into stream and download links. Its main workflow accepts a file, stores a Telegram-channel copy and metadata, then serves browser playback or downloads; users can also browse a library and open links in MX Player or VLC. The sampled source confirms selected handlers and Telegram reads, while several route and persistence details are documented only at the README level.

Main entry points: [`bot.py`](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py) (Web routes), [`config.py`](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/config.py) (Runtime config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Telegram bot"]
  node_bot_handlers["Bot commands<br/>[bot.py]"]
  node_file_intake["File intake<br/>[bot.py]"]
  node_telegram_api["Telegram Bot API"]
end

subgraph group_web["Web experience"]
  node_web_app["Web routes<br/>[bot.py]"]
  node_player["Web player<br/>[bot.py]"]
  node_library["Media library<br/>[bot.py]"]
  node_player_apps["MX Player / VLC"]
end

subgraph group_media["Media delivery"]
  node_log_channel["Log channel"]
  node_stream["Range streaming<br/>[bot.py]"]
  node_thumbs["Thumbnail serving<br/>[bot.py]"]
  node_pyrogram["Pyrogram client"]
end

subgraph group_state["Configuration and records"]
  node_mongo[("MongoDB records")]
  node_config["Runtime config<br/>[config.py]"]
  node_environment["Environment variables"]
end

node_user(("Telegram user"))

node_user -->|"sends files"| node_bot_handlers
node_bot_handlers -->|"processes uploads"| node_file_intake
node_file_intake -->|"copies media"| node_log_channel
node_file_intake -->|"records metadata"| node_mongo
node_bot_handlers -->|"sends Bot API calls"| node_telegram_api
node_bot_handlers -->|"returns links"| node_user
node_user -->|"opens links"| node_web_app
node_web_app -->|"serves playback"| node_player
node_web_app -->|"serves library"| node_library
node_library -->|"fetches items"| node_web_app
node_player -->|"requests media"| node_stream
node_player -->|"offers deep links"| node_player_apps
node_web_app -->|"serves stream endpoint"| node_stream
node_stream -->|"reads file record"| node_mongo
node_stream -->|"fetches Telegram media"| node_pyrogram
node_pyrogram -->|"reads media"| node_log_channel
node_library -->|"loads thumbnails"| node_thumbs
node_thumbs -->|"downloads thumbnail"| node_pyrogram
node_web_app -->|"queries library records"| node_mongo
node_bot_handlers -->|"imports settings"| node_config
node_web_app -.->|"uses service settings"| node_config
node_config -->|"reads values"| node_environment

click node_bot_handlers "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_file_intake "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_web_app "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_player "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_library "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_stream "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_thumbs "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py"
click node_config "https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/config.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_bot_handlers,node_file_intake,node_telegram_api,node_user toneBlue
class node_web_app,node_player,node_library,node_player_apps toneAmber
class node_log_channel,node_stream,node_thumbs,node_pyrogram toneMint
class node_mongo,node_config,node_environment toneRose
```

## Components

### Telegram bot

- [Bot commands](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- [File intake](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- **Telegram Bot API**

### Web experience

- [Web routes](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- [Web player](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- [Media library](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- **MX Player / VLC**

### Media delivery

- **Log channel**
- [Range streaming](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- [Thumbnail serving](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/bot.py): `bot.py`
- **Pyrogram client**

### Configuration and records

- **MongoDB records**
- [Runtime config](https://github.com/botstelegram7-cmyk/telegram-file-to-links-/blob/main/config.py): `config.py`
- **Environment variables**

### Other components

- **Telegram user**

## Connections

- Telegram user → Bot commands: sends files (evidence: `README.md`)
- Bot commands → File intake: processes uploads (evidence: `README.md`)
- File intake → Log channel: copies media (evidence: `README.md`)
- File intake → MongoDB records: records metadata (evidence: `README.md`)
- Bot commands → Telegram Bot API: sends Bot API calls (evidence: `bot.py`)
- Bot commands → Telegram user: returns links (evidence: `README.md`)
- Telegram user → Web routes: opens links (evidence: `README.md`)
- Web routes → Web player: serves playback (evidence: `README.md`)
- Web routes → Media library: serves library (evidence: `README.md`)
- Media library → Web routes: fetches items (evidence: `bot.py`)
- Web player → Range streaming: requests media (evidence: `README.md`)
- Web player → MX Player / VLC: offers deep links (evidence: `README.md`)
- Web routes → Range streaming: serves stream endpoint (evidence: `README.md`)
- Range streaming → MongoDB records: reads file record (evidence: `bot.py`)
- Range streaming → Pyrogram client: fetches Telegram media (evidence: `bot.py`)
- Pyrogram client → Log channel: reads media (evidence: `README.md`)
- Media library → Thumbnail serving: loads thumbnails (evidence: `bot.py`)
- Thumbnail serving → Pyrogram client: downloads thumbnail (evidence: `bot.py`)
- Web routes → MongoDB records: queries library records (evidence: `README.md`)
- Bot commands → Runtime config: imports settings (evidence: `bot.py`)
- Web routes → Runtime config: uses service settings (evidence: `bot.py`)
- Runtime config → Environment variables: reads values (evidence: `config.py`)
