# abdo-zaghloul/cart architecture

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

- Interactive diagram: https://gitdiagram.com/abdo-zaghloul/cart
- Repository: https://github.com/abdo-zaghloul/cart

## Overview

This is a React e-commerce storefront: users browse products, manage a cart or wishlist, submit cash or online checkout, and view orders. The graph follows the routed pages through the evidenced hooks and API modules; several unsampled features are represented by their source directories. The README is only a Vite template and documents no product behavior, so feature relationships beyond the source index are omitted.

Main entry points: [`src/App.jsx`](https://github.com/abdo-zaghloul/cart/blob/main/src/App.jsx) (App Router), [`src/pages/Home/Home.jsx`](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Home/Home.jsx) (Home Page), [`src/Hooks/auth`](https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/auth) (Auth Mutations), [`src/pages/Login/Login.jsx`](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Login/Login.jsx) (Login Flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_router["App Router<br/>[App.jsx]"]
  node_layout["Shared Layout<br/>[Layout.jsx]"]
end

subgraph group_identity["Identity"]
  node_auth["Auth State<br/>[AuthContext.jsx]"]
  node_protected["Route Guard<br/>[ProtectedRoute.jsx]"]
  node_login["Login Flow<br/>[Login.jsx]"]
  node_loginform["Login Form<br/>[FormLogin.jsx]"]
  node_register["Registration Flow<br/>[Register.jsx]"]
  node_registerform["Registration Form<br/>[FormRegister.jsx]"]
  node_authhooks["Auth Mutations"]
  node_authapi["Auth API<br/>[authApi.js]"]
end

subgraph group_catalog["Catalog"]
  node_home["Home Page<br/>[Home.jsx]"]
  node_catalogui["Home Catalog UI"]
  node_categoryhook["Category Query"]
  node_producthook["Product Query"]
  node_homeapi["Home Catalog API<br/>[Home.js]"]
  node_categorypage["Categories Page<br/>[Categories.jsx]"]
  node_brandpage["Brands Page<br/>[Brands.jsx]"]
  node_brandhook["Brand Query<br/>[useBrands.jsx]"]
  node_brandapi["Brand API<br/>[BrandApi.js]"]
  node_productdetail["Product Details<br/>[ProductDetails.jsx]"]
  node_productdetailhook["Product Detail Query"]
  node_productapi["Product Detail API"]
end

subgraph group_shopping["Shopping"]
  node_cartpage["Cart Page<br/>[Cart.jsx]"]
  node_cartui["Cart UI<br/>[ShoppingCart.jsx]"]
  node_carthooks["Cart Operations"]
  node_cartapi["Cart API<br/>[cart.js]"]
  node_wishlistpage["Wishlist Page<br/>[WishList.jsx]"]
  node_wishlistui["Wishlist UI"]
  node_wishhooks["Wishlist Operations"]
  node_wishapi["Wishlist API<br/>[wishlistApi.js]"]
end

subgraph group_commerce["Orders and Payment"]
  node_checkoutpage["Checkout Page<br/>[CheckOut.jsx]"]
  node_checkouthooks["Payment Mutations"]
  node_checkoutapi["Checkout API<br/>[CheckOutApi.js]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses storefront"| node_router
node_router -->|"wraps routes"| node_layout
node_router -->|"routes to"| node_home
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_register
node_router -->|"routes to"| node_categorypage
node_router -->|"routes to"| node_brandpage
node_router -->|"routes to"| node_productdetail
node_router -->|"routes to"| node_cartpage
node_router -->|"routes to"| node_wishlistpage
node_router -->|"routes to"| node_checkoutpage
node_router -->|"guards home"| node_protected
node_protected -->|"checks session"| node_auth
node_login -->|"renders"| node_loginform
node_login -->|"uses mutation"| node_authhooks
node_register -->|"renders"| node_registerform
node_register -->|"uses mutation"| node_authhooks
node_authhooks -->|"calls"| node_authapi
node_authhooks -->|"updates session"| node_auth
node_home -->|"renders"| node_catalogui
node_home -->|"loads products"| node_producthook
node_home -->|"adds products"| node_carthooks
node_catalogui -->|"loads categories"| node_categoryhook
node_categorypage -->|"uses query"| node_categoryhook
node_categoryhook -->|"calls"| node_homeapi
node_producthook -->|"calls"| node_homeapi
node_brandpage -->|"uses query"| node_brandhook
node_brandhook -->|"calls"| node_brandapi
node_productdetail -.->|"uses query"| node_productdetailhook
node_productdetailhook -->|"calls"| node_productapi
node_cartpage -->|"renders"| node_cartui
node_cartpage -->|"loads cart"| node_carthooks
node_carthooks -->|"calls"| node_cartapi
node_wishlistpage -.->|"renders"| node_wishlistui
node_wishlistpage -.->|"loads and edits"| node_wishhooks
node_wishhooks -->|"calls"| node_wishapi
node_checkoutpage -->|"submits payment"| node_checkouthooks
node_checkouthooks -->|"calls"| node_checkoutapi

click node_router "https://github.com/abdo-zaghloul/cart/blob/main/src/App.jsx"
click node_layout "https://github.com/abdo-zaghloul/cart/blob/main/src/components/Layout/Layout.jsx"
click node_auth "https://github.com/abdo-zaghloul/cart/blob/main/src/context/AuthContext.jsx"
click node_protected "https://github.com/abdo-zaghloul/cart/blob/main/src/ProtectedRoute/ProtectedRoute.jsx"
click node_login "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Login/Login.jsx"
click node_loginform "https://github.com/abdo-zaghloul/cart/blob/main/src/components/auth/FormLogin/FormLogin.jsx"
click node_register "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Register/Register.jsx"
click node_registerform "https://github.com/abdo-zaghloul/cart/blob/main/src/components/auth/FormRegister/FormRegister.jsx"
click node_authhooks "https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/auth"
click node_authapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/authApi.js"
click node_home "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Home/Home.jsx"
click node_catalogui "https://github.com/abdo-zaghloul/cart/tree/main/src/components/Home"
click node_categoryhook "https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/Home/useCategoriesHome.jsx"
click node_producthook "https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/Home/useProductsHome.jsx"
click node_homeapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/Home.js"
click node_categorypage "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Categories/Categories.jsx"
click node_brandpage "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Brands/Brands.jsx"
click node_brandhook "https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/Brands/useBrands.jsx"
click node_brandapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/BrandApi.js"
click node_productdetail "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/ProductDetails/ProductDetails.jsx"
click node_productdetailhook "https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/ProductDetails/useProductDetails.jsx"
click node_productapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/ProductNestedApi.js"
click node_cartpage "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Cart/Cart.jsx"
click node_cartui "https://github.com/abdo-zaghloul/cart/blob/main/src/components/cart/ShoppingCart.jsx"
click node_carthooks "https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/cart"
click node_cartapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/cart.js"
click node_wishlistpage "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/WishList/WishList.jsx"
click node_wishlistui "https://github.com/abdo-zaghloul/cart/tree/main/src/components/WishList"
click node_wishhooks "https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/Wishlist"
click node_wishapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/wishlistApi.js"
click node_checkoutpage "https://github.com/abdo-zaghloul/cart/blob/main/src/pages/CheckOut/CheckOut.jsx"
click node_checkouthooks "https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/CheckOut"
click node_checkoutapi "https://github.com/abdo-zaghloul/cart/blob/main/src/api/CheckOutApi.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_router,node_layout toneBlue
class node_auth,node_protected,node_login,node_loginform,node_register,node_registerform,node_authhooks,node_authapi toneAmber
class node_home,node_catalogui,node_categoryhook,node_producthook,node_homeapi,node_categorypage,node_brandpage,node_brandhook,node_brandapi,node_productdetail,node_productdetailhook,node_productapi toneMint
class node_cartpage,node_cartui,node_carthooks,node_cartapi,node_wishlistpage,node_wishlistui,node_wishhooks,node_wishapi toneRose
class node_checkoutpage,node_checkouthooks,node_checkoutapi,node_shopper toneIndigo
```

## Components

### Application Shell

- [App Router](https://github.com/abdo-zaghloul/cart/blob/main/src/App.jsx): `src/App.jsx`
- [Shared Layout](https://github.com/abdo-zaghloul/cart/blob/main/src/components/Layout/Layout.jsx): `src/components/Layout/Layout.jsx`

### Identity

- [Auth State](https://github.com/abdo-zaghloul/cart/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Route Guard](https://github.com/abdo-zaghloul/cart/blob/main/src/ProtectedRoute/ProtectedRoute.jsx): `src/ProtectedRoute/ProtectedRoute.jsx`
- [Login Flow](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Login/Login.jsx): `src/pages/Login/Login.jsx`
- [Login Form](https://github.com/abdo-zaghloul/cart/blob/main/src/components/auth/FormLogin/FormLogin.jsx): `src/components/auth/FormLogin/FormLogin.jsx`
- [Registration Flow](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Register/Register.jsx): `src/pages/Register/Register.jsx`
- [Registration Form](https://github.com/abdo-zaghloul/cart/blob/main/src/components/auth/FormRegister/FormRegister.jsx): `src/components/auth/FormRegister/FormRegister.jsx`
- [Auth Mutations](https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/auth): `src/Hooks/auth`
- [Auth API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/authApi.js): `src/api/authApi.js`

### Catalog

- [Home Page](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Home/Home.jsx): `src/pages/Home/Home.jsx`
- [Home Catalog UI](https://github.com/abdo-zaghloul/cart/tree/main/src/components/Home): `src/components/Home`
- [Category Query](https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/Home/useCategoriesHome.jsx): `src/Hooks/Home/useCategoriesHome.jsx`
- [Product Query](https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/Home/useProductsHome.jsx): `src/Hooks/Home/useProductsHome.jsx`
- [Home Catalog API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/Home.js): `src/api/Home.js`
- [Categories Page](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Categories/Categories.jsx): `src/pages/Categories/Categories.jsx`
- [Brands Page](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Brands/Brands.jsx): `src/pages/Brands/Brands.jsx`
- [Brand Query](https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/Brands/useBrands.jsx): `src/Hooks/Brands/useBrands.jsx`
- [Brand API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/BrandApi.js): `src/api/BrandApi.js`
- [Product Details](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/ProductDetails/ProductDetails.jsx): `src/pages/ProductDetails/ProductDetails.jsx`
- [Product Detail Query](https://github.com/abdo-zaghloul/cart/blob/main/src/Hooks/ProductDetails/useProductDetails.jsx): `src/Hooks/ProductDetails/useProductDetails.jsx`
- [Product Detail API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/ProductNestedApi.js): `src/api/ProductNestedApi.js`

### Shopping

- [Cart Page](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/Cart/Cart.jsx): `src/pages/Cart/Cart.jsx`
- [Cart UI](https://github.com/abdo-zaghloul/cart/blob/main/src/components/cart/ShoppingCart.jsx): `src/components/cart/ShoppingCart.jsx`
- [Cart Operations](https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/cart): `src/Hooks/cart`
- [Cart API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/cart.js): `src/api/cart.js`
- [Wishlist Page](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/WishList/WishList.jsx): `src/pages/WishList/WishList.jsx`
- [Wishlist UI](https://github.com/abdo-zaghloul/cart/tree/main/src/components/WishList): `src/components/WishList`
- [Wishlist Operations](https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/Wishlist): `src/Hooks/Wishlist`
- [Wishlist API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/wishlistApi.js): `src/api/wishlistApi.js`

### Orders and Payment

- [Checkout Page](https://github.com/abdo-zaghloul/cart/blob/main/src/pages/CheckOut/CheckOut.jsx): `src/pages/CheckOut/CheckOut.jsx`
- [Payment Mutations](https://github.com/abdo-zaghloul/cart/tree/main/src/Hooks/CheckOut): `src/Hooks/CheckOut`
- [Checkout API](https://github.com/abdo-zaghloul/cart/blob/main/src/api/CheckOutApi.js): `src/api/CheckOutApi.js`

### Other components

- **Shopper**

## Connections

- Shopper → App Router: uses storefront (evidence: `src/App.jsx`)
- App Router → Shared Layout: wraps routes (evidence: `src/App.jsx`)
- App Router → Home Page: routes to (evidence: `src/App.jsx`)
- App Router → Login Flow: routes to (evidence: `src/App.jsx`)
- App Router → Registration Flow: routes to (evidence: `src/App.jsx`)
- App Router → Categories Page: routes to (evidence: `src/App.jsx`)
- App Router → Brands Page: routes to (evidence: `src/App.jsx`)
- App Router → Product Details: routes to (evidence: `src/App.jsx`)
- App Router → Cart Page: routes to (evidence: `src/App.jsx`)
- App Router → Wishlist Page: routes to (evidence: `src/App.jsx`)
- App Router → Checkout Page: routes to (evidence: `src/App.jsx`)
- App Router → Route Guard: guards home (evidence: `src/App.jsx`)
- Route Guard → Auth State: checks session (evidence: `src/ProtectedRoute/ProtectedRoute.jsx`)
- Login Flow → Login Form: renders (evidence: `src/pages/Login/Login.jsx`)
- Login Flow → Auth Mutations: uses mutation (evidence: `src/pages/Login/Login.jsx`)
- Registration Flow → Registration Form: renders (evidence: `src/pages/Register/Register.jsx`)
- Registration Flow → Auth Mutations: uses mutation (evidence: `src/pages/Register/Register.jsx`)
- Auth Mutations → Auth API: calls (evidence: `src/Hooks/auth/useRegister.jsx`)
- Auth Mutations → Auth State: updates session (evidence: `src/Hooks/auth/useRegister.jsx`)
- Home Page → Home Catalog UI: renders (evidence: `src/pages/Home/Home.jsx`)
- Home Page → Product Query: loads products (evidence: `src/pages/Home/Home.jsx`)
- Home Page → Cart Operations: adds products (evidence: `src/pages/Home/Home.jsx`)
- Home Catalog UI → Category Query: loads categories (evidence: `src/components/Home/CategoriesHome.jsx`)
- Categories Page → Category Query: uses query (evidence: `src/pages/Categories/Categories.jsx`)
- Category Query → Home Catalog API: calls (evidence: `src/Hooks/Home/useCategoriesHome.jsx`)
- Product Query → Home Catalog API: calls (evidence: `src/Hooks/Home/useProductsHome.jsx`)
- Brands Page → Brand Query: uses query (evidence: `src/pages/Brands/Brands.jsx`)
- Brand Query → Brand API: calls (evidence: `src/Hooks/Brands/useBrands.jsx`)
- Product Details → Product Detail Query: uses query
- Product Detail Query → Product Detail API: calls (evidence: `src/Hooks/ProductDetails/useProductDetails.jsx`)
- Cart Page → Cart UI: renders (evidence: `src/pages/Cart/Cart.jsx`)
- Cart Page → Cart Operations: loads cart (evidence: `src/pages/Cart/Cart.jsx`)
- Cart Operations → Cart API: calls (evidence: `src/Hooks/cart/useAddCart.jsx`)
- Wishlist Page → Wishlist UI: renders
- Wishlist Page → Wishlist Operations: loads and edits
- Wishlist Operations → Wishlist API: calls (evidence: `src/Hooks/Wishlist/useAddWishlist.jsx`)
- Checkout Page → Payment Mutations: submits payment (evidence: `src/pages/CheckOut/CheckOut.jsx`)
- Payment Mutations → Checkout API: calls (evidence: `src/Hooks/CheckOut/useCashOrders.jsx`)
