# duongnotnhan/alihaiba architecture

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

- Interactive diagram: https://gitdiagram.com/duongnotnhan/alihaiba
- Repository: https://github.com/duongnotnhan/alihaiba

## Overview

AliHaiBa is a browser-based storefront with product browsing, account flows, a shopping cart and demo checkout. Users interact with page controls; `js/main.js` handles page events and initializes the cart and product listing, while feature modules render and update the interface. Accounts, cart contents and favorites use browser storage. The tree also includes Bootstrap and Font Awesome runtime assets. HTML script wiring and several module implementations were not shown, so relationships requiring those details are omitted.

Main entry points: [`js/main.js`](https://github.com/duongnotnhan/alihaiba/blob/main/js/main.js) (Page events), [`js/auth.js`](https://github.com/duongnotnhan/alihaiba/blob/main/js/auth.js) (Account flows), [`js/cart.js`](https://github.com/duongnotnhan/alihaiba/blob/main/js/cart.js) (Cart and checkout), [`js/layout.js`](https://github.com/duongnotnhan/alihaiba/blob/main/js/layout.js) (Shared layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront flows"]
  node_events["Page events<br/>[main.js]"]
  node_accounts["Account flows<br/>[auth.js]"]
  node_cart["Cart and checkout<br/>[cart.js]"]
  node_browserstore[("Browser storage<br/>[storage.js]")]
  node_forms["Form handling<br/>[forms.js]"]
end

subgraph group_catalog["Catalog and content"]
  node_catalogdata["Product data<br/>[data.js]"]
  node_productlisting["Product listing<br/>[products.js]"]
  node_sharedlayout["Shared layout<br/>[layout.js]"]
  node_home["Home page<br/>[index.html]"]
  node_productpage["Products page<br/>[products.html]"]
  node_about["About page<br/>[about.html]"]
  node_contact["Contact page<br/>[contact.html]"]
end

subgraph group_vendor["UI libraries"]
  node_bootstrapbundle["Bootstrap bundle"]
  node_bootstrapesm["Bootstrap ESM<br/>[bootstrap.esm.js]"]
  node_bootstrapjs["Bootstrap JS<br/>[bootstrap.js]"]
  node_faengine["Font Awesome engine<br/>[fontawesome.js]"]
  node_faregular["Regular icons<br/>[regular.js]"]
  node_fashims["Legacy icon shims<br/>[v4-shims.js]"]
  node_faconflicts["Icon conflict checks"]
end

node_shopper(("Shopper"))

node_shopper -->|"triggers events"| node_events
node_events -->|"handles cart actions"| node_cart
node_events -->|"opens account"| node_accounts
node_events -->|"renders products"| node_productlisting
node_events -->|"renders cart root"| node_sharedlayout
node_cart -->|"looks up products"| node_catalogdata
node_cart -->|"reads and writes"| node_browserstore
node_accounts -->|"reads and writes"| node_browserstore
node_sharedlayout -->|"checks current user"| node_accounts
node_sharedlayout -->|"renders cart"| node_cart
node_accounts -.->|"uses modal API"| node_bootstrapbundle

click node_events "https://github.com/duongnotnhan/alihaiba/blob/main/js/main.js"
click node_accounts "https://github.com/duongnotnhan/alihaiba/blob/main/js/auth.js"
click node_cart "https://github.com/duongnotnhan/alihaiba/blob/main/js/cart.js"
click node_browserstore "https://github.com/duongnotnhan/alihaiba/blob/main/js/storage.js"
click node_forms "https://github.com/duongnotnhan/alihaiba/blob/main/js/forms.js"
click node_catalogdata "https://github.com/duongnotnhan/alihaiba/blob/main/js/data.js"
click node_productlisting "https://github.com/duongnotnhan/alihaiba/blob/main/js/products.js"
click node_sharedlayout "https://github.com/duongnotnhan/alihaiba/blob/main/js/layout.js"
click node_home "https://github.com/duongnotnhan/alihaiba/blob/main/index.html"
click node_productpage "https://github.com/duongnotnhan/alihaiba/blob/main/products.html"
click node_about "https://github.com/duongnotnhan/alihaiba/blob/main/about.html"
click node_contact "https://github.com/duongnotnhan/alihaiba/blob/main/contact.html"
click node_bootstrapbundle "https://github.com/duongnotnhan/alihaiba/blob/main/css/bootstrap-5.3.8-dist/js/bootstrap.bundle.js"
click node_bootstrapesm "https://github.com/duongnotnhan/alihaiba/blob/main/css/bootstrap-5.3.8-dist/js/bootstrap.esm.js"
click node_bootstrapjs "https://github.com/duongnotnhan/alihaiba/blob/main/css/bootstrap-5.3.8-dist/js/bootstrap.js"
click node_faengine "https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/fontawesome.js"
click node_faregular "https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/regular.js"
click node_fashims "https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/v4-shims.js"
click node_faconflicts "https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/conflict-detection.js"

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_events,node_accounts,node_cart,node_browserstore,node_forms toneBlue
class node_catalogdata,node_productlisting,node_sharedlayout,node_home,node_productpage,node_about,node_contact toneAmber
class node_bootstrapbundle,node_bootstrapesm,node_bootstrapjs,node_faengine,node_faregular,node_fashims,node_faconflicts toneMint
class node_shopper toneIndigo
```

## Components

### Storefront flows

- [Page events](https://github.com/duongnotnhan/alihaiba/blob/main/js/main.js): `js/main.js`
- [Account flows](https://github.com/duongnotnhan/alihaiba/blob/main/js/auth.js): `js/auth.js`
- [Cart and checkout](https://github.com/duongnotnhan/alihaiba/blob/main/js/cart.js): `js/cart.js`
- [Browser storage](https://github.com/duongnotnhan/alihaiba/blob/main/js/storage.js): `js/storage.js`
- [Form handling](https://github.com/duongnotnhan/alihaiba/blob/main/js/forms.js): `js/forms.js`

### Catalog and content

- [Product data](https://github.com/duongnotnhan/alihaiba/blob/main/js/data.js): `js/data.js`
- [Product listing](https://github.com/duongnotnhan/alihaiba/blob/main/js/products.js): `js/products.js`
- [Shared layout](https://github.com/duongnotnhan/alihaiba/blob/main/js/layout.js): `js/layout.js`
- [Home page](https://github.com/duongnotnhan/alihaiba/blob/main/index.html): `index.html`
- [Products page](https://github.com/duongnotnhan/alihaiba/blob/main/products.html): `products.html`
- [About page](https://github.com/duongnotnhan/alihaiba/blob/main/about.html): `about.html`
- [Contact page](https://github.com/duongnotnhan/alihaiba/blob/main/contact.html): `contact.html`

### UI libraries

- [Bootstrap bundle](https://github.com/duongnotnhan/alihaiba/blob/main/css/bootstrap-5.3.8-dist/js/bootstrap.bundle.js): `css/bootstrap-5.3.8-dist/js/bootstrap.bundle.js`
- [Bootstrap ESM](https://github.com/duongnotnhan/alihaiba/blob/main/css/bootstrap-5.3.8-dist/js/bootstrap.esm.js): `css/bootstrap-5.3.8-dist/js/bootstrap.esm.js`
- [Bootstrap JS](https://github.com/duongnotnhan/alihaiba/blob/main/css/bootstrap-5.3.8-dist/js/bootstrap.js): `css/bootstrap-5.3.8-dist/js/bootstrap.js`
- [Font Awesome engine](https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/fontawesome.js): `css/fontawesome/js/fontawesome.js`
- [Regular icons](https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/regular.js): `css/fontawesome/js/regular.js`
- [Legacy icon shims](https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/v4-shims.js): `css/fontawesome/js/v4-shims.js`
- [Icon conflict checks](https://github.com/duongnotnhan/alihaiba/blob/main/css/fontawesome/js/conflict-detection.js): `css/fontawesome/js/conflict-detection.js`

### Other components

- **Shopper**

## Connections

- Shopper → Page events: triggers events (evidence: `js/main.js`)
- Page events → Cart and checkout: handles cart actions (evidence: `js/main.js`)
- Page events → Account flows: opens account (evidence: `js/main.js`)
- Page events → Product listing: renders products (evidence: `js/main.js`)
- Page events → Shared layout: renders cart root (evidence: `js/main.js`)
- Cart and checkout → Product data: looks up products (evidence: `js/cart.js`)
- Cart and checkout → Browser storage: reads and writes (evidence: `js/cart.js`)
- Account flows → Browser storage: reads and writes (evidence: `js/auth.js`)
- Shared layout → Account flows: checks current user (evidence: `js/layout.js`)
- Shared layout → Cart and checkout: renders cart (evidence: `js/layout.js`)
- Account flows → Bootstrap bundle: uses modal API (evidence: `js/auth.js`)
