# wayne-kiprotich/snug-co-client architecture

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

- Interactive diagram: https://gitdiagram.com/wayne-kiprotich/snug-co-client
- Repository: https://github.com/wayne-kiprotich/snug-co-client

## Overview

SNUG & Co. is a clothing storefront whose customer path runs from browsing and choosing product options to a server-side order check and a prefilled WhatsApp message. It also provides an admin for catalog, imagery, taxonomy, settings, and account management, backed by a Flask API when configured; otherwise the storefront uses bundled catalog data. The graph separates customer journeys, admin operations, catalog/media, and shared services. Sampled sources substantiate the routing, catalog loading, checkout check, and several shared-layer links; README documents the broader admin and integration capabilities.

Main entry points: [`src/App.jsx`](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/App.jsx) (Route application), [`src/pages/Product.jsx`](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Product.jsx) (Product detail), [`src/pages/Cart.jsx`](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Cart.jsx) (Bag and checkout), [`src/lib/catalog.js`](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/catalog.js) (Catalog loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer storefront"]
  node_app["Route application<br/>[App.jsx]"]
  node_home["Home experience<br/>[Home.jsx]"]
  node_shop["Product discovery<br/>[Shop.jsx]"]
  node_product["Product detail<br/>[Product.jsx]"]
  node_cart["Bag and checkout<br/>[Cart.jsx]"]
  node_other_pages["Customer pages"]
  node_product_grid["Product grid<br/>[ProductGrid.jsx]"]
  node_product_card["Product card<br/>[ProductCard.jsx]"]
  node_order_panel["Order options<br/>[OrderPanel.jsx]"]
  node_search["Search dialog<br/>[SearchDialog.jsx]"]
  node_layout["Store layout<br/>[Layout.jsx]"]
end

subgraph group_admin["Catalog administration"]
  node_admin_routes["Admin screens"]
  node_admin_api["Admin API client<br/>[api.js]"]
end

subgraph group_content["Catalog and media"]
  node_catalog["Catalog loader<br/>[catalog.js]"]
  node_catalog_hook["Catalog hooks<br/>[useCatalog.js]"]
  node_bundled_products["Bundled products<br/>[products.js]"]
  node_categories["Categories<br/>[categories.js]"]
  node_site_config["Brand configuration<br/>[site.js]"]
  node_image_service["Image resolver<br/>[images.js]"]
  node_img_component["Image display<br/>[Img.jsx]"]
end

subgraph group_services["Shared services"]
  node_shopper_state["Bag and wishlist state<br/>[shopper.js]"]
  node_http["HTTP client<br/>[http.js]"]
  node_order_check["Order validation<br/>[order.js]"]
  node_whatsapp["WhatsApp message<br/>[whatsapp.js]"]
  node_analytics["Event tracking<br/>[analytics.js]"]
  node_seo["Search metadata<br/>[seo.js]"]
end

node_shopper(("Customer"))
node_admin_service{{"Flask API"}}
node_whatsapp_service{{"WhatsApp"}}

node_shopper -->|"browses"| node_app
node_app -->|"renders storefront"| node_layout
node_app -->|"routes home"| node_home
node_app -->|"routes shop"| node_shop
node_app -->|"routes product"| node_product
node_app -->|"routes bag"| node_cart
node_app -->|"routes pages"| node_other_pages
node_shop -->|"loads listings"| node_catalog_hook
node_product -->|"loads product"| node_catalog_hook
node_catalog_hook -->|"requests data"| node_catalog
node_catalog -->|"fetches API data"| node_http
node_catalog -->|"uses fallback"| node_bundled_products
node_catalog -->|"loads taxonomy"| node_categories
node_shop -->|"renders results"| node_product_grid
node_product_grid -->|"renders cards"| node_product_card
node_product -->|"renders options"| node_order_panel
node_search -->|"searches catalog"| node_catalog_hook
node_product_card -->|"renders photos"| node_img_component
node_img_component -->|"resolves image"| node_image_service
node_catalog -->|"registers images"| node_image_service
node_cart -->|"reads and updates bag"| node_shopper_state
node_cart -->|"compares shown prices"| node_order_check
node_cart -->|"checks current order"| node_shopper_state
node_cart -->|"opens checked order"| node_whatsapp
node_whatsapp -->|"opens message link"| node_whatsapp_service
node_shopper_state -->|"sends shopper requests"| node_http
node_http -.->|"calls API"| node_admin_service
node_admin_routes -->|"manages catalog"| node_admin_api
node_admin_api -.->|"calls admin API"| node_admin_service
node_home -->|"reads brand data"| node_site_config
node_product -->|"sets page metadata"| node_seo
node_seo -->|"reads site details"| node_site_config
node_order_panel -->|"tracks events"| node_analytics
node_product -->|"tracks views"| node_analytics

click node_app "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/App.jsx"
click node_home "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Home.jsx"
click node_shop "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Shop.jsx"
click node_product "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Product.jsx"
click node_cart "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Cart.jsx"
click node_other_pages "https://github.com/wayne-kiprotich/snug-co-client/tree/main/src/pages"
click node_product_grid "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/ProductGrid.jsx"
click node_product_card "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/ProductCard.jsx"
click node_order_panel "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/product/OrderPanel.jsx"
click node_search "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/layout/SearchDialog.jsx"
click node_layout "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/layout/Layout.jsx"
click node_admin_routes "https://github.com/wayne-kiprotich/snug-co-client/tree/main/src/admin"
click node_admin_api "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/admin/api.js"
click node_catalog "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/catalog.js"
click node_catalog_hook "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/hooks/useCatalog.js"
click node_bundled_products "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/data/products.js"
click node_categories "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/data/categories.js"
click node_site_config "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/config/site.js"
click node_image_service "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/images.js"
click node_img_component "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/Img.jsx"
click node_shopper_state "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/shopper.js"
click node_http "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/http.js"
click node_order_check "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/order.js"
click node_whatsapp "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/whatsapp.js"
click node_analytics "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/analytics.js"
click node_seo "https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/seo.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_app,node_home,node_shop,node_product,node_cart,node_other_pages,node_product_grid,node_product_card,node_order_panel,node_search,node_layout toneBlue
class node_admin_routes,node_admin_api toneAmber
class node_catalog,node_catalog_hook,node_bundled_products,node_categories,node_site_config,node_image_service,node_img_component,node_admin_service toneMint
class node_shopper_state,node_http,node_order_check,node_whatsapp,node_analytics,node_seo toneRose
class node_shopper,node_whatsapp_service toneIndigo
```

## Components

### Customer storefront

- [Route application](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/App.jsx): `src/App.jsx`
- [Home experience](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Product discovery](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Shop.jsx): `src/pages/Shop.jsx`
- [Product detail](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Product.jsx): `src/pages/Product.jsx`
- [Bag and checkout](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Customer pages](https://github.com/wayne-kiprotich/snug-co-client/tree/main/src/pages): `src/pages`
- [Product grid](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/ProductGrid.jsx): `src/components/ProductGrid.jsx`
- [Product card](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/ProductCard.jsx): `src/components/ProductCard.jsx`
- [Order options](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/product/OrderPanel.jsx): `src/components/product/OrderPanel.jsx`
- [Search dialog](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/layout/SearchDialog.jsx): `src/components/layout/SearchDialog.jsx`
- [Store layout](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/layout/Layout.jsx): `src/components/layout/Layout.jsx`

### Catalog administration

- [Admin screens](https://github.com/wayne-kiprotich/snug-co-client/tree/main/src/admin): `src/admin`
- [Admin API client](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/admin/api.js): `src/admin/api.js`

### Catalog and media

- [Catalog loader](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/catalog.js): `src/lib/catalog.js`
- [Catalog hooks](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/hooks/useCatalog.js): `src/hooks/useCatalog.js`
- [Bundled products](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/data/products.js): `src/data/products.js`
- [Categories](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/data/categories.js): `src/data/categories.js`
- [Brand configuration](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/config/site.js): `src/config/site.js`
- [Image resolver](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/images.js): `src/lib/images.js`
- [Image display](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/components/Img.jsx): `src/components/Img.jsx`

### Shared services

- [Bag and wishlist state](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/shopper.js): `src/lib/shopper.js`
- [HTTP client](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/http.js): `src/lib/http.js`
- [Order validation](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/order.js): `src/lib/order.js`
- [WhatsApp message](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/whatsapp.js): `src/lib/whatsapp.js`
- [Event tracking](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/analytics.js): `src/lib/analytics.js`
- [Search metadata](https://github.com/wayne-kiprotich/snug-co-client/blob/main/src/lib/seo.js): `src/lib/seo.js`

### Other components

- **Customer**
- **Flask API**
- **WhatsApp**

## Connections

- Customer → Route application: browses (evidence: `src/App.jsx`)
- Route application → Store layout: renders storefront (evidence: `src/App.jsx`)
- Route application → Home experience: routes home (evidence: `src/App.jsx`)
- Route application → Product discovery: routes shop (evidence: `src/App.jsx`)
- Route application → Product detail: routes product (evidence: `src/App.jsx`)
- Route application → Bag and checkout: routes bag (evidence: `src/App.jsx`)
- Route application → Customer pages: routes pages (evidence: `src/App.jsx`)
- Product discovery → Catalog hooks: loads listings (evidence: `src/pages/Shop.jsx`)
- Product detail → Catalog hooks: loads product (evidence: `src/pages/Product.jsx`)
- Catalog hooks → Catalog loader: requests data (evidence: `src/hooks/useCatalog.js`)
- Catalog loader → HTTP client: fetches API data (evidence: `src/lib/catalog.js`)
- Catalog loader → Bundled products: uses fallback (evidence: `src/lib/catalog.js`)
- Catalog loader → Categories: loads taxonomy (evidence: `src/lib/catalog.js`)
- Product discovery → Product grid: renders results (evidence: `src/pages/Shop.jsx`)
- Product grid → Product card: renders cards (evidence: `src/components/ProductGrid.jsx`)
- Product detail → Order options: renders options (evidence: `src/pages/Product.jsx`)
- Search dialog → Catalog hooks: searches catalog (evidence: `src/components/layout/SearchDialog.jsx`)
- Product card → Image display: renders photos (evidence: `src/components/ProductCard.jsx`)
- Image display → Image resolver: resolves image (evidence: `src/components/Img.jsx`)
- Catalog loader → Image resolver: registers images (evidence: `src/lib/catalog.js`)
- Bag and checkout → Bag and wishlist state: reads and updates bag (evidence: `src/pages/Cart.jsx`)
- Bag and checkout → Order validation: compares shown prices (evidence: `src/pages/Cart.jsx`)
- Bag and checkout → Bag and wishlist state: checks current order (evidence: `src/pages/Cart.jsx`)
- Bag and checkout → WhatsApp message: opens checked order (evidence: `src/pages/Cart.jsx`)
- WhatsApp message → WhatsApp: opens message link (evidence: `src/lib/whatsapp.js`)
- Bag and wishlist state → HTTP client: sends shopper requests (evidence: `src/lib/shopper.js`)
- HTTP client → Flask API: calls API
- Admin screens → Admin API client: manages catalog (evidence: `src/admin/ProductForm.jsx`)
- Admin API client → Flask API: calls admin API
- Home experience → Brand configuration: reads brand data
- Product detail → Search metadata: sets page metadata (evidence: `src/pages/Product.jsx`)
- Search metadata → Brand configuration: reads site details (evidence: `src/lib/seo.js`)
- Order options → Event tracking: tracks events (evidence: `src/components/product/OrderPanel.jsx`)
- Product detail → Event tracking: tracks views (evidence: `src/pages/Product.jsx`)
