# aforant13/kavd architecture

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

- Interactive diagram: https://gitdiagram.com/aforant13/kavd
- Repository: https://github.com/aforant13/kavd

## Overview

KAVD! is a PHP storefront for browsing apparel, managing customer accounts and carts, and placing orders with cash-on-delivery or manually verified UPI/QR payment. The main workflow is product discovery (shop, search, detail), cart and checkout, order creation, then confirmation and account order history. PHP pages combine presentation and application behavior; shared backend modules provide database access, shipping rules, and payment configuration. The checkout-to-order request and database usage are evidenced in excerpts; other product pages and informational content are represented from the file tree, so their internal links are omitted where implementation evidence is unavailable.

Main entry points: [`backend/db.php`](https://github.com/aforant13/kavd/blob/main/backend/db.php) (Commerce database), [`checkout.php`](https://github.com/aforant13/kavd/blob/main/checkout.php) (Checkout), [`backend/place_order.php`](https://github.com/aforant13/kavd/blob/main/backend/place_order.php) (Order placement), [`order-success.php`](https://github.com/aforant13/kavd/blob/main/order-success.php) (Order confirmation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Storefront home<br/>[index.html]"]
  node_catalog["Product catalog<br/>[shop.php]"]
  node_search["Product search<br/>[search.php]"]
  node_product["Product detail<br/>[product.php]"]
  node_help["Store help pages<br/>[support.html]"]
end

subgraph group_identity["Customer accounts"]
  node_account["Account and orders<br/>[account.php]"]
  node_login["Sign in<br/>[login.php]"]
  node_register["Registration<br/>[register.php]"]
  node_logout["Sign out<br/>[logout.php]"]
end

subgraph group_commerce["Cart and orders"]
  node_cart["Shopping cart<br/>[cart.php]"]
  node_checkout["Checkout<br/>[checkout.php]"]
  node_order_api["Order placement<br/>[place_order.php]"]
  node_confirmation["Order confirmation<br/>[order-success.php]"]
  node_browser["Browser cart state<br/>[cart.php]"]
end

subgraph group_services["Backend services"]
  node_database[("Commerce database<br/>[db.php]")]
  node_shipping["Shipping rules<br/>[order_config.php]"]
  node_payment["UPI configuration<br/>[payment_config.php]"]
  node_demo_seed["Demo catalog seeding<br/>[seed_demo.php]"]
end

node_customer(("Customer"))
node_payment_provider(("Payment provider"))

node_customer -->|"browses"| node_home
node_customer -->|"browses"| node_catalog
node_customer -->|"searches"| node_search
node_customer -->|"views"| node_product
node_customer -->|"manages"| node_cart
node_customer -->|"checks out"| node_checkout
node_customer -->|"signs in"| node_login
node_customer -->|"registers"| node_register
node_catalog -->|"queries products"| node_database
node_search -->|"queries products"| node_database
node_product -->|"loads product"| node_database
node_checkout -->|"loads data"| node_database
node_checkout -->|"uses rates"| node_shipping
node_checkout -->|"reads settings"| node_payment
node_checkout -->|"posts order"| node_order_api
node_order_api -->|"creates order"| node_database
node_order_api -->|"calculates shipping"| node_shipping
node_order_api -->|"reads settings"| node_payment
node_cart -->|"uses rates"| node_shipping
node_cart -->|"stores cart"| node_browser
node_checkout -->|"reads cart"| node_browser
node_order_api -.->|"returns order result"| node_confirmation
node_confirmation -->|"loads order"| node_database
node_confirmation -->|"uses UPI details"| node_payment
node_confirmation -.->|"presents payment option"| node_payment_provider
node_account -->|"loads account data"| node_database
node_account -->|"links sign out"| node_logout
node_login -->|"checks credentials"| node_database
node_register -->|"stores account"| node_database
node_demo_seed -->|"seeds products"| node_database

click node_home "https://github.com/aforant13/kavd/blob/main/index.html"
click node_catalog "https://github.com/aforant13/kavd/blob/main/shop.php"
click node_search "https://github.com/aforant13/kavd/blob/main/search.php"
click node_product "https://github.com/aforant13/kavd/blob/main/product.php"
click node_help "https://github.com/aforant13/kavd/blob/main/support.html"
click node_cart "https://github.com/aforant13/kavd/blob/main/cart.php"
click node_checkout "https://github.com/aforant13/kavd/blob/main/checkout.php"
click node_order_api "https://github.com/aforant13/kavd/blob/main/backend/place_order.php"
click node_confirmation "https://github.com/aforant13/kavd/blob/main/order-success.php"
click node_account "https://github.com/aforant13/kavd/blob/main/account.php"
click node_login "https://github.com/aforant13/kavd/blob/main/login.php"
click node_register "https://github.com/aforant13/kavd/blob/main/register.php"
click node_logout "https://github.com/aforant13/kavd/blob/main/logout.php"
click node_database "https://github.com/aforant13/kavd/blob/main/backend/db.php"
click node_shipping "https://github.com/aforant13/kavd/blob/main/backend/order_config.php"
click node_payment "https://github.com/aforant13/kavd/blob/main/backend/payment_config.php"
click node_demo_seed "https://github.com/aforant13/kavd/blob/main/backend/seed_demo.php"
click node_browser "https://github.com/aforant13/kavd/blob/main/cart.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_search,node_product,node_help toneBlue
class node_account,node_login,node_register,node_logout toneAmber
class node_cart,node_checkout,node_order_api,node_confirmation,node_browser toneMint
class node_database,node_shipping,node_payment,node_demo_seed toneRose
class node_customer,node_payment_provider toneIndigo
```

## Components

### Storefront

- [Storefront home](https://github.com/aforant13/kavd/blob/main/index.html): `index.html`
- [Product catalog](https://github.com/aforant13/kavd/blob/main/shop.php): `shop.php`
- [Product search](https://github.com/aforant13/kavd/blob/main/search.php): `search.php`
- [Product detail](https://github.com/aforant13/kavd/blob/main/product.php): `product.php`
- [Store help pages](https://github.com/aforant13/kavd/blob/main/support.html): `support.html`

### Customer accounts

- [Account and orders](https://github.com/aforant13/kavd/blob/main/account.php): `account.php`
- [Sign in](https://github.com/aforant13/kavd/blob/main/login.php): `login.php`
- [Registration](https://github.com/aforant13/kavd/blob/main/register.php): `register.php`
- [Sign out](https://github.com/aforant13/kavd/blob/main/logout.php): `logout.php`

### Cart and orders

- [Shopping cart](https://github.com/aforant13/kavd/blob/main/cart.php): `cart.php`
- [Checkout](https://github.com/aforant13/kavd/blob/main/checkout.php): `checkout.php`
- [Order placement](https://github.com/aforant13/kavd/blob/main/backend/place_order.php): `backend/place_order.php`
- [Order confirmation](https://github.com/aforant13/kavd/blob/main/order-success.php): `order-success.php`
- [Browser cart state](https://github.com/aforant13/kavd/blob/main/cart.php): `cart.php`

### Backend services

- [Commerce database](https://github.com/aforant13/kavd/blob/main/backend/db.php): `backend/db.php`
- [Shipping rules](https://github.com/aforant13/kavd/blob/main/backend/order_config.php): `backend/order_config.php`
- [UPI configuration](https://github.com/aforant13/kavd/blob/main/backend/payment_config.php): `backend/payment_config.php`
- [Demo catalog seeding](https://github.com/aforant13/kavd/blob/main/backend/seed_demo.php): `backend/seed_demo.php`

### Other components

- **Customer**
- **Payment provider**

## Connections

- Customer → Storefront home: browses
- Customer → Product catalog: browses
- Customer → Product search: searches (evidence: `search.php`)
- Customer → Product detail: views (evidence: `product.php`)
- Customer → Shopping cart: manages (evidence: `cart.php`)
- Customer → Checkout: checks out (evidence: `checkout.php`)
- Customer → Sign in: signs in
- Customer → Registration: registers
- Product catalog → Commerce database: queries products (evidence: `shop.php`)
- Product search → Commerce database: queries products (evidence: `search.php`)
- Product detail → Commerce database: loads product (evidence: `product.php`)
- Checkout → Commerce database: loads data (evidence: `checkout.php`)
- Checkout → Shipping rules: uses rates (evidence: `checkout.php`)
- Checkout → UPI configuration: reads settings (evidence: `checkout.php`)
- Checkout → Order placement: posts order (evidence: `checkout.php`)
- Order placement → Commerce database: creates order (evidence: `backend/place_order.php`)
- Order placement → Shipping rules: calculates shipping (evidence: `backend/place_order.php`)
- Order placement → UPI configuration: reads settings (evidence: `backend/place_order.php`)
- Shopping cart → Shipping rules: uses rates (evidence: `cart.php`)
- Shopping cart → Browser cart state: stores cart (evidence: `cart.php`)
- Checkout → Browser cart state: reads cart (evidence: `checkout.php`)
- Order placement → Order confirmation: returns order result
- Order confirmation → Commerce database: loads order (evidence: `order-success.php`)
- Order confirmation → UPI configuration: uses UPI details (evidence: `order-success.php`)
- Order confirmation → Payment provider: presents payment option
- Account and orders → Commerce database: loads account data (evidence: `account.php`)
- Account and orders → Sign out: links sign out (evidence: `account.php`)
- Sign in → Commerce database: checks credentials (evidence: `login.php`)
- Registration → Commerce database: stores account (evidence: `register.php`)
- Demo catalog seeding → Commerce database: seeds products (evidence: `backend/seed_demo.php`)
