# sabi0603/amazon-frontend-clone architecture

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

- Interactive diagram: https://gitdiagram.com/sabi0603/amazon-frontend-clone
- Repository: https://github.com/sabi0603/amazon-frontend-clone

## Overview

This is a React storefront clone whose main journey is browse or search products, inspect an item, add it to the cart, complete checkout, and view order confirmation. Routing and shared providers form the application shell; product data is local, while cart, wishlist, authentication, and order state are managed in contexts with browser storage. The graph preserves the README’s additional account, deals, theme, and informational-page capabilities. Some page implementations were not sampled, so their presence and route wiring rely on the route index and README rather than inspected page internals.

Main entry points: [`src/routes/index.jsx`](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/routes/index.jsx) (Route table), [`src/App.jsx`](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/App.jsx) (App providers), [`src/context/CartProvider.jsx`](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/CartProvider.jsx) (Cart state), [`src/pages/ProductDetails.jsx`](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/ProductDetails.jsx) (Product details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Application shell"]
  node_entry["React entry<br/>[main.jsx]"]
  node_app["App providers<br/>[App.jsx]"]
  node_router["Route table<br/>[index.jsx]"]
  node_layout["Store layout<br/>[AppLayout.jsx]"]
  node_header["Navigation header<br/>[Header.jsx]"]
  node_storage[("Browser storage<br/>[storage.js]")]
end

subgraph group_discovery["Product discovery"]
  node_browse["Catalog and deals"]
  node_product_data["Product catalog data<br/>[products.js]"]
  node_product_service["Product service<br/>[productService.js]"]
  node_product_hooks["Product query hooks"]
  node_search["Search results<br/>[SearchResults.jsx]"]
  node_product_detail["Product details<br/>[ProductDetails.jsx]"]
  node_product_ui["Product components"]
end

subgraph group_shopping["Shopping and orders"]
  node_cart["Cart page<br/>[Cart.jsx]"]
  node_checkout["Checkout flow<br/>[Checkout.jsx]"]
  node_order_confirmation["Order confirmation"]
  node_cart_state["Cart state<br/>[CartProvider.jsx]"]
  node_order_state["Order state<br/>[OrderProvider.jsx]"]
  node_checkout_helper["Checkout helper<br/>[checkout.js]"]
end

subgraph group_identity["Account and preferences"]
  node_auth_pages["Sign-in and profile"]
  node_auth_state["Authentication state<br/>[AuthProvider.jsx]"]
  node_protected_route["Protected access<br/>[ProtectedRoute.jsx]"]
  node_wishlist["Wishlist<br/>[Wishlist.jsx]"]
  node_wishlist_state["Wishlist state"]
  node_theme_state["Theme state<br/>[ThemeProvider.jsx]"]
end

subgraph group_support["Storefront services"]
  node_informational["Store information pages"]
  node_service_ui["Shared UI states"]
end

node_shopper(("Shopper"))

node_shopper -->|"opens store"| node_router
node_entry -->|"renders"| node_app
node_app -->|"provides routes"| node_router
node_app -->|"wraps"| node_auth_state
node_app -->|"wraps"| node_cart_state
node_app -->|"wraps"| node_order_state
node_app -->|"wraps"| node_wishlist_state
node_app -->|"wraps"| node_theme_state
node_router -->|"routes through"| node_layout
node_router -->|"routes to"| node_browse
node_router -->|"routes to"| node_search
node_router -->|"routes to"| node_product_detail
node_router -->|"routes to"| node_cart
node_router -->|"routes to"| node_checkout
node_router -->|"routes to"| node_order_confirmation
node_router -->|"routes to"| node_auth_pages
node_router -->|"routes to"| node_wishlist
node_router -->|"routes to"| node_informational
node_layout -->|"renders"| node_header
node_search -->|"queries through"| node_product_hooks
node_search -->|"renders cards"| node_product_ui
node_search -->|"renders states"| node_service_ui
node_product_hooks -->|"calls search"| node_product_service
node_product_hooks -->|"loads products"| node_product_service
node_product_service -->|"reads catalog"| node_product_data
node_product_detail -->|"loads item"| node_product_hooks
node_product_detail -->|"renders gallery"| node_product_ui
node_product_detail -->|"adds item"| node_cart_state
node_product_detail -->|"toggles item"| node_wishlist_state
node_cart -.->|"uses cart"| node_cart_state
node_checkout -.->|"uses cart"| node_cart_state
node_checkout -->|"uses helper"| node_checkout_helper
node_checkout -.->|"creates order"| node_order_state
node_order_confirmation -.->|"reads order"| node_order_state
node_auth_pages -.->|"uses account state"| node_auth_state
node_protected_route -->|"checks identity"| node_auth_state
node_wishlist -.->|"uses wishlist"| node_wishlist_state
node_auth_state -->|"persists auth"| node_storage
node_cart_state -->|"persists cart"| node_storage
node_order_state -->|"persists order"| node_storage
node_wishlist_state -->|"persists wishlist"| node_storage
node_header -->|"reads cart"| node_cart_state
node_header -->|"reads account"| node_auth_state

click node_entry "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/main.jsx"
click node_app "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/App.jsx"
click node_router "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/routes/index.jsx"
click node_layout "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/components/layout/AppLayout.jsx"
click node_header "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/components/layout/Header.jsx"
click node_browse "https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/pages"
click node_product_data "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/data/products.js"
click node_product_service "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/services/productService.js"
click node_product_hooks "https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/hooks"
click node_search "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/SearchResults.jsx"
click node_product_detail "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/ProductDetails.jsx"
click node_product_ui "https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/components/product"
click node_cart "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/Cart.jsx"
click node_checkout "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/Checkout.jsx"
click node_order_confirmation "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/OrderConfirmation.jsx"
click node_cart_state "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/CartProvider.jsx"
click node_order_state "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/OrderProvider.jsx"
click node_checkout_helper "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/utils/checkout.js"
click node_auth_pages "https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/pages"
click node_auth_state "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/AuthProvider.jsx"
click node_protected_route "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/components/common/ProtectedRoute.jsx"
click node_wishlist "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/Wishlist.jsx"
click node_wishlist_state "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/WishlistProvider.jsx"
click node_theme_state "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/ThemeProvider.jsx"
click node_storage "https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/utils/storage.js"
click node_informational "https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/pages"
click node_service_ui "https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/components/ui"

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_entry,node_app,node_router,node_layout,node_header,node_storage toneBlue
class node_browse,node_product_data,node_product_service,node_product_hooks,node_search,node_product_detail,node_product_ui toneAmber
class node_cart,node_checkout,node_order_confirmation,node_cart_state,node_order_state,node_checkout_helper toneMint
class node_auth_pages,node_auth_state,node_protected_route,node_wishlist,node_wishlist_state,node_theme_state toneRose
class node_informational,node_service_ui,node_shopper toneIndigo
```

## Components

### Application shell

- [React entry](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/main.jsx): `src/main.jsx`
- [App providers](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/App.jsx): `src/App.jsx`
- [Route table](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/routes/index.jsx): `src/routes/index.jsx`
- [Store layout](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/components/layout/AppLayout.jsx): `src/components/layout/AppLayout.jsx`
- [Navigation header](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/components/layout/Header.jsx): `src/components/layout/Header.jsx`
- [Browser storage](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/utils/storage.js): `src/utils/storage.js`

### Product discovery

- [Catalog and deals](https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/pages): `src/pages`
- [Product catalog data](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/data/products.js): `src/data/products.js`
- [Product service](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/services/productService.js): `src/services/productService.js`
- [Product query hooks](https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/hooks): `src/hooks`
- [Search results](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/SearchResults.jsx): `src/pages/SearchResults.jsx`
- [Product details](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/ProductDetails.jsx): `src/pages/ProductDetails.jsx`
- [Product components](https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/components/product): `src/components/product`

### Shopping and orders

- [Cart page](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Checkout flow](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [Order confirmation](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/OrderConfirmation.jsx): `src/pages/OrderConfirmation.jsx`
- [Cart state](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/CartProvider.jsx): `src/context/CartProvider.jsx`
- [Order state](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/OrderProvider.jsx): `src/context/OrderProvider.jsx`
- [Checkout helper](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/utils/checkout.js): `src/utils/checkout.js`

### Account and preferences

- [Sign-in and profile](https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/pages): `src/pages`
- [Authentication state](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/AuthProvider.jsx): `src/context/AuthProvider.jsx`
- [Protected access](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/components/common/ProtectedRoute.jsx): `src/components/common/ProtectedRoute.jsx`
- [Wishlist](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/pages/Wishlist.jsx): `src/pages/Wishlist.jsx`
- [Wishlist state](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/WishlistProvider.jsx): `src/context/WishlistProvider.jsx`
- [Theme state](https://github.com/sabi0603/amazon-frontend-clone/blob/main/src/context/ThemeProvider.jsx): `src/context/ThemeProvider.jsx`

### Storefront services

- [Store information pages](https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/pages): `src/pages`
- [Shared UI states](https://github.com/sabi0603/amazon-frontend-clone/tree/main/src/components/ui): `src/components/ui`

### Other components

- **Shopper**

## Connections

- Shopper → Route table: opens store (evidence: `README.md`)
- React entry → App providers: renders (evidence: `src/main.jsx`)
- App providers → Route table: provides routes (evidence: `src/App.jsx`)
- App providers → Authentication state: wraps (evidence: `src/App.jsx`)
- App providers → Cart state: wraps (evidence: `src/App.jsx`)
- App providers → Order state: wraps (evidence: `src/App.jsx`)
- App providers → Wishlist state: wraps (evidence: `src/App.jsx`)
- App providers → Theme state: wraps (evidence: `src/App.jsx`)
- Route table → Store layout: routes through (evidence: `src/routes/index.jsx`)
- Route table → Catalog and deals: routes to (evidence: `src/routes/index.jsx`)
- Route table → Search results: routes to (evidence: `src/routes/index.jsx`)
- Route table → Product details: routes to (evidence: `src/routes/index.jsx`)
- Route table → Cart page: routes to (evidence: `src/routes/index.jsx`)
- Route table → Checkout flow: routes to (evidence: `src/routes/index.jsx`)
- Route table → Order confirmation: routes to (evidence: `src/routes/index.jsx`)
- Route table → Sign-in and profile: routes to (evidence: `src/routes/index.jsx`)
- Route table → Wishlist: routes to (evidence: `src/routes/index.jsx`)
- Route table → Store information pages: routes to (evidence: `src/routes/index.jsx`)
- Store layout → Navigation header: renders (evidence: `src/components/layout/AppLayout.jsx`)
- Search results → Product query hooks: queries through (evidence: `src/pages/SearchResults.jsx`)
- Search results → Product components: renders cards (evidence: `src/pages/SearchResults.jsx`)
- Search results → Shared UI states: renders states (evidence: `src/pages/SearchResults.jsx`)
- Product query hooks → Product service: calls search (evidence: `src/hooks/useSearchProducts.js`)
- Product query hooks → Product service: loads products (evidence: `src/hooks/useProducts.js`)
- Product service → Product catalog data: reads catalog (evidence: `src/services/productService.js`)
- Product details → Product query hooks: loads item (evidence: `src/pages/ProductDetails.jsx`)
- Product details → Product components: renders gallery (evidence: `src/pages/ProductDetails.jsx`)
- Product details → Cart state: adds item (evidence: `src/pages/ProductDetails.jsx`)
- Product details → Wishlist state: toggles item (evidence: `src/pages/ProductDetails.jsx`)
- Cart page → Cart state: uses cart
- Checkout flow → Cart state: uses cart
- Checkout flow → Checkout helper: uses helper
- Checkout flow → Order state: creates order
- Order confirmation → Order state: reads order
- Sign-in and profile → Authentication state: uses account state
- Protected access → Authentication state: checks identity (evidence: `src/components/common/ProtectedRoute.jsx`)
- Wishlist → Wishlist state: uses wishlist
- Authentication state → Browser storage: persists auth (evidence: `src/context/AuthProvider.jsx`)
- Cart state → Browser storage: persists cart (evidence: `src/context/CartProvider.jsx`)
- Order state → Browser storage: persists order (evidence: `src/context/OrderProvider.jsx`)
- Wishlist state → Browser storage: persists wishlist (evidence: `src/context/WishlistProvider.jsx`)
- Navigation header → Cart state: reads cart (evidence: `src/components/layout/Header.jsx`)
- Navigation header → Authentication state: reads account (evidence: `src/components/layout/Header.jsx`)
