# dinada04/toyhaven architecture

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

- Interactive diagram: https://gitdiagram.com/dinada04/toyhaven
- Repository: https://github.com/dinada04/toyhaven

## Overview

Toy Haven is a browser-based toy storefront with product browsing, cart and wishlist management, checkout, and feedback. Its main workflow is browsing products, adding items to a cart, reviewing totals, and submitting checkout details; wishlist, newsletter, FAQ, and promotional features supplement that path. Most behavior is implemented in the shared script.js, with a service worker caching site files for offline access. The excerpts do not show page-to-script wiring or the full checkout implementation, so those links are omitted.

Main entry points: [`script.js`](https://github.com/dinada04/toyhaven/blob/main/script.js) (Product catalog UI), [`sw.js`](https://github.com/dinada04/toyhaven/blob/main/sw.js) (Service worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pages["Storefront pages"]
  node_home["Home<br/>[index.html]"]
  node_products_page["Products page<br/>[products.html]"]
  node_wishlist_page["Wishlist page<br/>[wishlist.html]"]
  node_cart_page["Cart page<br/>[cart.html]"]
  node_checkout_page["Checkout page<br/>[checkout.html]"]
  node_feedback_page["Feedback page<br/>[feedback.html]"]
end

subgraph group_commerce["Shopping features"]
  node_catalog["Product catalog UI<br/>[script.js]"]
  node_cart["Cart operations<br/>[script.js]"]
  node_totals["Cart totals<br/>[script.js]"]
  node_checkout["Checkout flow<br/>[script.js]"]
  node_wishlist["Wishlist operations<br/>[script.js]"]
  node_local_storage[("Browser storage")]
end

subgraph group_engagement["Engagement features"]
  node_promotions["Promotional features<br/>[script.js]"]
  node_feedback["Feedback form<br/>[script.js]"]
  node_faq["FAQ accordion<br/>[script.js]"]
end

subgraph group_offline["Offline support"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_cache[("Cache storage")]
end

node_visitor(("Shopper"))

node_catalog -->|"adds items"| node_cart
node_catalog -->|"toggles items"| node_wishlist
node_cart -->|"saves cart"| node_local_storage
node_wishlist -->|"saves list"| node_local_storage
node_checkout -->|"gets totals"| node_totals
node_feedback -->|"saves feedback"| node_local_storage
node_service_worker -->|"caches files"| node_cache
node_service_worker -->|"checks cached files"| node_cache

click node_home "https://github.com/dinada04/toyhaven/blob/main/index.html"
click node_products_page "https://github.com/dinada04/toyhaven/blob/main/products.html"
click node_wishlist_page "https://github.com/dinada04/toyhaven/blob/main/wishlist.html"
click node_cart_page "https://github.com/dinada04/toyhaven/blob/main/cart.html"
click node_checkout_page "https://github.com/dinada04/toyhaven/blob/main/checkout.html"
click node_feedback_page "https://github.com/dinada04/toyhaven/blob/main/feedback.html"
click node_catalog "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_cart "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_totals "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_checkout "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_wishlist "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_promotions "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_feedback "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_faq "https://github.com/dinada04/toyhaven/blob/main/script.js"
click node_service_worker "https://github.com/dinada04/toyhaven/blob/main/sw.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_home,node_products_page,node_wishlist_page,node_cart_page,node_checkout_page,node_feedback_page toneBlue
class node_catalog,node_cart,node_totals,node_checkout,node_wishlist,node_local_storage toneAmber
class node_promotions,node_feedback,node_faq toneMint
class node_service_worker,node_cache toneRose
class node_visitor toneIndigo
```

## Components

### Storefront pages

- [Home](https://github.com/dinada04/toyhaven/blob/main/index.html): `index.html`
- [Products page](https://github.com/dinada04/toyhaven/blob/main/products.html): `products.html`
- [Wishlist page](https://github.com/dinada04/toyhaven/blob/main/wishlist.html): `wishlist.html`
- [Cart page](https://github.com/dinada04/toyhaven/blob/main/cart.html): `cart.html`
- [Checkout page](https://github.com/dinada04/toyhaven/blob/main/checkout.html): `checkout.html`
- [Feedback page](https://github.com/dinada04/toyhaven/blob/main/feedback.html): `feedback.html`

### Shopping features

- [Product catalog UI](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- [Cart operations](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- [Cart totals](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- [Checkout flow](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- [Wishlist operations](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- **Browser storage**

### Engagement features

- [Promotional features](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- [Feedback form](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`
- [FAQ accordion](https://github.com/dinada04/toyhaven/blob/main/script.js): `script.js`

### Offline support

- [Service worker](https://github.com/dinada04/toyhaven/blob/main/sw.js): `sw.js`
- **Cache storage**

### Other components

- **Shopper**

## Connections

- Product catalog UI → Cart operations: adds items (evidence: `script.js`)
- Product catalog UI → Wishlist operations: toggles items (evidence: `script.js`)
- Cart operations → Browser storage: saves cart (evidence: `script.js`)
- Wishlist operations → Browser storage: saves list (evidence: `script.js`)
- Checkout flow → Cart totals: gets totals (evidence: `script.js`)
- Feedback form → Browser storage: saves feedback (evidence: `script.js`)
- Service worker → Cache storage: caches files (evidence: `sw.js`)
- Service worker → Cache storage: checks cached files (evidence: `sw.js`)
