# yongnaykhouch/btn_ltw architecture

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

- Interactive diagram: https://gitdiagram.com/yongnaykhouch/btn_ltw
- Repository: https://github.com/yongnaykhouch/btn_ltw

## Overview

This is a Flask technology-and-appliance commerce site. Customers browse or search products, manage accounts and a cart, then place and track orders; administrators manage catalog, orders, users, and flash sales. The README also identifies installments, reviews, and chatbot support. The graph separates the web app, domain helpers, API, and persisted state. Several links among Python modules are dashed because the supplied excerpts and index do not establish the exact calls; unsampled routes and templates are represented at their existing paths.

Main entry points: [`app.py`](https://github.com/yongnaykhouch/btn_ltw/blob/main/app.py) (Web application), [`templates`](https://github.com/yongnaykhouch/btn_ltw/tree/main/templates) (Storefront pages), [`chatbot.py`](https://github.com/yongnaykhouch/btn_ltw/blob/main/chatbot.py) (Shopping chatbot), [`api.py`](https://github.com/yongnaykhouch/btn_ltw/blob/main/api.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront and administration"]
  node_flask_app["Web application<br/>[app.py]"]
  node_storefront["Storefront pages"]
  node_admin_ui["Admin pages<br/>[Admin.html]"]
  node_chat_widget["Support chat UI"]
  node_alternate_app["Additional Flask app<br/>[btn.py]"]
end

subgraph group_domain["Commerce capabilities"]
  node_catalog_search["Product search<br/>[search_engine.py]"]
  node_product_specs["Extra specifications"]
  node_flash_logic["Flash sale logic<br/>[flash_sales.py]"]
  node_chatbot_logic["Shopping chatbot<br/>[chatbot.py]"]
  node_flash_ui["Sale countdown<br/>[flash_sale.js]"]
  node_review_ui["Live reviews<br/>[review-live.js]"]
end

subgraph group_api["JSON API"]
  node_rest_api["REST API<br/>[api.py]"]
  node_api_client["Python API client<br/>[api_client.py]"]
end

subgraph group_state["Persistent state"]
  node_sqlite[("SQLite commerce data<br/>[users.db]")]
end

node_customer(("Customer"))
node_admin_actor(("Administrator"))
node_support_service["Optional chat service"]

node_customer -->|"browses and orders"| node_flask_app
node_admin_actor -->|"manages commerce"| node_flask_app
node_flask_app -->|"renders pages"| node_storefront
node_flask_app -->|"renders admin"| node_admin_ui
node_flask_app -->|"reads and writes"| node_sqlite
node_alternate_app -.->|"reads and writes"| node_sqlite
node_flask_app -.->|"uses search"| node_catalog_search
node_flask_app -.->|"uses specs"| node_product_specs
node_flask_app -.->|"checks sales"| node_flash_logic
node_flask_app -.->|"handles chat"| node_chatbot_logic
node_chatbot_logic -.->|"searches products"| node_catalog_search
node_chatbot_logic -.->|"reads specifications"| node_product_specs
node_flask_app -.->|"registers API"| node_rest_api
node_api_client -->|"sends requests"| node_rest_api
node_rest_api -->|"reads and writes"| node_sqlite
node_storefront -.->|"shows countdown"| node_flash_ui
node_storefront -.->|"refreshes reviews"| node_review_ui
node_storefront -.->|"includes widget"| node_chat_widget
node_chat_widget -.->|"connects optionally"| node_support_service

click node_flask_app "https://github.com/yongnaykhouch/btn_ltw/blob/main/app.py"
click node_storefront "https://github.com/yongnaykhouch/btn_ltw/tree/main/templates"
click node_admin_ui "https://github.com/yongnaykhouch/btn_ltw/blob/main/templates/Admin.html"
click node_chat_widget "https://github.com/yongnaykhouch/btn_ltw/blob/main/templates/partials/support_chat_widget.html"
click node_alternate_app "https://github.com/yongnaykhouch/btn_ltw/blob/main/btn.py"
click node_catalog_search "https://github.com/yongnaykhouch/btn_ltw/blob/main/search_engine.py"
click node_product_specs "https://github.com/yongnaykhouch/btn_ltw/blob/main/product_extra_specs.py"
click node_flash_logic "https://github.com/yongnaykhouch/btn_ltw/blob/main/flash_sales.py"
click node_chatbot_logic "https://github.com/yongnaykhouch/btn_ltw/blob/main/chatbot.py"
click node_flash_ui "https://github.com/yongnaykhouch/btn_ltw/blob/main/static/flash_sale.js"
click node_review_ui "https://github.com/yongnaykhouch/btn_ltw/blob/main/static/review-live.js"
click node_rest_api "https://github.com/yongnaykhouch/btn_ltw/blob/main/api.py"
click node_api_client "https://github.com/yongnaykhouch/btn_ltw/blob/main/api_client.py"
click node_sqlite "https://github.com/yongnaykhouch/btn_ltw/blob/main/users.db"

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_flask_app,node_storefront,node_admin_ui,node_chat_widget,node_alternate_app toneBlue
class node_catalog_search,node_product_specs,node_flash_logic,node_chatbot_logic,node_flash_ui,node_review_ui toneAmber
class node_rest_api,node_api_client toneMint
class node_sqlite toneRose
class node_customer,node_admin_actor,node_support_service toneIndigo
```

## Components

### Storefront and administration

- [Web application](https://github.com/yongnaykhouch/btn_ltw/blob/main/app.py): `app.py`
- [Storefront pages](https://github.com/yongnaykhouch/btn_ltw/tree/main/templates): `templates`
- [Admin pages](https://github.com/yongnaykhouch/btn_ltw/blob/main/templates/Admin.html): `templates/Admin.html`
- [Support chat UI](https://github.com/yongnaykhouch/btn_ltw/blob/main/templates/partials/support_chat_widget.html): `templates/partials/support_chat_widget.html`
- [Additional Flask app](https://github.com/yongnaykhouch/btn_ltw/blob/main/btn.py): `btn.py`

### Commerce capabilities

- [Product search](https://github.com/yongnaykhouch/btn_ltw/blob/main/search_engine.py): `search_engine.py`
- [Extra specifications](https://github.com/yongnaykhouch/btn_ltw/blob/main/product_extra_specs.py): `product_extra_specs.py`
- [Flash sale logic](https://github.com/yongnaykhouch/btn_ltw/blob/main/flash_sales.py): `flash_sales.py`
- [Shopping chatbot](https://github.com/yongnaykhouch/btn_ltw/blob/main/chatbot.py): `chatbot.py`
- [Sale countdown](https://github.com/yongnaykhouch/btn_ltw/blob/main/static/flash_sale.js): `static/flash_sale.js`
- [Live reviews](https://github.com/yongnaykhouch/btn_ltw/blob/main/static/review-live.js): `static/review-live.js`

### JSON API

- [REST API](https://github.com/yongnaykhouch/btn_ltw/blob/main/api.py): `api.py`
- [Python API client](https://github.com/yongnaykhouch/btn_ltw/blob/main/api_client.py): `api_client.py`

### Persistent state

- [SQLite commerce data](https://github.com/yongnaykhouch/btn_ltw/blob/main/users.db): `users.db`

### Other components

- **Customer**
- **Administrator**
- **Optional chat service**

## Connections

- Customer → Web application: browses and orders (evidence: `README.md`)
- Administrator → Web application: manages commerce (evidence: `README.md`)
- Web application → Storefront pages: renders pages (evidence: `README.md`)
- Web application → Admin pages: renders admin (evidence: `README.md`)
- Web application → SQLite commerce data: reads and writes (evidence: `app.py`)
- Additional Flask app → SQLite commerce data: reads and writes
- Web application → Product search: uses search (evidence: `app.py`)
- Web application → Extra specifications: uses specs (evidence: `app.py`)
- Web application → Flash sale logic: checks sales (evidence: `app.py`)
- Web application → Shopping chatbot: handles chat (evidence: `app.py`)
- Shopping chatbot → Product search: searches products (evidence: `chatbot.py`)
- Shopping chatbot → Extra specifications: reads specifications (evidence: `chatbot.py`)
- Web application → REST API: registers API (evidence: `app.py`)
- Python API client → REST API: sends requests (evidence: `api_client.py`)
- REST API → SQLite commerce data: reads and writes (evidence: `api.py`)
- Storefront pages → Sale countdown: shows countdown
- Storefront pages → Live reviews: refreshes reviews
- Storefront pages → Support chat UI: includes widget
- Support chat UI → Optional chat service: connects optionally (evidence: `README.md`)
