# abhi73-gif/auto-uploader architecture

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

- Interactive diagram: https://gitdiagram.com/abhi73-gif/auto-uploader
- Repository: https://github.com/abhi73-gif/auto-uploader

## Overview

AppxAutoUploader is a Telegram bot for collecting ClassX course materials and organizing uploads in Telegram groups. Users configure batches through bot commands and callback menus; the batch logic authenticates with the course API, retrieves content, and persists batch configuration, while processing downloads and uploads files and records progress. Scheduling and recovery support ongoing updates. The README documents additional capabilities such as YouTube handling, forum organization, retries, and status notifications; some corresponding implementation was not sampled, so those connections are not asserted. Evidence for edges is limited to shown excerpts, indexed references, and README statements.

Main entry points: [`modules/tasks.py`](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/tasks.py) (Upload tasks), [`plugins/callbacks.py`](https://github.com/abhi73-gif/auto-uploader/blob/main/plugins/callbacks.py) (Callback handlers), [`modules/appxdata.py`](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/appxdata.py) (Course data fetch), [`master/database.py`](https://github.com/abhi73-gif/auto-uploader/blob/main/master/database.py) (Database operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Telegram interaction"]
  node_commands["Bot commands<br/>[command.py]"]
  node_callbacks["Callback handlers<br/>[callbacks.py]"]
  node_keyboards["UI keyboards<br/>[buttom.py]"]
  node_messages["Bot messages<br/>[msg.py]"]
  node_batch_controls["Batch controls<br/>[buttom.py]"]
  node_api_keys["App selection<br/>[key.py]"]
end

subgraph group_course["Course collection"]
  node_batch_setup["Batch setup<br/>[appx_master.py]"]
  node_course_data["Course data fetch<br/>[appxdata.py]"]
  node_apnaex["Apnaex extraction"]
end

subgraph group_delivery["Upload processing"]
  node_upload_tasks["Upload tasks<br/>[tasks.py]"]
  node_file_helpers["File processing<br/>[helper.py]"]
end

subgraph group_state["Persistence and scheduling"]
  node_database_api["Database operations<br/>[database.py]"]
  node_scheduler["Update scheduler<br/>[scheduler.py]"]
  node_recovery["Incomplete recovery<br/>[retasks.py]"]
end

subgraph group_support["Shared services"]
  node_http_client["HTTP client<br/>[server.py]"]
  node_utilities["Shared utilities<br/>[utils.py]"]
  node_manager["Task manager<br/>[manager.py]"]
  node_logdb[("Upload logging<br/>[logdb.py]")]
  node_logger["Application logger<br/>[logger.py]"]
end

node_user(("Bot user"))
node_telegram(("Telegram"))
node_classx(("ClassX API"))
node_mongodb[("MongoDB")]

node_user -.->|"sends commands"| node_commands
node_user -->|"selects actions"| node_callbacks
node_callbacks -->|"starts setup"| node_batch_setup
node_callbacks -->|"shows menus"| node_keyboards
node_callbacks -->|"manages batches"| node_batch_controls
node_callbacks -->|"selects app"| node_api_keys
node_batch_setup -->|"authenticates"| node_classx
node_batch_setup -->|"fetches content"| node_course_data
node_batch_setup -->|"saves batch"| node_database_api
node_course_data -->|"requests content"| node_http_client
node_course_data -->|"queries courses"| node_classx
node_upload_tasks -->|"checks and records"| node_database_api
node_upload_tasks -->|"processes files"| node_file_helpers
node_upload_tasks -->|"uploads materials"| node_telegram
node_database_api -->|"reads and writes"| node_mongodb
node_recovery -->|"finds incomplete batches"| node_database_api
node_recovery -->|"collects content"| node_course_data
node_recovery -->|"resumes uploads"| node_upload_tasks
node_recovery -->|"notifies recovery"| node_telegram
node_scheduler -.->|"loads schedules"| node_database_api
node_scheduler -.->|"sends status"| node_telegram
node_file_helpers -->|"sends videos"| node_telegram
node_file_helpers -->|"records events"| node_logger
node_course_data -->|"decrypts links"| node_utilities
node_upload_tasks -.->|"delegates task"| node_manager
node_upload_tasks -.->|"records upload"| node_logdb
node_apnaex -.->|"extracts content"| node_classx
node_commands -.->|"handles commands"| node_telegram

click node_commands "https://github.com/abhi73-gif/auto-uploader/blob/main/plugins/command.py"
click node_callbacks "https://github.com/abhi73-gif/auto-uploader/blob/main/plugins/callbacks.py"
click node_keyboards "https://github.com/abhi73-gif/auto-uploader/blob/main/constant/buttom.py"
click node_messages "https://github.com/abhi73-gif/auto-uploader/blob/main/constant/msg.py"
click node_batch_setup "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/appx_master.py"
click node_course_data "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/appxdata.py"
click node_apnaex "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/apnaex_extractor.py"
click node_upload_tasks "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/tasks.py"
click node_file_helpers "https://github.com/abhi73-gif/auto-uploader/blob/main/master/helper.py"
click node_batch_controls "https://github.com/abhi73-gif/auto-uploader/blob/main/master/buttom.py"
click node_api_keys "https://github.com/abhi73-gif/auto-uploader/blob/main/master/key.py"
click node_database_api "https://github.com/abhi73-gif/auto-uploader/blob/main/master/database.py"
click node_scheduler "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/scheduler.py"
click node_recovery "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/retasks.py"
click node_http_client "https://github.com/abhi73-gif/auto-uploader/blob/main/master/server.py"
click node_utilities "https://github.com/abhi73-gif/auto-uploader/blob/main/master/utils.py"
click node_manager "https://github.com/abhi73-gif/auto-uploader/blob/main/modules/manager.py"
click node_logdb "https://github.com/abhi73-gif/auto-uploader/blob/main/master/logdb.py"
click node_logger "https://github.com/abhi73-gif/auto-uploader/blob/main/logger.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_commands,node_callbacks,node_keyboards,node_messages,node_batch_controls,node_api_keys,node_user toneBlue
class node_batch_setup,node_course_data,node_apnaex,node_mongodb toneAmber
class node_upload_tasks,node_file_helpers,node_classx toneMint
class node_database_api,node_scheduler,node_recovery toneRose
class node_http_client,node_utilities,node_manager,node_logdb,node_logger,node_telegram toneIndigo
```

## Components

### Telegram interaction

- [Bot commands](https://github.com/abhi73-gif/auto-uploader/blob/main/plugins/command.py): `plugins/command.py`
- [Callback handlers](https://github.com/abhi73-gif/auto-uploader/blob/main/plugins/callbacks.py): `plugins/callbacks.py`
- [UI keyboards](https://github.com/abhi73-gif/auto-uploader/blob/main/constant/buttom.py): `constant/buttom.py`
- [Bot messages](https://github.com/abhi73-gif/auto-uploader/blob/main/constant/msg.py): `constant/msg.py`
- [Batch controls](https://github.com/abhi73-gif/auto-uploader/blob/main/master/buttom.py): `master/buttom.py`
- [App selection](https://github.com/abhi73-gif/auto-uploader/blob/main/master/key.py): `master/key.py`

### Course collection

- [Batch setup](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/appx_master.py): `modules/appx_master.py`
- [Course data fetch](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/appxdata.py): `modules/appxdata.py`
- [Apnaex extraction](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/apnaex_extractor.py): `modules/apnaex_extractor.py`

### Upload processing

- [Upload tasks](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/tasks.py): `modules/tasks.py`
- [File processing](https://github.com/abhi73-gif/auto-uploader/blob/main/master/helper.py): `master/helper.py`

### Persistence and scheduling

- [Database operations](https://github.com/abhi73-gif/auto-uploader/blob/main/master/database.py): `master/database.py`
- [Update scheduler](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/scheduler.py): `modules/scheduler.py`
- [Incomplete recovery](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/retasks.py): `modules/retasks.py`

### Shared services

- [HTTP client](https://github.com/abhi73-gif/auto-uploader/blob/main/master/server.py): `master/server.py`
- [Shared utilities](https://github.com/abhi73-gif/auto-uploader/blob/main/master/utils.py): `master/utils.py`
- [Task manager](https://github.com/abhi73-gif/auto-uploader/blob/main/modules/manager.py): `modules/manager.py`
- [Upload logging](https://github.com/abhi73-gif/auto-uploader/blob/main/master/logdb.py): `master/logdb.py`
- [Application logger](https://github.com/abhi73-gif/auto-uploader/blob/main/logger.py): `logger.py`

### Other components

- **Bot user**
- **Telegram**
- **ClassX API**
- **MongoDB**

## Connections

- Bot user → Bot commands: sends commands (evidence: `README.md`)
- Bot user → Callback handlers: selects actions (evidence: `plugins/callbacks.py`)
- Callback handlers → Batch setup: starts setup (evidence: `plugins/callbacks.py`)
- Callback handlers → UI keyboards: shows menus (evidence: `plugins/callbacks.py`)
- Callback handlers → Batch controls: manages batches (evidence: `plugins/callbacks.py`)
- Callback handlers → App selection: selects app (evidence: `plugins/callbacks.py`)
- Batch setup → ClassX API: authenticates (evidence: `modules/appx_master.py`)
- Batch setup → Course data fetch: fetches content (evidence: `modules/appx_master.py`)
- Batch setup → Database operations: saves batch (evidence: `modules/appx_master.py`)
- Course data fetch → HTTP client: requests content (evidence: `modules/appxdata.py`)
- Course data fetch → ClassX API: queries courses (evidence: `modules/appxdata.py`)
- Upload tasks → Database operations: checks and records (evidence: `modules/tasks.py`)
- Upload tasks → File processing: processes files (evidence: `modules/tasks.py`)
- Upload tasks → Telegram: uploads materials (evidence: `modules/tasks.py`)
- Database operations → MongoDB: reads and writes (evidence: `master/database.py`)
- Incomplete recovery → Database operations: finds incomplete batches (evidence: `modules/retasks.py`)
- Incomplete recovery → Course data fetch: collects content (evidence: `modules/retasks.py`)
- Incomplete recovery → Upload tasks: resumes uploads (evidence: `modules/retasks.py`)
- Incomplete recovery → Telegram: notifies recovery (evidence: `modules/retasks.py`)
- Update scheduler → Database operations: loads schedules (evidence: `README.md`)
- Update scheduler → Telegram: sends status (evidence: `README.md`)
- File processing → Telegram: sends videos (evidence: `master/helper.py`)
- File processing → Application logger: records events (evidence: `master/helper.py`)
- Course data fetch → Shared utilities: decrypts links (evidence: `modules/appxdata.py`)
- Upload tasks → Task manager: delegates task (evidence: `modules/tasks.py`)
- Upload tasks → Upload logging: records upload (evidence: `modules/tasks.py`)
- Apnaex extraction → ClassX API: extracts content (evidence: `README.md`)
- Bot commands → Telegram: handles commands (evidence: `README.md`)
