# dan-tez/gift-hub architecture

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

- Interactive diagram: https://gitdiagram.com/dan-tez/gift-hub
- Repository: https://github.com/dan-tez/gift-hub

## Overview

Gift Hub is a client-side gift-shopping site. Shoppers browse a dynamically rendered catalog, add products to a browser-persisted cart, optionally assemble a custom basket, then review and submit a simulated checkout. The graph separates catalog/storefront, cart and basket, and checkout stages, with shared navigation and informational pages as a supporting UI layer. Checkout does not connect to a real payment service. Some page wiring is documented but its HTML was not sampled, so those links rely on the README or are omitted.

Main entry points: [`Js/script.js`](https://github.com/dan-tez/gift-hub/blob/main/Js/script.js) (Dynamic Storefront), [`Js/checkout.js`](https://github.com/dan-tez/gift-hub/blob/main/Js/checkout.js) (Checkout Logic), [`Js/builder.js`](https://github.com/dan-tez/gift-hub/blob/main/Js/builder.js) (Custom Basket Builder), [`Js/products.js`](https://github.com/dan-tez/gift-hub/blob/main/Js/products.js) (Product Catalog Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog &amp; Storefront"]
  node_product_data["Product Catalog Data<br/>[products.js]"]
  node_storefront["Dynamic Storefront<br/>[script.js]"]
end

subgraph group_shopping["Cart &amp; Basket"]
  node_cart_page["Cart Review<br/>[cart.html]"]
  node_cart_engine["Cart Engine<br/>[cart.js]"]
  node_basket_builder["Custom Basket Builder<br/>[builder.js]"]
  node_browser_storage[("Browser Cart Storage")]
end

subgraph group_order["Checkout"]
  node_checkout_page["Checkout Form<br/>[checkout.html]"]
  node_checkout_logic["Checkout Logic<br/>[checkout.js]"]
  node_confirmation["Order Confirmation<br/>[success.html]"]
end

subgraph group_site["Shared Site UI"]
  node_home_page["Home Page<br/>[index.html]"]
  node_shared_controls["Header &amp; Footer<br/>[header.html]"]
  node_about_page["About Page<br/>[about.html]"]
  node_contact_page["Contact Page<br/>[contact.html]"]
  node_gallery_page["Gallery Page<br/>[gallery.html]"]
  node_basket_page["Basket Page<br/>[custom-basket.html]"]
end

node_shopper(("Shopper"))

node_shopper -->|"browses"| node_storefront
node_product_data -->|"supplies products"| node_storefront
node_storefront -->|"persists cart"| node_browser_storage
node_shopper -->|"reviews cart"| node_cart_page
node_cart_page -->|"renders through"| node_cart_engine
node_cart_engine -->|"reads and writes"| node_browser_storage
node_shopper -->|"builds basket"| node_basket_page
node_basket_page -->|"runs builder"| node_basket_builder
node_product_data -->|"supplies options"| node_basket_builder
node_basket_builder -->|"saves basket"| node_browser_storage
node_shopper -->|"enters checkout"| node_checkout_page
node_checkout_page -->|"runs checkout"| node_checkout_logic
node_checkout_logic -->|"loads and clears"| node_browser_storage
node_checkout_logic -->|"redirects on success"| node_confirmation
node_home_page -->|"hosts catalog"| node_storefront
node_storefront -->|"loads header"| node_shared_controls
node_shopper -->|"visits"| node_about_page
node_shopper -->|"visits"| node_contact_page
node_shopper -->|"visits"| node_gallery_page

click node_product_data "https://github.com/dan-tez/gift-hub/blob/main/Js/products.js"
click node_storefront "https://github.com/dan-tez/gift-hub/blob/main/Js/script.js"
click node_cart_page "https://github.com/dan-tez/gift-hub/blob/main/Pages/Actions/cart.html"
click node_cart_engine "https://github.com/dan-tez/gift-hub/blob/main/Js/cart.js"
click node_basket_builder "https://github.com/dan-tez/gift-hub/blob/main/Js/builder.js"
click node_checkout_page "https://github.com/dan-tez/gift-hub/blob/main/Pages/Actions/checkout.html"
click node_checkout_logic "https://github.com/dan-tez/gift-hub/blob/main/Js/checkout.js"
click node_confirmation "https://github.com/dan-tez/gift-hub/blob/main/Pages/Actions/success.html"
click node_home_page "https://github.com/dan-tez/gift-hub/blob/main/index.html"
click node_shared_controls "https://github.com/dan-tez/gift-hub/blob/main/Pages/Header/header.html"
click node_about_page "https://github.com/dan-tez/gift-hub/blob/main/Pages/about.html"
click node_contact_page "https://github.com/dan-tez/gift-hub/blob/main/Pages/contact.html"
click node_gallery_page "https://github.com/dan-tez/gift-hub/blob/main/Pages/gallery.html"
click node_basket_page "https://github.com/dan-tez/gift-hub/blob/main/Pages/custom-basket.html"

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_product_data,node_storefront toneBlue
class node_cart_page,node_cart_engine,node_basket_builder,node_browser_storage toneAmber
class node_checkout_page,node_checkout_logic,node_confirmation toneMint
class node_home_page,node_shared_controls,node_about_page,node_contact_page,node_gallery_page,node_basket_page toneRose
class node_shopper toneIndigo
```

## Components

### Catalog & Storefront

- [Product Catalog Data](https://github.com/dan-tez/gift-hub/blob/main/Js/products.js): `Js/products.js`
- [Dynamic Storefront](https://github.com/dan-tez/gift-hub/blob/main/Js/script.js): `Js/script.js`

### Cart & Basket

- [Cart Review](https://github.com/dan-tez/gift-hub/blob/main/Pages/Actions/cart.html): `Pages/Actions/cart.html`
- [Cart Engine](https://github.com/dan-tez/gift-hub/blob/main/Js/cart.js): `Js/cart.js`
- [Custom Basket Builder](https://github.com/dan-tez/gift-hub/blob/main/Js/builder.js): `Js/builder.js`
- **Browser Cart Storage**

### Checkout

- [Checkout Form](https://github.com/dan-tez/gift-hub/blob/main/Pages/Actions/checkout.html): `Pages/Actions/checkout.html`
- [Checkout Logic](https://github.com/dan-tez/gift-hub/blob/main/Js/checkout.js): `Js/checkout.js`
- [Order Confirmation](https://github.com/dan-tez/gift-hub/blob/main/Pages/Actions/success.html): `Pages/Actions/success.html`

### Shared Site UI

- [Home Page](https://github.com/dan-tez/gift-hub/blob/main/index.html): `index.html`
- [Header & Footer](https://github.com/dan-tez/gift-hub/blob/main/Pages/Header/header.html): `Pages/Header/header.html`
- [About Page](https://github.com/dan-tez/gift-hub/blob/main/Pages/about.html): `Pages/about.html`
- [Contact Page](https://github.com/dan-tez/gift-hub/blob/main/Pages/contact.html): `Pages/contact.html`
- [Gallery Page](https://github.com/dan-tez/gift-hub/blob/main/Pages/gallery.html): `Pages/gallery.html`
- [Basket Page](https://github.com/dan-tez/gift-hub/blob/main/Pages/custom-basket.html): `Pages/custom-basket.html`

### Other components

- **Shopper**

## Connections

- Shopper → Dynamic Storefront: browses (evidence: `README.md`)
- Product Catalog Data → Dynamic Storefront: supplies products (evidence: `README.md`)
- Dynamic Storefront → Browser Cart Storage: persists cart (evidence: `Js/script.js`)
- Shopper → Cart Review: reviews cart (evidence: `README.md`)
- Cart Review → Cart Engine: renders through (evidence: `Js/cart.js`)
- Cart Engine → Browser Cart Storage: reads and writes (evidence: `Js/cart.js`)
- Shopper → Basket Page: builds basket (evidence: `README.md`)
- Basket Page → Custom Basket Builder: runs builder (evidence: `README.md`)
- Product Catalog Data → Custom Basket Builder: supplies options (evidence: `Js/builder.js`)
- Custom Basket Builder → Browser Cart Storage: saves basket (evidence: `Js/builder.js`)
- Shopper → Checkout Form: enters checkout (evidence: `README.md`)
- Checkout Form → Checkout Logic: runs checkout (evidence: `Js/checkout.js`)
- Checkout Logic → Browser Cart Storage: loads and clears (evidence: `Js/checkout.js`)
- Checkout Logic → Order Confirmation: redirects on success (evidence: `Js/checkout.js`)
- Home Page → Dynamic Storefront: hosts catalog (evidence: `README.md`)
- Dynamic Storefront → Header & Footer: loads header (evidence: `Js/script.js`)
- Shopper → About Page: visits (evidence: `README.md`)
- Shopper → Contact Page: visits (evidence: `README.md`)
- Shopper → Gallery Page: visits (evidence: `README.md`)
