# thymuoyhak/minishopcambodia-fullstackweb architecture

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

- Interactive diagram: https://gitdiagram.com/thymuoyhak/minishopcambodia-fullstackweb
- Repository: https://github.com/thymuoyhak/minishopcambodia-fullstackweb

## Overview

MiniShop is a multi-tenant commerce platform: customers discover a shop, browse products, authenticate or check out, and receive order/payment outcomes; shop staff also manage sales through a POS and dashboards. Shop creation and plan payments, platform administration, reseller commissions, backups, invoices, stock alerts, and Telegram storefront/bot capabilities form distinct branches. The README documents the overall integrations and capabilities; sampled sources confirm storefront routing, Mini App checkout, backend startup, authentication, and backup behavior. Several routers and frontend pages were not sampled, so their internal call paths are not asserted.

Main entry points: [`Backend_API/main.py`](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/main.py) (FastAPI entry), [`Backend_API/routers/orders.py`](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/orders.py) (Order handling), [`Frontend_User/src/App.js`](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/App.js) (Storefront), [`Backend_API/routers/plans.py`](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/plans.py) (Plans and signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer commerce"]
  node_storefront["Storefront<br/>[App.js]"]
  node_shop_context["Shop context<br/>[ShopContext.js]"]
  node_checkout["Checkout<br/>[Checkout.js]"]
  node_user_api["Storefront API<br/>[api.js]"]
end

subgraph group_operations["Shop operations"]
  node_owner_dashboard["Owner dashboard<br/>[App.js]"]
  node_pos["POS<br/>[POS.js]"]
end

subgraph group_platform["Platform management"]
  node_admin["Admin console<br/>[App.js]"]
  node_admin_shop_detail["Shop administration<br/>[ShopDetail.js]"]
  node_reseller["Reseller console<br/>[App.js]"]
end

subgraph group_backend["API and domain services"]
  node_api_entry["FastAPI entry<br/>[main.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_orders["Order handling<br/>[orders.py]"]
  node_plans["Plans and signup<br/>[plans.py]"]
  node_payments["Payments<br/>[payments.py]"]
  node_catalog["Catalog management<br/>[products.py]"]
  node_backup_api["Backup endpoints<br/>[backup.py]"]
  node_backup_service["Backup service<br/>[backup_service.py]"]
  node_invoice["Invoice and PDF<br/>[pdf_service.py]"]
  node_stock["Stock service<br/>[stock_service.py]"]
  node_aba["ABA payment service<br/>[aba_service.py]"]
  node_telegram_service["Telegram notifications"]
  node_models["Commerce models<br/>[models.py]"]
  node_database[("Database<br/>[database.py]")]
end

subgraph group_telegram["Telegram channels"]
  node_mini_app["Telegram storefront<br/>[App.js]"]
  node_bot_worker["Shop bot worker<br/>[bot_worker.py]"]
end

node_shopper(("Shopper"))
node_payway{{"ABA PayWay"}}

node_shopper -->|"browses"| node_storefront
node_storefront -->|"loads shop"| node_shop_context
node_shop_context -->|"requests shop"| node_user_api
node_storefront -->|"routes to"| node_checkout
node_checkout -.->|"submits orders"| node_user_api
node_owner_dashboard -->|"routes to"| node_pos
node_shopper -.->|"staff operates"| node_owner_dashboard
node_shopper -.->|"administers"| node_admin
node_admin -->|"routes to"| node_admin_shop_detail
node_shopper -.->|"manages referrals"| node_reseller
node_shopper -->|"opens in Telegram"| node_mini_app
node_mini_app -->|"requests API"| node_api_entry
node_mini_app -->|"creates order and payment"| node_api_entry
node_bot_worker -->|"polls bot config"| node_api_entry
node_storefront -->|"uses platform API"| node_api_entry
node_owner_dashboard -->|"uses platform API"| node_api_entry
node_admin -->|"uses platform API"| node_api_entry
node_reseller -->|"uses platform API"| node_api_entry
node_api_entry -->|"mounts router"| node_auth
node_api_entry -->|"mounts router"| node_orders
node_api_entry -->|"mounts router"| node_plans
node_api_entry -->|"mounts router"| node_payments
node_api_entry -->|"mounts router"| node_catalog
node_api_entry -->|"mounts router"| node_backup_api
node_auth -->|"uses sessions"| node_database
node_orders -->|"uses sessions"| node_database
node_plans -->|"uses sessions"| node_database
node_database -->|"defines ORM base"| node_models
node_backup_api -.->|"delegates backup"| node_backup_service
node_orders -->|"generates invoices"| node_invoice
node_plans -->|"creates plan payments"| node_aba
node_payments -.->|"handles ABA payment"| node_aba
node_aba -->|"connects gateway"| node_payway
node_orders -.->|"updates inventory"| node_stock
node_orders -.->|"notifies shop"| node_telegram_service
node_plans -.->|"uses backup support"| node_backup_service

click node_storefront "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/App.js"
click node_shop_context "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/contexts/ShopContext.js"
click node_checkout "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/pages/Checkout.js"
click node_user_api "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/api.js"
click node_owner_dashboard "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Dashboard_User/src/App.js"
click node_pos "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Dashboard_User/src/pages/POS.js"
click node_admin "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Admin/src/App.js"
click node_admin_shop_detail "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Admin/src/pages/ShopDetail.js"
click node_reseller "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Reseller/src/App.js"
click node_mini_app "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Telegram_Mini_APP/src/App.js"
click node_bot_worker "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_Telegram_Mini_App/bot_worker.py"
click node_api_entry "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/main.py"
click node_auth "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/auth.py"
click node_orders "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/orders.py"
click node_plans "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/plans.py"
click node_payments "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/payments.py"
click node_catalog "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/products.py"
click node_backup_api "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/backup.py"
click node_backup_service "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/backup_service.py"
click node_invoice "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/pdf_service.py"
click node_stock "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/stock_service.py"
click node_aba "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/aba_service.py"
click node_telegram_service "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/telegram_service.py"
click node_models "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/models.py"
click node_database "https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/database.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_storefront,node_shop_context,node_checkout,node_user_api toneBlue
class node_owner_dashboard,node_pos toneAmber
class node_admin,node_admin_shop_detail,node_reseller toneMint
class node_api_entry,node_auth,node_orders,node_plans,node_payments,node_catalog,node_backup_api,node_backup_service,node_invoice,node_stock,node_aba,node_telegram_service,node_models,node_database toneRose
class node_mini_app,node_bot_worker,node_shopper,node_payway toneIndigo
```

## Components

### Customer commerce

- [Storefront](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/App.js): `Frontend_User/src/App.js`
- [Shop context](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/contexts/ShopContext.js): `Frontend_User/src/contexts/ShopContext.js`
- [Checkout](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/pages/Checkout.js): `Frontend_User/src/pages/Checkout.js`
- [Storefront API](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_User/src/api.js): `Frontend_User/src/api.js`

### Shop operations

- [Owner dashboard](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Dashboard_User/src/App.js): `Frontend_Dashboard_User/src/App.js`
- [POS](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Dashboard_User/src/pages/POS.js): `Frontend_Dashboard_User/src/pages/POS.js`

### Platform management

- [Admin console](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Admin/src/App.js): `Frontend_Admin/src/App.js`
- [Shop administration](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Admin/src/pages/ShopDetail.js): `Frontend_Admin/src/pages/ShopDetail.js`
- [Reseller console](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Reseller/src/App.js): `Frontend_Reseller/src/App.js`

### API and domain services

- [FastAPI entry](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/main.py): `Backend_API/main.py`
- [Authentication](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/auth.py): `Backend_API/routers/auth.py`
- [Order handling](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/orders.py): `Backend_API/routers/orders.py`
- [Plans and signup](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/plans.py): `Backend_API/routers/plans.py`
- [Payments](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/payments.py): `Backend_API/routers/payments.py`
- [Catalog management](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/products.py): `Backend_API/routers/products.py`
- [Backup endpoints](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/routers/backup.py): `Backend_API/routers/backup.py`
- [Backup service](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/backup_service.py): `Backend_API/services/backup_service.py`
- [Invoice and PDF](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/pdf_service.py): `Backend_API/services/pdf_service.py`
- [Stock service](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/stock_service.py): `Backend_API/services/stock_service.py`
- [ABA payment service](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/aba_service.py): `Backend_API/services/aba_service.py`
- [Telegram notifications](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/services/telegram_service.py): `Backend_API/services/telegram_service.py`
- [Commerce models](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/models.py): `Backend_API/models.py`
- [Database](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_API/database.py): `Backend_API/database.py`

### Telegram channels

- [Telegram storefront](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Frontend_Telegram_Mini_APP/src/App.js): `Frontend_Telegram_Mini_APP/src/App.js`
- [Shop bot worker](https://github.com/thymuoyhak/minishopcambodia-fullstackweb/blob/main/Backend_Telegram_Mini_App/bot_worker.py): `Backend_Telegram_Mini_App/bot_worker.py`

### Other components

- **Shopper**
- **ABA PayWay**

## Connections

- Shopper → Storefront: browses
- Storefront → Shop context: loads shop (evidence: `Frontend_User/src/App.js`)
- Shop context → Storefront API: requests shop (evidence: `Frontend_User/src/contexts/ShopContext.js`)
- Storefront → Checkout: routes to (evidence: `Frontend_User/src/App.js`)
- Checkout → Storefront API: submits orders
- Owner dashboard → POS: routes to (evidence: `Frontend_Dashboard_User/src/App.js`)
- Shopper → Owner dashboard: staff operates
- Shopper → Admin console: administers
- Admin console → Shop administration: routes to (evidence: `Frontend_Admin/src/App.js`)
- Shopper → Reseller console: manages referrals
- Shopper → Telegram storefront: opens in Telegram
- Telegram storefront → FastAPI entry: requests API
- Telegram storefront → FastAPI entry: creates order and payment (evidence: `Frontend_Telegram_Mini_APP/src/App.js`)
- Shop bot worker → FastAPI entry: polls bot config
- Storefront → FastAPI entry: uses platform API
- Owner dashboard → FastAPI entry: uses platform API
- Admin console → FastAPI entry: uses platform API
- Reseller console → FastAPI entry: uses platform API
- FastAPI entry → Authentication: mounts router (evidence: `Backend_API/main.py`)
- FastAPI entry → Order handling: mounts router (evidence: `Backend_API/main.py`)
- FastAPI entry → Plans and signup: mounts router (evidence: `Backend_API/main.py`)
- FastAPI entry → Payments: mounts router (evidence: `Backend_API/main.py`)
- FastAPI entry → Catalog management: mounts router (evidence: `Backend_API/main.py`)
- FastAPI entry → Backup endpoints: mounts router (evidence: `Backend_API/main.py`)
- Authentication → Database: uses sessions (evidence: `Backend_API/routers/auth.py`)
- Order handling → Database: uses sessions (evidence: `Backend_API/routers/orders.py`)
- Plans and signup → Database: uses sessions (evidence: `Backend_API/routers/plans.py`)
- Database → Commerce models: defines ORM base (evidence: `Backend_API/database.py`)
- Backup endpoints → Backup service: delegates backup
- Order handling → Invoice and PDF: generates invoices (evidence: `Backend_API/routers/orders.py`)
- Plans and signup → ABA payment service: creates plan payments (evidence: `Backend_API/routers/plans.py`)
- Payments → ABA payment service: handles ABA payment
- ABA payment service → ABA PayWay: connects gateway
- Order handling → Stock service: updates inventory
- Order handling → Telegram notifications: notifies shop
- Plans and signup → Backup service: uses backup support (evidence: `Backend_API/routers/plans.py`)
