# waleednjlaty/waleed-zone-bot architecture

> Architecture diagram of the GitHub repository waleednjlaty/waleed-zone-bot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/waleednjlaty/waleed-zone-bot
- Repository: https://github.com/waleednjlaty/waleed-zone-bot

## Overview

Waleed Zone Bot is a Telegram community catalog for apps and games. Users browse, search, favorite, request, and download published entries; administrators manage and publish catalog entries, while Telegram file copying supports delivery without downloading APK bytes to the server. Separate capabilities include SteamRIP link resolution, optional image hosting, and group moderation. The graph follows documented features and shown source references; unsampled modules are included where the README establishes their role, but uncertain internal connections are omitted.

Main entry points: [`database/repositories.py`](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/repositories.py) (Repositories), [`app/handlers/applications.py`](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/applications.py) (User catalog flows), [`app/services/download_service.py`](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/download_service.py) (Download resolver), [`app/handlers/admin.py`](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/admin.py) (Admin workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Bot interactions"]
  node_admin["Admin workflows<br/>[admin.py]"]
  node_userflows["User catalog flows<br/>[applications.py]"]
  node_requests["App requests<br/>[requests.py]"]
  node_search["Catalog search<br/>[search.py]"]
  node_groupmod["Group moderation<br/>[group.py]"]
  node_keyboards["User keyboards<br/>[user.py]"]
end

subgraph group_catalog["Catalog workflows"]
  node_uploadhandler["Upload flow<br/>[upload.py]"]
  node_steamrip["SteamRIP flow<br/>[steamrip.py]"]
  node_catalogutil["Catalog rules<br/>[catalog.py]"]
  node_text["Message formatting<br/>[text.py]"]
  node_website["Website links<br/>[website.py]"]
  node_download["Download resolver"]
  node_uploadsvc["Telegram file copy<br/>[upload_service.py]"]
  node_groupsvc["Moderation service<br/>[group_service.py]"]
  node_images["Image migration<br/>[image_migration.py]"]
  node_owner["Admin authorization<br/>[owner_guard.py]"]
end

subgraph group_data["Data layer"]
  node_repo["Repositories<br/>[repositories.py]"]
  node_models["Catalog models<br/>[models.py]"]
  node_db[("Database sessions<br/>[database.py]")]
end

subgraph group_integrations["External services"]
  node_steamextract["SteamRIP extraction"]
  node_publichttp["Public HTTP client<br/>[public_http.py]"]
  node_imgbb["ImgBB hosting<br/>[imgbb.py]"]
  node_telegram["Telegram API<br/>[telegram.py]"]
end

node_user(("Telegram user"))
node_externaldb[("SQLite / PostgreSQL")]

node_user -->|"browses"| node_userflows
node_user -->|"searches"| node_search
node_user -->|"requests apps"| node_requests
node_user -->|"interacts in group"| node_groupmod
node_userflows -->|"queries catalog"| node_repo
node_userflows -->|"builds menus"| node_keyboards
node_userflows -->|"resolves download"| node_download
node_search -->|"queries catalog"| node_repo
node_admin -->|"manages entries"| node_repo
node_admin -->|"checks access"| node_owner
node_admin -->|"starts uploads"| node_uploadhandler
node_admin -->|"migrates images"| node_images
node_uploadhandler -->|"copies files"| node_uploadsvc
node_uploadhandler -->|"stores entry"| node_repo
node_uploadsvc -->|"copies message"| node_telegram
node_download -->|"reads sources"| node_repo
node_download -->|"resolves links"| node_steamextract
node_download -->|"fetches URLs"| node_publichttp
node_download -->|"formats fallback"| node_website
node_steamrip -->|"extracts links"| node_steamextract
node_steamrip -->|"reads catalog"| node_repo
node_steamextract -->|"fetches pages"| node_publichttp
node_images -->|"hosts images"| node_imgbb
node_groupsvc -->|"tracks moderation"| node_repo
node_groupsvc -->|"moderates members"| node_telegram
node_repo -->|"queries records"| node_models
node_db -->|"creates schema"| node_models
node_db -->|"connects"| node_externaldb
node_catalogutil -->|"categorizes entries"| node_userflows
node_text -->|"formats cards"| node_userflows

click node_admin "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/admin.py"
click node_userflows "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/applications.py"
click node_requests "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/requests.py"
click node_search "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/search.py"
click node_groupmod "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/group.py"
click node_keyboards "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/keyboards/user.py"
click node_uploadhandler "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/upload.py"
click node_steamrip "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/steamrip.py"
click node_catalogutil "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/catalog.py"
click node_text "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/text.py"
click node_website "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/website.py"
click node_download "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/download_service.py"
click node_uploadsvc "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/upload_service.py"
click node_groupsvc "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/group_service.py"
click node_images "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/image_migration.py"
click node_owner "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/owner_guard.py"
click node_repo "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/repositories.py"
click node_models "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/models.py"
click node_db "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/database.py"
click node_steamextract "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/steamrip_extractor.py"
click node_publichttp "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/public_http.py"
click node_imgbb "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/imgbb.py"
click node_telegram "https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/telegram.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_admin,node_userflows,node_requests,node_search,node_groupmod,node_keyboards,node_user toneBlue
class node_uploadhandler,node_steamrip,node_catalogutil,node_text,node_website,node_download,node_uploadsvc,node_groupsvc,node_images,node_owner,node_externaldb toneAmber
class node_repo,node_models,node_db toneMint
class node_steamextract,node_publichttp,node_imgbb,node_telegram toneRose
```

## Components

### Bot interactions

- [Admin workflows](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/admin.py): `app/handlers/admin.py`
- [User catalog flows](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/applications.py): `app/handlers/applications.py`
- [App requests](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/requests.py): `app/handlers/requests.py`
- [Catalog search](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/search.py): `app/handlers/search.py`
- [Group moderation](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/group.py): `app/handlers/group.py`
- [User keyboards](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/keyboards/user.py): `app/keyboards/user.py`

### Catalog workflows

- [Upload flow](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/upload.py): `app/handlers/upload.py`
- [SteamRIP flow](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/handlers/steamrip.py): `app/handlers/steamrip.py`
- [Catalog rules](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/catalog.py): `app/utils/catalog.py`
- [Message formatting](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/text.py): `app/utils/text.py`
- [Website links](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/website.py): `app/utils/website.py`
- [Download resolver](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/download_service.py): `app/services/download_service.py`
- [Telegram file copy](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/upload_service.py): `app/services/upload_service.py`
- [Moderation service](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/group_service.py): `app/services/group_service.py`
- [Image migration](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/services/image_migration.py): `app/services/image_migration.py`
- [Admin authorization](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/app/utils/owner_guard.py): `app/utils/owner_guard.py`

### Data layer

- [Repositories](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/repositories.py): `database/repositories.py`
- [Catalog models](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/models.py): `database/models.py`
- [Database sessions](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/database/database.py): `database/database.py`

### External services

- [SteamRIP extraction](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/steamrip_extractor.py): `integrations/steamrip_extractor.py`
- [Public HTTP client](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/public_http.py): `integrations/public_http.py`
- [ImgBB hosting](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/imgbb.py): `integrations/imgbb.py`
- [Telegram API](https://github.com/waleednjlaty/waleed-zone-bot/blob/main/integrations/telegram.py): `integrations/telegram.py`

### Other components

- **Telegram user**
- **SQLite / PostgreSQL**

## Connections

- Telegram user → User catalog flows: browses
- Telegram user → Catalog search: searches
- Telegram user → App requests: requests apps
- Telegram user → Group moderation: interacts in group
- User catalog flows → Repositories: queries catalog (evidence: `app/handlers/applications.py`)
- User catalog flows → User keyboards: builds menus (evidence: `app/handlers/applications.py`)
- User catalog flows → Download resolver: resolves download (evidence: `app/handlers/applications.py`)
- Catalog search → Repositories: queries catalog (evidence: `app/handlers/search.py`)
- Admin workflows → Repositories: manages entries (evidence: `app/handlers/admin.py`)
- Admin workflows → Admin authorization: checks access (evidence: `app/handlers/admin.py`)
- Admin workflows → Upload flow: starts uploads (evidence: `app/handlers/admin.py`)
- Admin workflows → Image migration: migrates images (evidence: `app/handlers/admin.py`)
- Upload flow → Telegram file copy: copies files (evidence: `app/handlers/upload.py`)
- Upload flow → Repositories: stores entry (evidence: `app/handlers/upload.py`)
- Telegram file copy → Telegram API: copies message (evidence: `app/services/upload_service.py`)
- Download resolver → Repositories: reads sources (evidence: `app/services/download_service.py`)
- Download resolver → SteamRIP extraction: resolves links (evidence: `app/services/download_service.py`)
- Download resolver → Public HTTP client: fetches URLs (evidence: `app/services/download_service.py`)
- Download resolver → Website links: formats fallback (evidence: `app/services/download_service.py`)
- SteamRIP flow → SteamRIP extraction: extracts links (evidence: `app/handlers/steamrip.py`)
- SteamRIP flow → Repositories: reads catalog (evidence: `app/handlers/steamrip.py`)
- SteamRIP extraction → Public HTTP client: fetches pages (evidence: `integrations/steamrip_extractor.py`)
- Image migration → ImgBB hosting: hosts images (evidence: `app/services/image_migration.py`)
- Moderation service → Repositories: tracks moderation (evidence: `app/services/group_service.py`)
- Moderation service → Telegram API: moderates members (evidence: `app/services/group_service.py`)
- Repositories → Catalog models: queries records (evidence: `database/repositories.py`)
- Database sessions → Catalog models: creates schema (evidence: `database/database.py`)
- Database sessions → SQLite / PostgreSQL: connects
- Catalog rules → User catalog flows: categorizes entries (evidence: `app/handlers/applications.py`)
- Message formatting → User catalog flows: formats cards (evidence: `app/handlers/applications.py`)
