# byui-cse/wdd330-sleepoutside architecture

> Architecture diagram of the GitHub repository byui-cse/wdd330-sleepoutside, 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/byui-cse/wdd330-sleepoutside
- Repository: https://github.com/byui-cse/wdd330-sleepoutside

## Overview

SleepOutside is a starter storefront for outdoor gear. A shopper can browse product pages, add a selected product to the cart, review the cart, and reach a checkout page. The sampled JavaScript shows product lookup from category JSON, cart persistence in browser local storage, and cart rendering. The tree also includes catalog and checkout pages, but their runtime wiring and checkout behavior are not shown, so those connections are left unverified rather than inferred.

Main entry points: [`src/js/product.js`](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/product.js) (Add To Cart), [`src/js/utils.mjs`](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/utils.mjs) (Storage Helpers), [`src/product_pages`](https://github.com/byui-cse/wdd330-sleepoutside/tree/main/src/product_pages) (Product Pages), [`src/cart/index.html`](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/cart/index.html) (Cart Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_catalog_page["Catalog Page<br/>[index.html]"]
  node_product_pages["Product Pages"]
  node_cart_page["Cart Page<br/>[index.html]"]
  node_checkout_page["Checkout Page<br/>[index.html]"]
end

subgraph group_product["Product Data"]
  node_product_handler["Add To Cart<br/>[product.js]"]
  node_product_data["Product Lookup<br/>[ProductData.mjs]"]
  node_catalog_data["Category JSON"]
end

subgraph group_cart["Cart"]
  node_cart_renderer["Cart Renderer<br/>[cart.js]"]
  node_storage_helpers["Storage Helpers<br/>[utils.mjs]"]
  node_browser_storage[("Browser Storage")]
end

node_shopper(("Shopper"))

node_shopper -.->|"browses"| node_catalog_page
node_shopper -.->|"selects"| node_product_pages
node_shopper -.->|"reviews"| node_cart_page
node_shopper -.->|"continues"| node_checkout_page
node_product_handler -->|"looks up"| node_product_data
node_product_data -->|"fetches category"| node_catalog_data
node_product_handler -->|"saves item"| node_storage_helpers
node_cart_renderer -->|"reads cart"| node_storage_helpers
node_storage_helpers -->|"reads and writes"| node_browser_storage
node_product_pages -.->|"uses handler"| node_product_handler
node_cart_page -.->|"uses renderer"| node_cart_renderer

click node_catalog_page "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/index.html"
click node_product_pages "https://github.com/byui-cse/wdd330-sleepoutside/tree/main/src/product_pages"
click node_cart_page "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/cart/index.html"
click node_checkout_page "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/checkout/index.html"
click node_product_handler "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/product.js"
click node_product_data "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/ProductData.mjs"
click node_catalog_data "https://github.com/byui-cse/wdd330-sleepoutside/tree/main/src/json"
click node_cart_renderer "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/cart.js"
click node_storage_helpers "https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/utils.mjs"

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_catalog_page,node_product_pages,node_cart_page,node_checkout_page toneBlue
class node_product_handler,node_product_data,node_catalog_data toneAmber
class node_cart_renderer,node_storage_helpers,node_browser_storage toneMint
class node_shopper toneIndigo
```

## Components

### Storefront

- [Catalog Page](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/index.html): `src/index.html`
- [Product Pages](https://github.com/byui-cse/wdd330-sleepoutside/tree/main/src/product_pages): `src/product_pages`
- [Cart Page](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/cart/index.html): `src/cart/index.html`
- [Checkout Page](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/checkout/index.html): `src/checkout/index.html`

### Product Data

- [Add To Cart](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/product.js): `src/js/product.js`
- [Product Lookup](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/ProductData.mjs): `src/js/ProductData.mjs`
- [Category JSON](https://github.com/byui-cse/wdd330-sleepoutside/tree/main/src/json): `src/json`

### Cart

- [Cart Renderer](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/cart.js): `src/js/cart.js`
- [Storage Helpers](https://github.com/byui-cse/wdd330-sleepoutside/blob/main/src/js/utils.mjs): `src/js/utils.mjs`
- **Browser Storage**

### Other components

- **Shopper**

## Connections

- Shopper → Catalog Page: browses
- Shopper → Product Pages: selects
- Shopper → Cart Page: reviews
- Shopper → Checkout Page: continues
- Add To Cart → Product Lookup: looks up (evidence: `src/js/product.js`)
- Product Lookup → Category JSON: fetches category (evidence: `src/js/ProductData.mjs`)
- Add To Cart → Storage Helpers: saves item (evidence: `src/js/product.js`)
- Cart Renderer → Storage Helpers: reads cart (evidence: `src/js/cart.js`)
- Storage Helpers → Browser Storage: reads and writes (evidence: `src/js/utils.mjs`)
- Product Pages → Add To Cart: uses handler
- Cart Page → Cart Renderer: uses renderer
