# shaundelcastillo/yamagears-prototype architecture

> Architecture diagram of the GitHub repository shaundelcastillo/yamagears-prototype, 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/shaundelcastillo/yamagears-prototype
- Repository: https://github.com/shaundelcastillo/yamagears-prototype

## Overview

Yama Gears is a bicycle, parts, and apparel storefront with a browser-based admin area and a small Express API. The customer-facing flow is product browsing, cart and checkout, order tracking, and contact; the admin side manages catalog, inventory, orders, inquiries, and store settings. The sampled storefront excerpt shows catalog rendering, cart persistence, and checkout UI, but not the full checkout or tracking requests. Accordingly, those API connections are not asserted; the backend routes shown use in-memory data.

Main entry points: [`script.js`](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/script.js) (Storefront), [`backend/server.js`](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/server.js) (API server), [`backend/routes/products.js`](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/products.js) (Product routes), [`index.html`](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/index.html) (Home page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_store["Storefront<br/>[script.js]"]
  node_home["Home page<br/>[index.html]"]
  node_catalogpage["Product page<br/>[products.html]"]
  node_contactpage["Contact page<br/>[contact.html]"]
  node_tracking["Order tracking<br/>[track-order.html]"]
end

subgraph group_admin["Administration"]
  node_adminproducts["Product management<br/>[adminproduct.js]"]
  node_inventory["Inventory report<br/>[admin-inventory.js]"]
  node_adminorders["Order management<br/>[admin-order.js]"]
  node_inquiryadmin["Inquiry management<br/>[admininquiries.js]"]
  node_settings["Store settings<br/>[admin-settings.js]"]
  node_overview["Admin overview<br/>[admin.js]"]
end

subgraph group_api["Backend API"]
  node_server["API server<br/>[server.js]"]
  node_productroute["Product routes<br/>[products.js]"]
  node_productdata[("Product catalog data<br/>[products.js]")]
  node_orderroute["Order routes<br/>[orders.js]"]
  node_inquiryroutes["Inquiry routes<br/>[inquiries.js]"]
end

subgraph group_state["Browser State"]
  node_browserstorage[("Local storage")]
end

node_shopper(("Shopper"))

node_shopper -->|"browses and checks out"| node_store
node_home -.->|"loads behavior"| node_store
node_catalogpage -.->|"loads behavior"| node_store
node_store -->|"persists cart"| node_browserstorage
node_adminproducts -->|"reads and writes catalog"| node_browserstorage
node_inventory -->|"reads catalog"| node_browserstorage
node_adminorders -->|"reads and writes orders"| node_browserstorage
node_settings -->|"reads and writes settings"| node_browserstorage
node_overview -->|"reads catalog"| node_browserstorage
node_server -->|"mounts route"| node_productroute
node_server -->|"mounts route"| node_orderroute
node_server -->|"mounts route"| node_inquiryroutes
node_productroute -->|"reads and updates"| node_productdata

click node_store "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/script.js"
click node_home "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/index.html"
click node_catalogpage "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/products.html"
click node_contactpage "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/contact.html"
click node_tracking "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/track-order.html"
click node_adminproducts "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/adminproduct.js"
click node_inventory "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin-inventory.js"
click node_adminorders "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin-order.js"
click node_inquiryadmin "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admininquiries.js"
click node_settings "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin-settings.js"
click node_overview "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin.js"
click node_server "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/server.js"
click node_productroute "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/products.js"
click node_productdata "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/data/products.js"
click node_orderroute "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/orders.js"
click node_inquiryroutes "https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/inquiries.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_store,node_home,node_catalogpage,node_contactpage,node_tracking toneBlue
class node_adminproducts,node_inventory,node_adminorders,node_inquiryadmin,node_settings,node_overview toneAmber
class node_server,node_productroute,node_productdata,node_orderroute,node_inquiryroutes toneMint
class node_browserstorage toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Storefront](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/script.js): `script.js`
- [Home page](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/index.html): `index.html`
- [Product page](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/products.html): `products.html`
- [Contact page](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/contact.html): `contact.html`
- [Order tracking](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/track-order.html): `track-order.html`

### Administration

- [Product management](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/adminproduct.js): `adminproduct.js`
- [Inventory report](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin-inventory.js): `admin-inventory.js`
- [Order management](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin-order.js): `admin-order.js`
- [Inquiry management](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admininquiries.js): `admininquiries.js`
- [Store settings](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin-settings.js): `admin-settings.js`
- [Admin overview](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/admin.js): `admin.js`

### Backend API

- [API server](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/server.js): `backend/server.js`
- [Product routes](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/products.js): `backend/routes/products.js`
- [Product catalog data](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/data/products.js): `backend/data/products.js`
- [Order routes](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/orders.js): `backend/routes/orders.js`
- [Inquiry routes](https://github.com/shaundelcastillo/yamagears-prototype/blob/main/backend/routes/inquiries.js): `backend/routes/inquiries.js`

### Browser State

- **Local storage**

### Other components

- **Shopper**

## Connections

- Shopper → Storefront: browses and checks out (evidence: `script.js`)
- Home page → Storefront: loads behavior
- Product page → Storefront: loads behavior
- Storefront → Local storage: persists cart (evidence: `script.js`)
- Product management → Local storage: reads and writes catalog (evidence: `adminproduct.js`)
- Inventory report → Local storage: reads catalog (evidence: `admin-inventory.js`)
- Order management → Local storage: reads and writes orders (evidence: `admin-order.js`)
- Store settings → Local storage: reads and writes settings (evidence: `admin-settings.js`)
- Admin overview → Local storage: reads catalog (evidence: `admin.js`)
- API server → Product routes: mounts route (evidence: `backend/server.js`)
- API server → Order routes: mounts route (evidence: `backend/server.js`)
- API server → Inquiry routes: mounts route (evidence: `backend/server.js`)
- Product routes → Product catalog data: reads and updates (evidence: `backend/routes/products.js`)
