# sohantayyab/hubly architecture

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

- Interactive diagram: https://gitdiagram.com/sohantayyab/hubly
- Repository: https://github.com/sohantayyab/hubly

## Overview

Hubly is a client-side storefront for browsing products, viewing details, saving favorites, and managing a cart. The main journey runs from the home catalog through product details and cart actions; a cart drawer provides a demo checkout that clears the cart rather than processing a real order. Catalog and detail pages retrieve product data through a fetch hook, while cart and wishlist state persist in browser localStorage. The README describes only the Vite/React template, so product capabilities are inferred from the source excerpts and index; unsampled page behavior and integrations are not expanded beyond supported links.

Main entry points: [`src/App.jsx`](https://github.com/sohantayyab/hubly/blob/main/src/App.jsx) (App routing), [`src/pages/ProductDetails.jsx`](https://github.com/sohantayyab/hubly/blob/main/src/pages/ProductDetails.jsx) (Product details), [`src/components/ProductCard.jsx`](https://github.com/sohantayyab/hubly/blob/main/src/components/ProductCard.jsx) (Product card), [`src/context/CartContext.jsx`](https://github.com/sohantayyab/hubly/blob/main/src/context/CartContext.jsx) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront experience"]
  node_app["App routing<br/>[App.jsx]"]
  node_cartpage["Cart page<br/>[Cart.jsx]"]
  node_wishlistpage["Wishlist page<br/>[Wishlist.jsx]"]
  node_notfound["Not found<br/>[NotFound.jsx]"]
  node_drawer["Cart drawer<br/>[CartDrawer.jsx]"]
  node_navbar["Navigation bar<br/>[Navbar.jsx]"]
end

subgraph group_product["Product discovery"]
  node_home["Home catalog<br/>[Home.jsx]"]
  node_details["Product details<br/>[ProductDetails.jsx]"]
  node_fetch["Fetch hook<br/>[useFetch.js]"]
  node_api["API base URL<br/>[api.js]"]
  node_productcard["Product card<br/>[ProductCard.jsx]"]
end

subgraph group_state["Customer state"]
  node_cartstate["Cart state<br/>[CartContext.jsx]"]
  node_wishliststate["Wishlist state"]
  node_toaststate["Toast state<br/>[ToastContext.jsx]"]
  node_entry["Provider setup<br/>[main.jsx]"]
end

subgraph group_shared["Shared UI and utilities"]
  node_background["Background<br/>[Background.jsx]"]
  node_footer["Footer<br/>[Footer.jsx]"]
  node_logo["Brand logo<br/>[Logo.jsx]"]
  node_icon["Icon set<br/>[Icon.jsx]"]
  node_rating["Rating display<br/>[Rating.jsx]"]
  node_error["Error display<br/>[ErrorMessage.jsx]"]
  node_skeleton["Product skeleton"]
  node_utils["Display utilities<br/>[utils.js]"]
end

node_shopper(("Shopper"))
node_productservice{{"Product API"}}

node_shopper -->|"uses storefront"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_cartpage
node_app -->|"routes to"| node_wishlistpage
node_app -->|"routes to"| node_notfound
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_drawer
node_app -->|"renders"| node_footer
node_app -->|"renders"| node_background
node_home -->|"requests data"| node_fetch
node_home -->|"uses base URL"| node_api
node_details -->|"requests data"| node_fetch
node_details -->|"uses base URL"| node_api
node_fetch -->|"fetches products"| node_productservice
node_home -->|"renders products"| node_productcard
node_details -->|"renders related"| node_productcard
node_home -->|"renders errors"| node_error
node_details -->|"renders errors"| node_error
node_home -->|"renders loading"| node_skeleton
node_details -->|"renders ratings"| node_rating
node_productcard -->|"adds items"| node_cartstate
node_productcard -->|"toggles favorite"| node_wishliststate
node_details -->|"adds items"| node_cartstate
node_details -->|"toggles favorite"| node_wishliststate
node_cartpage -->|"reads and updates"| node_cartstate
node_wishlistpage -->|"reads favorites"| node_wishliststate
node_wishlistpage -->|"renders favorites"| node_productcard
node_drawer -->|"reads and updates"| node_cartstate
node_drawer -->|"shows checkout toast"| node_toaststate
node_cartstate -->|"shows cart notices"| node_toaststate
node_wishliststate -->|"shows favorite notices"| node_toaststate
node_navbar -->|"reads cart count"| node_cartstate
node_navbar -->|"reads favorite count"| node_wishliststate
node_entry -->|"mounts"| node_app
node_entry -->|"provides state"| node_cartstate
node_entry -->|"provides state"| node_wishliststate
node_entry -->|"provides state"| node_toaststate
node_footer -->|"renders"| node_logo
node_navbar -->|"renders"| node_logo
node_productcard -->|"renders"| node_rating
node_productcard -->|"formats display"| node_utils
node_details -->|"formats display"| node_utils
node_cartpage -->|"formats display"| node_utils
node_drawer -->|"formats display"| node_utils
node_productcard -->|"renders controls"| node_icon
node_details -->|"renders controls"| node_icon
node_drawer -->|"renders controls"| node_icon

click node_app "https://github.com/sohantayyab/hubly/blob/main/src/App.jsx"
click node_home "https://github.com/sohantayyab/hubly/blob/main/src/pages/Home.jsx"
click node_details "https://github.com/sohantayyab/hubly/blob/main/src/pages/ProductDetails.jsx"
click node_cartpage "https://github.com/sohantayyab/hubly/blob/main/src/pages/Cart.jsx"
click node_wishlistpage "https://github.com/sohantayyab/hubly/blob/main/src/pages/Wishlist.jsx"
click node_notfound "https://github.com/sohantayyab/hubly/blob/main/src/pages/NotFound.jsx"
click node_fetch "https://github.com/sohantayyab/hubly/blob/main/src/hooks/useFetch.js"
click node_api "https://github.com/sohantayyab/hubly/blob/main/src/lib/api.js"
click node_productcard "https://github.com/sohantayyab/hubly/blob/main/src/components/ProductCard.jsx"
click node_cartstate "https://github.com/sohantayyab/hubly/blob/main/src/context/CartContext.jsx"
click node_wishliststate "https://github.com/sohantayyab/hubly/blob/main/src/context/WishlistContext.jsx"
click node_toaststate "https://github.com/sohantayyab/hubly/blob/main/src/context/ToastContext.jsx"
click node_drawer "https://github.com/sohantayyab/hubly/blob/main/src/components/CartDrawer.jsx"
click node_navbar "https://github.com/sohantayyab/hubly/blob/main/src/components/Navbar.jsx"
click node_background "https://github.com/sohantayyab/hubly/blob/main/src/components/Background.jsx"
click node_footer "https://github.com/sohantayyab/hubly/blob/main/src/components/Footer.jsx"
click node_logo "https://github.com/sohantayyab/hubly/blob/main/src/components/Logo.jsx"
click node_icon "https://github.com/sohantayyab/hubly/blob/main/src/components/Icon.jsx"
click node_rating "https://github.com/sohantayyab/hubly/blob/main/src/components/Rating.jsx"
click node_error "https://github.com/sohantayyab/hubly/blob/main/src/components/ErrorMessage.jsx"
click node_skeleton "https://github.com/sohantayyab/hubly/blob/main/src/components/ProductSkeleton.jsx"
click node_utils "https://github.com/sohantayyab/hubly/blob/main/src/lib/utils.js"
click node_entry "https://github.com/sohantayyab/hubly/blob/main/src/main.jsx"

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_cartpage,node_wishlistpage,node_notfound,node_drawer,node_navbar toneBlue
class node_home,node_details,node_fetch,node_api,node_productcard toneAmber
class node_cartstate,node_wishliststate,node_toaststate,node_entry,node_productservice toneMint
class node_background,node_footer,node_logo,node_icon,node_rating,node_error,node_skeleton,node_utils toneRose
class node_shopper toneIndigo
```

## Components

### Storefront experience

- [App routing](https://github.com/sohantayyab/hubly/blob/main/src/App.jsx): `src/App.jsx`
- [Cart page](https://github.com/sohantayyab/hubly/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Wishlist page](https://github.com/sohantayyab/hubly/blob/main/src/pages/Wishlist.jsx): `src/pages/Wishlist.jsx`
- [Not found](https://github.com/sohantayyab/hubly/blob/main/src/pages/NotFound.jsx): `src/pages/NotFound.jsx`
- [Cart drawer](https://github.com/sohantayyab/hubly/blob/main/src/components/CartDrawer.jsx): `src/components/CartDrawer.jsx`
- [Navigation bar](https://github.com/sohantayyab/hubly/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`

### Product discovery

- [Home catalog](https://github.com/sohantayyab/hubly/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Product details](https://github.com/sohantayyab/hubly/blob/main/src/pages/ProductDetails.jsx): `src/pages/ProductDetails.jsx`
- [Fetch hook](https://github.com/sohantayyab/hubly/blob/main/src/hooks/useFetch.js): `src/hooks/useFetch.js`
- [API base URL](https://github.com/sohantayyab/hubly/blob/main/src/lib/api.js): `src/lib/api.js`
- [Product card](https://github.com/sohantayyab/hubly/blob/main/src/components/ProductCard.jsx): `src/components/ProductCard.jsx`

### Customer state

- [Cart state](https://github.com/sohantayyab/hubly/blob/main/src/context/CartContext.jsx): `src/context/CartContext.jsx`
- [Wishlist state](https://github.com/sohantayyab/hubly/blob/main/src/context/WishlistContext.jsx): `src/context/WishlistContext.jsx`
- [Toast state](https://github.com/sohantayyab/hubly/blob/main/src/context/ToastContext.jsx): `src/context/ToastContext.jsx`
- [Provider setup](https://github.com/sohantayyab/hubly/blob/main/src/main.jsx): `src/main.jsx`

### Shared UI and utilities

- [Background](https://github.com/sohantayyab/hubly/blob/main/src/components/Background.jsx): `src/components/Background.jsx`
- [Footer](https://github.com/sohantayyab/hubly/blob/main/src/components/Footer.jsx): `src/components/Footer.jsx`
- [Brand logo](https://github.com/sohantayyab/hubly/blob/main/src/components/Logo.jsx): `src/components/Logo.jsx`
- [Icon set](https://github.com/sohantayyab/hubly/blob/main/src/components/Icon.jsx): `src/components/Icon.jsx`
- [Rating display](https://github.com/sohantayyab/hubly/blob/main/src/components/Rating.jsx): `src/components/Rating.jsx`
- [Error display](https://github.com/sohantayyab/hubly/blob/main/src/components/ErrorMessage.jsx): `src/components/ErrorMessage.jsx`
- [Product skeleton](https://github.com/sohantayyab/hubly/blob/main/src/components/ProductSkeleton.jsx): `src/components/ProductSkeleton.jsx`
- [Display utilities](https://github.com/sohantayyab/hubly/blob/main/src/lib/utils.js): `src/lib/utils.js`

### Other components

- **Shopper**
- **Product API**

## Connections

- Shopper → App routing: uses storefront
- App routing → Home catalog: routes to (evidence: `src/App.jsx`)
- App routing → Product details: routes to (evidence: `src/App.jsx`)
- App routing → Cart page: routes to (evidence: `src/App.jsx`)
- App routing → Wishlist page: routes to (evidence: `src/App.jsx`)
- App routing → Not found: routes to (evidence: `src/App.jsx`)
- App routing → Navigation bar: renders (evidence: `src/App.jsx`)
- App routing → Cart drawer: renders (evidence: `src/App.jsx`)
- App routing → Footer: renders (evidence: `src/App.jsx`)
- App routing → Background: renders (evidence: `src/App.jsx`)
- Home catalog → Fetch hook: requests data (evidence: `src/pages/Home.jsx`)
- Home catalog → API base URL: uses base URL (evidence: `src/pages/Home.jsx`)
- Product details → Fetch hook: requests data (evidence: `src/pages/ProductDetails.jsx`)
- Product details → API base URL: uses base URL (evidence: `src/pages/ProductDetails.jsx`)
- Fetch hook → Product API: fetches products (evidence: `src/hooks/useFetch.js`)
- Home catalog → Product card: renders products (evidence: `src/pages/Home.jsx`)
- Product details → Product card: renders related (evidence: `src/pages/ProductDetails.jsx`)
- Home catalog → Error display: renders errors (evidence: `src/pages/Home.jsx`)
- Product details → Error display: renders errors (evidence: `src/pages/ProductDetails.jsx`)
- Home catalog → Product skeleton: renders loading (evidence: `src/pages/Home.jsx`)
- Product details → Rating display: renders ratings (evidence: `src/pages/ProductDetails.jsx`)
- Product card → Cart state: adds items (evidence: `src/components/ProductCard.jsx`)
- Product card → Wishlist state: toggles favorite (evidence: `src/components/ProductCard.jsx`)
- Product details → Cart state: adds items (evidence: `src/pages/ProductDetails.jsx`)
- Product details → Wishlist state: toggles favorite (evidence: `src/pages/ProductDetails.jsx`)
- Cart page → Cart state: reads and updates (evidence: `src/pages/Cart.jsx`)
- Wishlist page → Wishlist state: reads favorites (evidence: `src/pages/Wishlist.jsx`)
- Wishlist page → Product card: renders favorites (evidence: `src/pages/Wishlist.jsx`)
- Cart drawer → Cart state: reads and updates (evidence: `src/components/CartDrawer.jsx`)
- Cart drawer → Toast state: shows checkout toast (evidence: `src/components/CartDrawer.jsx`)
- Cart state → Toast state: shows cart notices (evidence: `src/context/CartContext.jsx`)
- Wishlist state → Toast state: shows favorite notices (evidence: `src/context/WishlistContext.jsx`)
- Navigation bar → Cart state: reads cart count (evidence: `src/components/Navbar.jsx`)
- Navigation bar → Wishlist state: reads favorite count (evidence: `src/components/Navbar.jsx`)
- Provider setup → App routing: mounts (evidence: `src/main.jsx`)
- Provider setup → Cart state: provides state (evidence: `src/main.jsx`)
- Provider setup → Wishlist state: provides state (evidence: `src/main.jsx`)
- Provider setup → Toast state: provides state (evidence: `src/main.jsx`)
- Footer → Brand logo: renders (evidence: `src/components/Footer.jsx`)
- Navigation bar → Brand logo: renders (evidence: `src/components/Navbar.jsx`)
- Product card → Rating display: renders (evidence: `src/components/ProductCard.jsx`)
- Product card → Display utilities: formats display (evidence: `src/components/ProductCard.jsx`)
- Product details → Display utilities: formats display (evidence: `src/pages/ProductDetails.jsx`)
- Cart page → Display utilities: formats display (evidence: `src/pages/Cart.jsx`)
- Cart drawer → Display utilities: formats display (evidence: `src/components/CartDrawer.jsx`)
- Product card → Icon set: renders controls (evidence: `src/components/ProductCard.jsx`)
- Product details → Icon set: renders controls (evidence: `src/pages/ProductDetails.jsx`)
- Cart drawer → Icon set: renders controls (evidence: `src/components/CartDrawer.jsx`)
