# virakbothchharn6-tech/sai-project-top-up architecture

> Architecture diagram of the GitHub repository virakbothchharn6-tech/sai-project-top-up, 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/virakbothchharn6-tech/sai-project-top-up
- Repository: https://github.com/virakbothchharn6-tech/sai-project-top-up

## Overview

Sai Top-Up is a Laravel API and Vue storefront for game-credit purchases. Customers browse games and packages, verify a player account, create an order with a KHQR code, and check payment status; administrators receive order alerts and approve or reject them through Telegram polling. The graph preserves these documented capabilities, but several frontend and backend implementations were not excerpted, so those connections are shown only where the README or source index supports them. Authentication and user history are not presented as implemented features.

Main entry points: [`backend/routes/api.php`](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/routes/api.php) (API routes), [`backend/app/Http/Controllers/Api/OrderController.php`](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/OrderController.php) (Order lifecycle API), [`frontend/src/views/Home.vue`](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/views/Home.vue) (Game storefront), [`backend/app/Http/Controllers/Api/AccountCheckController.php`](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/AccountCheckController.php) (Account verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_vue_app["Vue application<br/>[App.vue]"]
  node_home["Game storefront<br/>[Home.vue]"]
  node_game_detail["Game details<br/>[GameDetail.vue]"]
  node_router["Page router<br/>[index.js]"]
end

subgraph group_catalog["Catalog and verification"]
  node_api_routes["API routes<br/>[api.php]"]
  node_games_api["Game catalog API<br/>[GameController.php]"]
  node_packages_api["Package API"]
  node_account_check["Account verification"]
  node_nickname_service["Nickname lookup"]
  node_codashop_service["Backup account lookup"]
  node_game_model["Game data<br/>[Game.php]"]
  node_package_model["Package data<br/>[TopUpPackage.php]"]
end

subgraph group_checkout["Orders and payment"]
  node_orders_api["Order lifecycle API"]
  node_order_model["Order data<br/>[Order.php]"]
  node_khqr["KHQR payment service<br/>[KhqrService.php]"]
  node_database[("Application database")]
  node_user_model["User identity model<br/>[User.php]"]
end

subgraph group_operations["Telegram operations"]
  node_telegram_poll["Telegram polling command<br/>[TelegramPoll.php]"]
  node_telegram_service["Telegram service"]
end

node_customer(("Customer"))
node_bakong["Bakong payment"]
node_admin(("Shop administrator"))
node_telegram["Telegram Bot API"]

node_customer -->|"uses"| node_vue_app
node_vue_app -->|"renders routes"| node_router
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_game_detail
node_home -.->|"requests catalog"| node_api_routes
node_game_detail -.->|"requests game data"| node_api_routes
node_api_routes -->|"routes to"| node_games_api
node_api_routes -->|"routes to"| node_packages_api
node_api_routes -->|"routes to"| node_account_check
node_api_routes -->|"routes to"| node_orders_api
node_games_api -->|"queries"| node_game_model
node_packages_api -->|"queries"| node_game_model
node_game_model -->|"relates packages"| node_package_model
node_account_check -->|"looks up name"| node_nickname_service
node_account_check -->|"fallback lookup"| node_codashop_service
node_home -.->|"verifies account"| node_account_check
node_home -.->|"creates and checks order"| node_orders_api
node_orders_api -->|"creates and updates"| node_order_model
node_orders_api -->|"generates and checks"| node_khqr
node_khqr -.->|"checks payment"| node_bakong
node_orders_api -->|"notifies admin"| node_telegram_service
node_telegram_poll -->|"polls updates"| node_telegram_service
node_telegram_poll -->|"handles decisions"| node_order_model
node_telegram_service -->|"calls Bot API"| node_telegram
node_admin -->|"confirms or rejects"| node_telegram
node_order_model -.->|"persists"| node_database
node_game_model -.->|"reads catalog"| node_database

click node_vue_app "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/App.vue"
click node_home "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/views/Home.vue"
click node_game_detail "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/views/GameDetail.vue"
click node_router "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/router/index.js"
click node_api_routes "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/routes/api.php"
click node_games_api "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/GameController.php"
click node_packages_api "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/TopUpPackageController.php"
click node_account_check "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/AccountCheckController.php"
click node_game_model "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/Game.php"
click node_package_model "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/TopUpPackage.php"
click node_orders_api "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/OrderController.php"
click node_order_model "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/Order.php"
click node_khqr "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Services/KhqrService.php"
click node_telegram_poll "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Console/Commands/TelegramPoll.php"
click node_telegram_service "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Services/TelegramService.php"
click node_user_model "https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/User.php"

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_vue_app,node_home,node_game_detail,node_router toneBlue
class node_api_routes,node_games_api,node_packages_api,node_account_check,node_nickname_service,node_codashop_service,node_game_model,node_package_model toneAmber
class node_orders_api,node_order_model,node_khqr,node_database,node_user_model,node_telegram toneMint
class node_telegram_poll,node_telegram_service toneRose
class node_customer,node_bakong,node_admin toneIndigo
```

## Components

### Storefront

- [Vue application](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Game storefront](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/views/Home.vue): `frontend/src/views/Home.vue`
- [Game details](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/views/GameDetail.vue): `frontend/src/views/GameDetail.vue`
- [Page router](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/frontend/src/router/index.js): `frontend/src/router/index.js`

### Catalog and verification

- [API routes](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Game catalog API](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/GameController.php): `backend/app/Http/Controllers/Api/GameController.php`
- [Package API](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/TopUpPackageController.php): `backend/app/Http/Controllers/Api/TopUpPackageController.php`
- [Account verification](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/AccountCheckController.php): `backend/app/Http/Controllers/Api/AccountCheckController.php`
- **Nickname lookup**
- **Backup account lookup**
- [Game data](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/Game.php): `backend/app/Models/Game.php`
- [Package data](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/TopUpPackage.php): `backend/app/Models/TopUpPackage.php`

### Orders and payment

- [Order lifecycle API](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Http/Controllers/Api/OrderController.php): `backend/app/Http/Controllers/Api/OrderController.php`
- [Order data](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/Order.php): `backend/app/Models/Order.php`
- [KHQR payment service](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Services/KhqrService.php): `backend/app/Services/KhqrService.php`
- **Application database**
- [User identity model](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`

### Telegram operations

- [Telegram polling command](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Console/Commands/TelegramPoll.php): `backend/app/Console/Commands/TelegramPoll.php`
- [Telegram service](https://github.com/virakbothchharn6-tech/sai-project-top-up/blob/main/backend/app/Services/TelegramService.php): `backend/app/Services/TelegramService.php`

### Other components

- **Customer**
- **Bakong payment**
- **Shop administrator**
- **Telegram Bot API**

## Connections

- Customer → Vue application: uses (evidence: `README.md`)
- Vue application → Page router: renders routes (evidence: `frontend/src/App.vue`)
- Page router → Game storefront: routes to (evidence: `frontend/src/router/index.js`)
- Page router → Game details: routes to (evidence: `frontend/src/router/index.js`)
- Game storefront → API routes: requests catalog
- Game details → API routes: requests game data
- API routes → Game catalog API: routes to (evidence: `backend/routes/api.php`)
- API routes → Package API: routes to (evidence: `backend/routes/api.php`)
- API routes → Account verification: routes to (evidence: `backend/routes/api.php`)
- API routes → Order lifecycle API: routes to (evidence: `backend/routes/api.php`)
- Game catalog API → Game data: queries (evidence: `backend/app/Http/Controllers/Api/GameController.php`)
- Package API → Game data: queries (evidence: `backend/app/Http/Controllers/Api/TopUpPackageController.php`)
- Game data → Package data: relates packages (evidence: `backend/app/Models/Game.php`)
- Account verification → Nickname lookup: looks up name (evidence: `backend/app/Http/Controllers/Api/AccountCheckController.php`)
- Account verification → Backup account lookup: fallback lookup (evidence: `backend/app/Http/Controllers/Api/AccountCheckController.php`)
- Game storefront → Account verification: verifies account
- Game storefront → Order lifecycle API: creates and checks order
- Order lifecycle API → Order data: creates and updates (evidence: `backend/app/Http/Controllers/Api/OrderController.php`)
- Order lifecycle API → KHQR payment service: generates and checks (evidence: `backend/app/Http/Controllers/Api/OrderController.php`)
- KHQR payment service → Bakong payment: checks payment
- Order lifecycle API → Telegram service: notifies admin (evidence: `backend/app/Http/Controllers/Api/OrderController.php`)
- Telegram polling command → Telegram service: polls updates (evidence: `backend/app/Console/Commands/TelegramPoll.php`)
- Telegram polling command → Order data: handles decisions (evidence: `backend/app/Console/Commands/TelegramPoll.php`)
- Telegram service → Telegram Bot API: calls Bot API (evidence: `backend/app/Services/TelegramService.php`)
- Shop administrator → Telegram Bot API: confirms or rejects (evidence: `README.md`)
- Order data → Application database: persists
- Game data → Application database: reads catalog
