# 24211tt2979-cmd/be_project architecture

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

- Interactive diagram: https://gitdiagram.com/24211tt2979-cmd/be_project
- Repository: https://github.com/24211tt2979-cmd/be_project

## Overview

NHK Mobile is a phone-commerce storefront with customer account, purchase, and after-sales features, plus an administration area. The primary customer journey runs from browsing products to cart and checkout, with payment updates handled by a webhook; account, comparison, and support features form related branches. The source index supports several shared-component links, but the README is empty and many routes were not sampled, so links to unsampled features are omitted rather than inferred.

Main entry points: [`includes/db.php`](https://github.com/24211tt2979-cmd/be_project/blob/main/includes/db.php) (Commerce database), [`cart.php`](https://github.com/24211tt2979-cmd/be_project/blob/main/cart.php) (Shopping cart), [`checkout.php`](https://github.com/24211tt2979-cmd/be_project/blob/main/checkout.php) (Checkout), [`index.php`](https://github.com/24211tt2979-cmd/be_project/blob/main/index.php) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Storefront"]
  node_home["Home page<br/>[index.php]"]
  node_catalog["Product catalog<br/>[product.php]"]
  node_product_detail["Product details<br/>[product-detail.php]"]
  node_search_filter["Search and filters"]
  node_news["News<br/>[news.php]"]
end

subgraph group_commerce["Commerce"]
  node_cart["Shopping cart<br/>[cart.php]"]
  node_checkout["Checkout<br/>[checkout.php]"]
  node_payment_hook["Payment webhook<br/>[payos_webhook.php]"]
end

subgraph group_customer["Customer services"]
  node_account["Account profile<br/>[profile.php]"]
  node_wishlist_compare["Wishlist and compare<br/>[wishlist.php]"]
  node_reviews["Product reviews<br/>[reviews.php]"]
  node_returns["Return requests<br/>[return_request.php]"]
  node_warranty["Warranty lookup<br/>[warranty.php]"]
end

subgraph group_admin["Administration"]
  node_admin_auth["Admin access control<br/>[admin_auth.php]"]
  node_admin_ops["Store administration<br/>[products.php]"]
  node_admin_orders["Order management<br/>[orders.php]"]
  node_admin_insights["Revenue reporting<br/>[revenue.php]"]
end

subgraph group_core["Shared services"]
  node_database[("Commerce database<br/>[db.php]")]
  node_auth["Authentication services<br/>[auth_functions.php]"]
  node_cart_logic["Cart operations<br/>[cart_functions.php]"]
  node_site_shell["Shared site interface<br/>[header.php]"]
  node_email["Email transport<br/>[PHPMailer.php]"]
end

node_visitor(("Shopper"))

node_visitor -->|"opens"| node_home
node_home -->|"browses"| node_catalog
node_catalog -->|"opens details"| node_product_detail
node_visitor -->|"manages cart"| node_cart
node_cart -->|"uses"| node_cart_logic
node_cart -->|"proceeds to"| node_checkout
node_checkout -->|"uses"| node_cart_logic
node_cart -->|"reads and writes"| node_database
node_checkout -->|"reads and writes"| node_database
node_payment_hook -->|"updates orders"| node_database
node_visitor -->|"manages account"| node_account
node_visitor -->|"saves and compares"| node_wishlist_compare
node_visitor -->|"reviews products"| node_reviews
node_visitor -->|"requests return"| node_returns
node_visitor -->|"checks coverage"| node_warranty
node_search_filter -->|"queries products"| node_database
node_reviews -->|"reads and writes"| node_database
node_returns -->|"records requests"| node_database
node_warranty -.->|"looks up coverage"| node_database
node_account -->|"uses"| node_auth
node_cart -->|"uses"| node_auth
node_home -->|"renders with"| node_site_shell
node_visitor -->|"administers store"| node_admin_ops
node_admin_ops -->|"requires"| node_admin_auth
node_admin_ops -->|"manages products"| node_database
node_admin_orders -->|"requires"| node_admin_auth
node_admin_orders -->|"manages orders"| node_database
node_admin_insights -->|"requires"| node_admin_auth
node_admin_insights -->|"queries revenue"| node_database
node_checkout -.->|"uses"| node_email

click node_home "https://github.com/24211tt2979-cmd/be_project/blob/main/index.php"
click node_catalog "https://github.com/24211tt2979-cmd/be_project/blob/main/product.php"
click node_product_detail "https://github.com/24211tt2979-cmd/be_project/blob/main/product-detail.php"
click node_search_filter "https://github.com/24211tt2979-cmd/be_project/blob/main/api/filter_products.php"
click node_cart "https://github.com/24211tt2979-cmd/be_project/blob/main/cart.php"
click node_checkout "https://github.com/24211tt2979-cmd/be_project/blob/main/checkout.php"
click node_payment_hook "https://github.com/24211tt2979-cmd/be_project/blob/main/api/payos_webhook.php"
click node_account "https://github.com/24211tt2979-cmd/be_project/blob/main/profile.php"
click node_wishlist_compare "https://github.com/24211tt2979-cmd/be_project/blob/main/api/wishlist.php"
click node_reviews "https://github.com/24211tt2979-cmd/be_project/blob/main/api/reviews.php"
click node_returns "https://github.com/24211tt2979-cmd/be_project/blob/main/return_request.php"
click node_warranty "https://github.com/24211tt2979-cmd/be_project/blob/main/warranty.php"
click node_news "https://github.com/24211tt2979-cmd/be_project/blob/main/news.php"
click node_database "https://github.com/24211tt2979-cmd/be_project/blob/main/includes/db.php"
click node_auth "https://github.com/24211tt2979-cmd/be_project/blob/main/includes/auth_functions.php"
click node_cart_logic "https://github.com/24211tt2979-cmd/be_project/blob/main/includes/cart_functions.php"
click node_site_shell "https://github.com/24211tt2979-cmd/be_project/blob/main/includes/header.php"
click node_admin_auth "https://github.com/24211tt2979-cmd/be_project/blob/main/admin/admin_auth.php"
click node_admin_ops "https://github.com/24211tt2979-cmd/be_project/blob/main/admin/products.php"
click node_admin_orders "https://github.com/24211tt2979-cmd/be_project/blob/main/admin/orders.php"
click node_admin_insights "https://github.com/24211tt2979-cmd/be_project/blob/main/admin/revenue.php"
click node_email "https://github.com/24211tt2979-cmd/be_project/blob/main/php/phpmailer/src/PHPMailer.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_home,node_catalog,node_product_detail,node_search_filter,node_news toneBlue
class node_cart,node_checkout,node_payment_hook toneAmber
class node_account,node_wishlist_compare,node_reviews,node_returns,node_warranty toneMint
class node_admin_auth,node_admin_ops,node_admin_orders,node_admin_insights toneRose
class node_database,node_auth,node_cart_logic,node_site_shell,node_email,node_visitor toneIndigo
```

## Components

### Storefront

- [Home page](https://github.com/24211tt2979-cmd/be_project/blob/main/index.php): `index.php`
- [Product catalog](https://github.com/24211tt2979-cmd/be_project/blob/main/product.php): `product.php`
- [Product details](https://github.com/24211tt2979-cmd/be_project/blob/main/product-detail.php): `product-detail.php`
- [Search and filters](https://github.com/24211tt2979-cmd/be_project/blob/main/api/filter_products.php): `api/filter_products.php`
- [News](https://github.com/24211tt2979-cmd/be_project/blob/main/news.php): `news.php`

### Commerce

- [Shopping cart](https://github.com/24211tt2979-cmd/be_project/blob/main/cart.php): `cart.php`
- [Checkout](https://github.com/24211tt2979-cmd/be_project/blob/main/checkout.php): `checkout.php`
- [Payment webhook](https://github.com/24211tt2979-cmd/be_project/blob/main/api/payos_webhook.php): `api/payos_webhook.php`

### Customer services

- [Account profile](https://github.com/24211tt2979-cmd/be_project/blob/main/profile.php): `profile.php`
- [Wishlist and compare](https://github.com/24211tt2979-cmd/be_project/blob/main/api/wishlist.php): `api/wishlist.php`
- [Product reviews](https://github.com/24211tt2979-cmd/be_project/blob/main/api/reviews.php): `api/reviews.php`
- [Return requests](https://github.com/24211tt2979-cmd/be_project/blob/main/return_request.php): `return_request.php`
- [Warranty lookup](https://github.com/24211tt2979-cmd/be_project/blob/main/warranty.php): `warranty.php`

### Administration

- [Admin access control](https://github.com/24211tt2979-cmd/be_project/blob/main/admin/admin_auth.php): `admin/admin_auth.php`
- [Store administration](https://github.com/24211tt2979-cmd/be_project/blob/main/admin/products.php): `admin/products.php`
- [Order management](https://github.com/24211tt2979-cmd/be_project/blob/main/admin/orders.php): `admin/orders.php`
- [Revenue reporting](https://github.com/24211tt2979-cmd/be_project/blob/main/admin/revenue.php): `admin/revenue.php`

### Shared services

- [Commerce database](https://github.com/24211tt2979-cmd/be_project/blob/main/includes/db.php): `includes/db.php`
- [Authentication services](https://github.com/24211tt2979-cmd/be_project/blob/main/includes/auth_functions.php): `includes/auth_functions.php`
- [Cart operations](https://github.com/24211tt2979-cmd/be_project/blob/main/includes/cart_functions.php): `includes/cart_functions.php`
- [Shared site interface](https://github.com/24211tt2979-cmd/be_project/blob/main/includes/header.php): `includes/header.php`
- [Email transport](https://github.com/24211tt2979-cmd/be_project/blob/main/php/phpmailer/src/PHPMailer.php): `php/phpmailer/src/PHPMailer.php`

### Other components

- **Shopper**

## Connections

- Shopper → Home page: opens
- Home page → Product catalog: browses (evidence: `index.php`)
- Product catalog → Product details: opens details (evidence: `product.php`)
- Shopper → Shopping cart: manages cart
- Shopping cart → Cart operations: uses (evidence: `cart.php`)
- Shopping cart → Checkout: proceeds to (evidence: `cart.php`)
- Checkout → Cart operations: uses (evidence: `checkout.php`)
- Shopping cart → Commerce database: reads and writes (evidence: `cart.php`)
- Checkout → Commerce database: reads and writes (evidence: `checkout.php`)
- Payment webhook → Commerce database: updates orders (evidence: `api/payos_webhook.php`)
- Shopper → Account profile: manages account
- Shopper → Wishlist and compare: saves and compares
- Shopper → Product reviews: reviews products
- Shopper → Return requests: requests return
- Shopper → Warranty lookup: checks coverage
- Search and filters → Commerce database: queries products (evidence: `api/filter_products.php`)
- Product reviews → Commerce database: reads and writes (evidence: `api/reviews.php`)
- Return requests → Commerce database: records requests (evidence: `return_request.php`)
- Warranty lookup → Commerce database: looks up coverage
- Account profile → Authentication services: uses (evidence: `profile.php`)
- Shopping cart → Authentication services: uses (evidence: `cart.php`)
- Home page → Shared site interface: renders with (evidence: `index.php`)
- Shopper → Store administration: administers store
- Store administration → Admin access control: requires (evidence: `admin/products.php`)
- Store administration → Commerce database: manages products (evidence: `admin/products.php`)
- Order management → Admin access control: requires (evidence: `admin/orders.php`)
- Order management → Commerce database: manages orders (evidence: `admin/orders.php`)
- Revenue reporting → Admin access control: requires (evidence: `admin/revenue.php`)
- Revenue reporting → Commerce database: queries revenue (evidence: `admin/revenue.php`)
- Checkout → Email transport: uses (evidence: `checkout.php`)
