# ammar-antar/shopnow-store-e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/ammar-antar/shopnow-store-e-commerce
- Repository: https://github.com/ammar-antar/shopnow-store-e-commerce

## Overview

ShopNow is a browser-based e-commerce demo. Visitors browse and filter a product catalog, inspect products, manage a persisted cart or wishlist, check out as guests, and track simulated orders; optional demo login uses DummyJSON. The graph follows documented routes and relationships visible in excerpts or the SOURCE INDEX. Several feature components and pages were not sampled, so their internal behavior and unverified links are omitted.

Main entry points: [`src/App.jsx`](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/App.jsx) (Route application), [`src/pages/Checkout.jsx`](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Checkout.jsx) (Guest checkout), [`src/api/client.js`](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/api/client.js) (HTTP client), [`src/pages/Products.jsx`](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Products.jsx) (Product catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["App routing"]
  node_app["Route application<br/>[App.jsx]"]
  node_layout["Store layout<br/>[MainLayout.jsx]"]
end

subgraph group_catalog["Product discovery"]
  node_home["Store home<br/>[Home.jsx]"]
  node_catalog_page["Product catalog<br/>[Products.jsx]"]
  node_product_detail["Product details<br/>[ProductDetails.jsx]"]
  node_product_filter["Catalog filtering"]
  node_url_state["Catalog URL state<br/>[useProductsUrl.js]"]
end

subgraph group_shopping["Shopping and orders"]
  node_cart_page["Cart page<br/>[Cart.jsx]"]
  node_cart_store[("Cart state<br/>[useCartStore.js]")]
  node_cart_math["Cart totals<br/>[cart.js]"]
  node_checkout_page["Guest checkout<br/>[Checkout.jsx]"]
  node_checkout_form["Checkout form<br/>[CheckoutForm.jsx]"]
  node_order_success["Order confirmation<br/>[OrderSuccess.jsx]"]
  node_order_tracking["Order tracking<br/>[TrackOrder.jsx]"]
  node_order_records[("Order records<br/>[order.js]")]
  node_wishlist[("Saved wishlist")]
end

subgraph group_identity["Identity and persistence"]
  node_login["Demo sign-in<br/>[Login.jsx]"]
  node_auth_state[("Auth session<br/>[useAuthStore.js]")]
end

subgraph group_services["Data services"]
  node_product_data["Product fetching<br/>[useProducts.js]"]
  node_category_data["Category fetching<br/>[useCategories.js]"]
  node_api_client["HTTP client<br/>[client.js]"]
end

node_visitor(("Store visitor"))
node_dummyjson{{"DummyJSON API"}}
node_browser_storage[("Browser storage")]

node_visitor -->|"browses"| node_app
node_app -->|"renders routes"| node_layout
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_catalog_page
node_app -->|"routes to"| node_product_detail
node_app -->|"routes to"| node_cart_page
node_app -->|"routes to"| node_checkout_page
node_app -->|"routes to"| node_order_success
node_app -->|"routes to"| node_order_tracking
node_app -->|"routes to"| node_login
node_home -->|"loads products"| node_product_data
node_home -->|"loads categories"| node_category_data
node_catalog_page -->|"loads products"| node_product_data
node_catalog_page -->|"filters products"| node_product_filter
node_catalog_page -->|"reads URL state"| node_url_state
node_product_detail -->|"loads product"| node_api_client
node_product_data -->|"requests catalog"| node_api_client
node_category_data -->|"requests categories"| node_api_client
node_api_client -->|"calls API"| node_dummyjson
node_cart_page -->|"reads and updates"| node_cart_store
node_cart_page -->|"calculates totals"| node_cart_math
node_checkout_page -->|"renders form"| node_checkout_form
node_checkout_page -->|"reads cart"| node_cart_store
node_checkout_page -->|"calculates totals"| node_cart_math
node_checkout_page -->|"creates order"| node_order_records
node_order_success -->|"clears cart"| node_cart_store
node_order_tracking -->|"looks up order"| node_order_records
node_login -->|"authenticates"| node_api_client
node_login -->|"sets session"| node_auth_state
node_cart_store -->|"persists state"| node_browser_storage
node_auth_state -->|"persists session"| node_browser_storage
node_wishlist -.->|"persists favorites"| node_browser_storage

click node_app "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/App.jsx"
click node_layout "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/layout/MainLayout.jsx"
click node_home "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Home.jsx"
click node_catalog_page "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Products.jsx"
click node_product_detail "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/ProductDetails.jsx"
click node_product_data "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useProducts.js"
click node_category_data "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useCategories.js"
click node_product_filter "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useFilteredProducts.js"
click node_url_state "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useProductsUrl.js"
click node_cart_page "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Cart.jsx"
click node_cart_store "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/store/useCartStore.js"
click node_cart_math "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/lib/cart.js"
click node_checkout_page "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Checkout.jsx"
click node_checkout_form "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/components/checkout/CheckoutForm.jsx"
click node_order_success "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/OrderSuccess.jsx"
click node_order_tracking "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/TrackOrder.jsx"
click node_order_records "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/lib/order.js"
click node_wishlist "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/store/useWishlistStore.js"
click node_login "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Login.jsx"
click node_auth_state "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/store/useAuthStore.js"
click node_api_client "https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/api/client.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_layout toneBlue
class node_home,node_catalog_page,node_product_detail,node_product_filter,node_url_state,node_browser_storage toneAmber
class node_cart_page,node_cart_store,node_cart_math,node_checkout_page,node_checkout_form,node_order_success,node_order_tracking,node_order_records,node_wishlist,node_dummyjson toneMint
class node_login,node_auth_state toneRose
class node_product_data,node_category_data,node_api_client,node_visitor toneIndigo
```

## Components

### App routing

- [Route application](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/App.jsx): `src/App.jsx`
- [Store layout](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/layout/MainLayout.jsx): `src/layout/MainLayout.jsx`

### Product discovery

- [Store home](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Product catalog](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Products.jsx): `src/pages/Products.jsx`
- [Product details](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/ProductDetails.jsx): `src/pages/ProductDetails.jsx`
- [Catalog filtering](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useFilteredProducts.js): `src/hooks/useFilteredProducts.js`
- [Catalog URL state](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useProductsUrl.js): `src/hooks/useProductsUrl.js`

### Shopping and orders

- [Cart page](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Cart state](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/store/useCartStore.js): `src/store/useCartStore.js`
- [Cart totals](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/lib/cart.js): `src/lib/cart.js`
- [Guest checkout](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [Checkout form](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/components/checkout/CheckoutForm.jsx): `src/components/checkout/CheckoutForm.jsx`
- [Order confirmation](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/OrderSuccess.jsx): `src/pages/OrderSuccess.jsx`
- [Order tracking](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/TrackOrder.jsx): `src/pages/TrackOrder.jsx`
- [Order records](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/lib/order.js): `src/lib/order.js`
- [Saved wishlist](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/store/useWishlistStore.js): `src/store/useWishlistStore.js`

### Identity and persistence

- [Demo sign-in](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Auth session](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/store/useAuthStore.js): `src/store/useAuthStore.js`

### Data services

- [Product fetching](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useProducts.js): `src/hooks/useProducts.js`
- [Category fetching](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/hooks/useCategories.js): `src/hooks/useCategories.js`
- [HTTP client](https://github.com/ammar-antar/shopnow-store-e-commerce/blob/main/src/api/client.js): `src/api/client.js`

### Other components

- **Store visitor**
- **DummyJSON API**
- **Browser storage**

## Connections

- Store visitor → Route application: browses (evidence: `README.md`)
- Route application → Store layout: renders routes (evidence: `src/App.jsx`)
- Route application → Store home: routes to (evidence: `src/App.jsx`)
- Route application → Product catalog: routes to (evidence: `src/App.jsx`)
- Route application → Product details: routes to (evidence: `src/App.jsx`)
- Route application → Cart page: routes to (evidence: `src/App.jsx`)
- Route application → Guest checkout: routes to (evidence: `src/App.jsx`)
- Route application → Order confirmation: routes to (evidence: `src/App.jsx`)
- Route application → Order tracking: routes to (evidence: `src/App.jsx`)
- Route application → Demo sign-in: routes to (evidence: `src/App.jsx`)
- Store home → Product fetching: loads products (evidence: `src/pages/Home.jsx`)
- Store home → Category fetching: loads categories (evidence: `src/pages/Home.jsx`)
- Product catalog → Product fetching: loads products (evidence: `src/pages/Products.jsx`)
- Product catalog → Catalog filtering: filters products (evidence: `src/pages/Products.jsx`)
- Product catalog → Catalog URL state: reads URL state (evidence: `src/pages/Products.jsx`)
- Product details → HTTP client: loads product
- Product fetching → HTTP client: requests catalog (evidence: `src/hooks/useProducts.js`)
- Category fetching → HTTP client: requests categories (evidence: `src/hooks/useCategories.js`)
- HTTP client → DummyJSON API: calls API (evidence: `src/api/client.js`)
- Cart page → Cart state: reads and updates (evidence: `src/pages/Cart.jsx`)
- Cart page → Cart totals: calculates totals (evidence: `src/pages/Cart.jsx`)
- Guest checkout → Checkout form: renders form (evidence: `src/pages/Checkout.jsx`)
- Guest checkout → Cart state: reads cart (evidence: `src/pages/Checkout.jsx`)
- Guest checkout → Cart totals: calculates totals (evidence: `src/pages/Checkout.jsx`)
- Guest checkout → Order records: creates order (evidence: `src/pages/Checkout.jsx`)
- Order confirmation → Cart state: clears cart (evidence: `src/pages/OrderSuccess.jsx`)
- Order tracking → Order records: looks up order (evidence: `src/pages/TrackOrder.jsx`)
- Demo sign-in → HTTP client: authenticates (evidence: `src/pages/Login.jsx`)
- Demo sign-in → Auth session: sets session (evidence: `src/pages/Login.jsx`)
- Cart state → Browser storage: persists state (evidence: `src/store/useCartStore.js`)
- Auth session → Browser storage: persists session (evidence: `src/store/useAuthStore.js`)
- Saved wishlist → Browser storage: persists favorites (evidence: `README.md`)
