# santyx-afk/avtootvetbotforsantyx architecture

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

- Interactive diagram: https://gitdiagram.com/santyx-afk/avtootvetbotforsantyx
- Repository: https://github.com/santyx-afk/avtootvetbotforsantyx

## Overview

This repository combines a Telegram subscription-sales bot, a React Telegram Mini App, and a static admin panel. The customer workflow runs from Telegram updates or Mini App browsing through catalog and checkout, payment handling, and subscription delivery; admins manage the business through the panel and bot notifications. Source excerpts show the bot’s key service dependencies, while README documents the Mini App and admin capabilities. Several function and page implementations were not sampled, so their internal connections are left out or marked unverified.

Main entry points: [`shared/bot-service.js`](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/bot-service.js) (Bot Conversation), [`src/App.jsx`](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/App.jsx) (App Routing), [`shared/delivery-service.js`](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/delivery-service.js) (Subscription Delivery), [`shared/telegram.js`](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/telegram.js) (Telegram Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Telegram Bot"]
  node_webhook["Bot Webhook"]
  node_botlogic["Bot Conversation<br/>[bot-service.js]"]
  node_messages["Bot Messages<br/>[messages.js]"]
  node_telegramapi["Telegram Client<br/>[telegram.js]"]
end

subgraph group_services["Business Services"]
  node_orders["Order Data<br/>[db.js]"]
  node_payment["Payment Handling"]
  node_delivery["Subscription Delivery"]
  node_broadcast["Broadcasts"]
  node_referrals["Referrals"]
  node_adminnotify["Admin Notifications<br/>[admin-notify.js]"]
end

subgraph group_mini["Mini App"]
  node_storage[("Browser State<br/>[storage.js]")]
  node_app["App Routing<br/>[App.jsx]"]
  node_catalog["Storefront<br/>[Landing.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_api["API Client<br/>[api.js]"]
  node_webapi["Mini App API<br/>[webapp-api.js]"]
  node_tgprovider["Telegram Integration"]
  node_i18n["Languages<br/>[I18nProvider.jsx]"]
end

subgraph group_admin["Admin"]
  node_adminpanel["Admin Panel<br/>[app.js]"]
  node_adminfunctions["Admin APIs"]
end

node_customer(("Customer"))
node_telegram(("Telegram"))
node_webuser(("Mini App User"))
node_adminuser(("Admin User"))
node_supabase[("Supabase")]

node_customer -->|"sends updates"| node_telegram
node_telegram -->|"posts updates"| node_webhook
node_webhook -->|"dispatches to"| node_botlogic
node_botlogic -->|"reads and writes"| node_orders
node_botlogic -->|"sends replies"| node_telegramapi
node_botlogic -->|"uses text"| node_messages
node_botlogic -->|"delegates to"| node_payment
node_botlogic -->|"delegates to"| node_delivery
node_botlogic -->|"uses service"| node_broadcast
node_botlogic -->|"uses service"| node_referrals
node_botlogic -->|"notifies admins"| node_adminnotify
node_telegramapi -->|"calls API"| node_telegram
node_payment -->|"delegates delivery"| node_delivery
node_delivery -->|"updates records"| node_orders
node_delivery -->|"sends delivery"| node_telegramapi
node_adminnotify -->|"sends alerts"| node_telegramapi
node_adminnotify -->|"reads and logs"| node_orders
node_webuser -->|"opens app"| node_app
node_app -->|"routes to"| node_catalog
node_app -->|"routes to"| node_checkout
node_app -->|"uses provider"| node_tgprovider
node_app -->|"uses provider"| node_i18n
node_catalog -->|"requests catalog"| node_api
node_checkout -->|"submits checkout"| node_api
node_checkout -->|"reads and writes"| node_storage
node_api -->|"posts actions"| node_webapi
node_webapi -.->|"accesses data"| node_supabase
node_adminuser -->|"manages store"| node_adminpanel
node_adminpanel -.->|"calls admin APIs"| node_adminfunctions
node_adminfunctions -.->|"accesses data"| node_supabase

click node_webhook "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/netlify/functions/telegram-webhook.js"
click node_botlogic "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/bot-service.js"
click node_messages "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/messages.js"
click node_telegramapi "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/telegram.js"
click node_orders "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/db.js"
click node_payment "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/humo-payment-service.js"
click node_delivery "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/delivery-service.js"
click node_broadcast "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/broadcast-service.js"
click node_referrals "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/referral-service.js"
click node_adminnotify "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/admin-notify.js"
click node_storage "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/utils/storage.js"
click node_app "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/App.jsx"
click node_catalog "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/pages/Landing.jsx"
click node_checkout "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/pages/Checkout.jsx"
click node_api "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/lib/api.js"
click node_webapi "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/netlify/functions/webapp-api.js"
click node_tgprovider "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/telegram/TelegramProvider.jsx"
click node_i18n "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/i18n/I18nProvider.jsx"
click node_adminpanel "https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/admin/app.js"
click node_adminfunctions "https://github.com/santyx-afk/avtootvetbotforsantyx/tree/main/netlify/functions"

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_webhook,node_botlogic,node_messages,node_telegramapi,node_webuser,node_adminuser toneBlue
class node_orders,node_payment,node_delivery,node_broadcast,node_referrals,node_adminnotify,node_supabase toneAmber
class node_storage,node_app,node_catalog,node_checkout,node_api,node_webapi,node_tgprovider,node_i18n toneMint
class node_adminpanel,node_adminfunctions toneRose
class node_customer,node_telegram toneIndigo
```

## Components

### Telegram Bot

- [Bot Webhook](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/netlify/functions/telegram-webhook.js): `netlify/functions/telegram-webhook.js`
- [Bot Conversation](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/bot-service.js): `shared/bot-service.js`
- [Bot Messages](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/messages.js): `shared/messages.js`
- [Telegram Client](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/telegram.js): `shared/telegram.js`

### Business Services

- [Order Data](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/db.js): `shared/db.js`
- [Payment Handling](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/humo-payment-service.js): `shared/humo-payment-service.js`
- [Subscription Delivery](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/delivery-service.js): `shared/delivery-service.js`
- [Broadcasts](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/broadcast-service.js): `shared/broadcast-service.js`
- [Referrals](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/referral-service.js): `shared/referral-service.js`
- [Admin Notifications](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/shared/admin-notify.js): `shared/admin-notify.js`

### Mini App

- [Browser State](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/utils/storage.js): `src/utils/storage.js`
- [App Routing](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/App.jsx): `src/App.jsx`
- [Storefront](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/pages/Landing.jsx): `src/pages/Landing.jsx`
- [Checkout](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [API Client](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/lib/api.js): `src/lib/api.js`
- [Mini App API](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/netlify/functions/webapp-api.js): `netlify/functions/webapp-api.js`
- [Telegram Integration](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/telegram/TelegramProvider.jsx): `src/telegram/TelegramProvider.jsx`
- [Languages](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/src/i18n/I18nProvider.jsx): `src/i18n/I18nProvider.jsx`

### Admin

- [Admin Panel](https://github.com/santyx-afk/avtootvetbotforsantyx/blob/main/admin/app.js): `admin/app.js`
- [Admin APIs](https://github.com/santyx-afk/avtootvetbotforsantyx/tree/main/netlify/functions): `netlify/functions`

### Other components

- **Customer**
- **Telegram**
- **Mini App User**
- **Admin User**
- **Supabase**

## Connections

- Customer → Telegram: sends updates (evidence: `README.md`)
- Telegram → Bot Webhook: posts updates (evidence: `README.md`)
- Bot Webhook → Bot Conversation: dispatches to (evidence: `netlify/functions/telegram-webhook.js`)
- Bot Conversation → Order Data: reads and writes (evidence: `shared/bot-service.js`)
- Bot Conversation → Telegram Client: sends replies (evidence: `shared/bot-service.js`)
- Bot Conversation → Bot Messages: uses text (evidence: `shared/bot-service.js`)
- Bot Conversation → Payment Handling: delegates to (evidence: `shared/bot-service.js`)
- Bot Conversation → Subscription Delivery: delegates to (evidence: `shared/bot-service.js`)
- Bot Conversation → Broadcasts: uses service (evidence: `shared/bot-service.js`)
- Bot Conversation → Referrals: uses service (evidence: `shared/bot-service.js`)
- Bot Conversation → Admin Notifications: notifies admins (evidence: `shared/bot-service.js`)
- Telegram Client → Telegram: calls API (evidence: `shared/telegram.js`)
- Payment Handling → Subscription Delivery: delegates delivery (evidence: `shared/humo-payment-service.js`)
- Subscription Delivery → Order Data: updates records (evidence: `shared/delivery-service.js`)
- Subscription Delivery → Telegram Client: sends delivery (evidence: `shared/delivery-service.js`)
- Admin Notifications → Telegram Client: sends alerts (evidence: `shared/admin-notify.js`)
- Admin Notifications → Order Data: reads and logs (evidence: `shared/admin-notify.js`)
- Mini App User → App Routing: opens app (evidence: `README.md`)
- App Routing → Storefront: routes to (evidence: `src/App.jsx`)
- App Routing → Checkout: routes to (evidence: `src/App.jsx`)
- App Routing → Telegram Integration: uses provider (evidence: `src/App.jsx`)
- App Routing → Languages: uses provider (evidence: `src/App.jsx`)
- Storefront → API Client: requests catalog (evidence: `src/pages/Landing.jsx`)
- Checkout → API Client: submits checkout (evidence: `src/pages/Checkout.jsx`)
- Checkout → Browser State: reads and writes (evidence: `src/pages/Checkout.jsx`)
- API Client → Mini App API: posts actions (evidence: `src/lib/api.js`)
- Mini App API → Supabase: accesses data (evidence: `README.md`)
- Admin User → Admin Panel: manages store (evidence: `README.md`)
- Admin Panel → Admin APIs: calls admin APIs
- Admin APIs → Supabase: accesses data (evidence: `README.md`)
