# geniusstudent24/amazon-app architecture

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

- Interactive diagram: https://gitdiagram.com/geniusstudent24/amazon-app
- Repository: https://github.com/geniusstudent24/amazon-app

## Overview

amazon-app is a storefront with a React shopping flow backed by an Express API: shoppers browse products, manage a cart, authenticate, and place or review orders. The backend also supports profile and delivery-location operations and an AI chat endpoint. The graph distinguishes frontend route/state layers from API services and persistence models. The README contains no capability detail; several page and service implementations were not excerpted, so their internal links are omitted where evidence is unavailable.

Main entry points: [`src/App.jsx`](https://github.com/geniusstudent24/amazon-app/blob/main/src/App.jsx) (Route application), [`backend/services/order.jsx`](https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/order.jsx) (Order service), [`backend/services/auth.jsx`](https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/auth.jsx) (Authentication and cart), [`src/context/CartContext.jsx`](https://github.com/geniusstudent24/amazon-app/blob/main/src/context/CartContext.jsx) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["Route application<br/>[App.jsx]"]
  node_home["Home discovery<br/>[Home.jsx]"]
  node_catalog["Product lists<br/>[ProductLists.jsx]"]
  node_detail["Product detail<br/>[ProductDetail.jsx]"]
  node_navigation["Navigation UI<br/>[Navbar.jsx]"]
  node_menu["Department menu<br/>[Menu.jsx]"]
  node_footer["Footer UI<br/>[Footer.jsx]"]
  node_assistant["AI assistant UI<br/>[AiAssistant.jsx]"]
end

subgraph group_shopping["Shopping"]
  node_productstate["Product state<br/>[ProductContext.jsx]"]
  node_cartstate["Cart state<br/>[CartContext.jsx]"]
  node_cartpage["Cart page<br/>[Cart.jsx]"]
  node_checkout["Checkout<br/>[Checkout.jsx]"]
  node_orderresult["Order confirmation<br/>[OrderPlaced.jsx]"]
  node_orderspage["Order history<br/>[MyOrders.jsx]"]
end

subgraph group_account["Account"]
  node_login["Login<br/>[Login.jsx]"]
  node_profile["Profile<br/>[profile.jsx]"]
  node_history["Browsing history"]
  node_language["Language settings"]
end

subgraph group_backend["API services"]
  node_api["Express application<br/>[app.js]"]
  node_productsapi["Product API<br/>[productRoutes.js]"]
  node_authapi["Authentication and cart<br/>[auth.jsx]"]
  node_ordersapi["Order service<br/>[order.jsx]"]
  node_aiservice["AI chat service<br/>[aiChat.js]"]
  node_authguard["JWT middleware<br/>[auth.jsx]"]
end

subgraph group_persistence["Persistence"]
  node_productdata["Product catalog data<br/>[db.json]"]
  node_userstore[("User model<br/>[user.jsx]")]
  node_cartstore[("Cart model<br/>[Cart.jsx]")]
  node_orderstore[("Order model<br/>[Order.jsx]")]
  node_locationstore[("Location model<br/>[Location.jsx]")]
end

node_shopper(("Shopper"))
node_mongodb[("MongoDB")]

node_shopper -->|"uses"| node_app
node_app -->|"routes"| node_home
node_app -->|"routes"| node_catalog
node_app -->|"routes"| node_detail
node_app -->|"routes"| node_cartpage
node_app -->|"routes"| node_checkout
node_app -->|"routes"| node_orderresult
node_app -->|"routes"| node_orderspage
node_app -->|"routes"| node_login
node_app -->|"routes"| node_profile
node_app -->|"routes"| node_history
node_app -->|"routes"| node_language
node_app -->|"renders"| node_assistant
node_home -->|"reads products"| node_productstate
node_productstate -->|"fetches products"| node_productsapi
node_productsapi -->|"reads catalog"| node_productdata
node_cartstate -->|"cart requests"| node_authapi
node_cartstate -->|"loads product details"| node_productsapi
node_navigation -->|"reads count"| node_cartstate
node_cartpage -->|"uses cart"| node_cartstate
node_checkout -->|"uses cart"| node_cartstate
node_orderresult -->|"uses cart"| node_cartstate
node_api -->|"mounts routes"| node_authapi
node_api -->|"mounts routes"| node_ordersapi
node_api -->|"mounts routes"| node_productsapi
node_api -->|"requests response"| node_aiservice
node_authapi -->|"guards requests"| node_authguard
node_ordersapi -->|"guards requests"| node_authguard
node_authapi -->|"reads and writes"| node_userstore
node_authapi -->|"reads and writes"| node_cartstore
node_authapi -->|"reads and writes"| node_locationstore
node_ordersapi -->|"reads and writes"| node_orderstore
node_ordersapi -->|"clears cart"| node_cartstore
node_ordersapi -->|"loads user"| node_userstore
node_ordersapi -->|"loads location"| node_locationstore
node_api -->|"connects"| node_mongodb

click node_app "https://github.com/geniusstudent24/amazon-app/blob/main/src/App.jsx"
click node_home "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Home.jsx"
click node_catalog "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/ProductLists.jsx"
click node_detail "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/ProductDetail.jsx"
click node_navigation "https://github.com/geniusstudent24/amazon-app/blob/main/src/components/Navbar.jsx"
click node_menu "https://github.com/geniusstudent24/amazon-app/blob/main/src/components/Menu.jsx"
click node_footer "https://github.com/geniusstudent24/amazon-app/blob/main/src/components/Footer.jsx"
click node_productstate "https://github.com/geniusstudent24/amazon-app/blob/main/src/context/ProductContext.jsx"
click node_cartstate "https://github.com/geniusstudent24/amazon-app/blob/main/src/context/CartContext.jsx"
click node_cartpage "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Cart.jsx"
click node_checkout "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Checkout.jsx"
click node_orderresult "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/OrderPlaced.jsx"
click node_orderspage "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/MyOrders.jsx"
click node_login "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Login.jsx"
click node_profile "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/profile.jsx"
click node_history "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/BrowsingHistory.jsx"
click node_language "https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/LanguageSetting.jsx"
click node_assistant "https://github.com/geniusstudent24/amazon-app/blob/main/src/components/AiAssistant.jsx"
click node_api "https://github.com/geniusstudent24/amazon-app/blob/main/backend/app.js"
click node_productsapi "https://github.com/geniusstudent24/amazon-app/blob/main/backend/routes/productRoutes.js"
click node_authapi "https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/auth.jsx"
click node_ordersapi "https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/order.jsx"
click node_aiservice "https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/aiChat.js"
click node_authguard "https://github.com/geniusstudent24/amazon-app/blob/main/backend/midleware/auth.jsx"
click node_productdata "https://github.com/geniusstudent24/amazon-app/blob/main/backend/data/db.json"
click node_userstore "https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/user.jsx"
click node_cartstore "https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/Cart.jsx"
click node_orderstore "https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/Order.jsx"
click node_locationstore "https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/Location.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_home,node_catalog,node_detail,node_navigation,node_menu,node_footer,node_assistant toneBlue
class node_productstate,node_cartstate,node_cartpage,node_checkout,node_orderresult,node_orderspage,node_mongodb toneAmber
class node_login,node_profile,node_history,node_language toneMint
class node_api,node_productsapi,node_authapi,node_ordersapi,node_aiservice,node_authguard toneRose
class node_productdata,node_userstore,node_cartstore,node_orderstore,node_locationstore,node_shopper toneIndigo
```

## Components

### Storefront

- [Route application](https://github.com/geniusstudent24/amazon-app/blob/main/src/App.jsx): `src/App.jsx`
- [Home discovery](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Product lists](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/ProductLists.jsx): `src/pages/ProductLists.jsx`
- [Product detail](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/ProductDetail.jsx): `src/pages/ProductDetail.jsx`
- [Navigation UI](https://github.com/geniusstudent24/amazon-app/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Department menu](https://github.com/geniusstudent24/amazon-app/blob/main/src/components/Menu.jsx): `src/components/Menu.jsx`
- [Footer UI](https://github.com/geniusstudent24/amazon-app/blob/main/src/components/Footer.jsx): `src/components/Footer.jsx`
- [AI assistant UI](https://github.com/geniusstudent24/amazon-app/blob/main/src/components/AiAssistant.jsx): `src/components/AiAssistant.jsx`

### Shopping

- [Product state](https://github.com/geniusstudent24/amazon-app/blob/main/src/context/ProductContext.jsx): `src/context/ProductContext.jsx`
- [Cart state](https://github.com/geniusstudent24/amazon-app/blob/main/src/context/CartContext.jsx): `src/context/CartContext.jsx`
- [Cart page](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Cart.jsx): `src/pages/Cart.jsx`
- [Checkout](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Checkout.jsx): `src/pages/Checkout.jsx`
- [Order confirmation](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/OrderPlaced.jsx): `src/pages/OrderPlaced.jsx`
- [Order history](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/MyOrders.jsx): `src/pages/MyOrders.jsx`

### Account

- [Login](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Profile](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/profile.jsx): `src/pages/profile.jsx`
- [Browsing history](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/BrowsingHistory.jsx): `src/pages/BrowsingHistory.jsx`
- [Language settings](https://github.com/geniusstudent24/amazon-app/blob/main/src/pages/LanguageSetting.jsx): `src/pages/LanguageSetting.jsx`

### API services

- [Express application](https://github.com/geniusstudent24/amazon-app/blob/main/backend/app.js): `backend/app.js`
- [Product API](https://github.com/geniusstudent24/amazon-app/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Authentication and cart](https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/auth.jsx): `backend/services/auth.jsx`
- [Order service](https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/order.jsx): `backend/services/order.jsx`
- [AI chat service](https://github.com/geniusstudent24/amazon-app/blob/main/backend/services/aiChat.js): `backend/services/aiChat.js`
- [JWT middleware](https://github.com/geniusstudent24/amazon-app/blob/main/backend/midleware/auth.jsx): `backend/midleware/auth.jsx`

### Persistence

- [Product catalog data](https://github.com/geniusstudent24/amazon-app/blob/main/backend/data/db.json): `backend/data/db.json`
- [User model](https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/user.jsx): `backend/model/user.jsx`
- [Cart model](https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/Cart.jsx): `backend/model/Cart.jsx`
- [Order model](https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/Order.jsx): `backend/model/Order.jsx`
- [Location model](https://github.com/geniusstudent24/amazon-app/blob/main/backend/model/Location.jsx): `backend/model/Location.jsx`

### Other components

- **Shopper**
- **MongoDB**

## Connections

- Shopper → Route application: uses (evidence: `src/App.jsx`)
- Route application → Home discovery: routes (evidence: `src/App.jsx`)
- Route application → Product lists: routes (evidence: `src/App.jsx`)
- Route application → Product detail: routes (evidence: `src/App.jsx`)
- Route application → Cart page: routes (evidence: `src/App.jsx`)
- Route application → Checkout: routes (evidence: `src/App.jsx`)
- Route application → Order confirmation: routes (evidence: `src/App.jsx`)
- Route application → Order history: routes (evidence: `src/App.jsx`)
- Route application → Login: routes (evidence: `src/App.jsx`)
- Route application → Profile: routes (evidence: `src/App.jsx`)
- Route application → Browsing history: routes (evidence: `src/App.jsx`)
- Route application → Language settings: routes (evidence: `src/App.jsx`)
- Route application → AI assistant UI: renders (evidence: `src/App.jsx`)
- Home discovery → Product state: reads products (evidence: `src/pages/Home.jsx`)
- Product state → Product API: fetches products (evidence: `src/context/ProductContext.jsx`)
- Product API → Product catalog data: reads catalog (evidence: `backend/routes/productRoutes.js`)
- Cart state → Authentication and cart: cart requests (evidence: `src/context/CartContext.jsx`)
- Cart state → Product API: loads product details (evidence: `src/context/CartContext.jsx`)
- Navigation UI → Cart state: reads count (evidence: `src/components/Navbar.jsx`)
- Cart page → Cart state: uses cart (evidence: `src/pages/Cart.jsx`)
- Checkout → Cart state: uses cart (evidence: `src/pages/Checkout.jsx`)
- Order confirmation → Cart state: uses cart (evidence: `src/pages/OrderPlaced.jsx`)
- Express application → Authentication and cart: mounts routes (evidence: `backend/app.js`)
- Express application → Order service: mounts routes (evidence: `backend/app.js`)
- Express application → Product API: mounts routes (evidence: `backend/app.js`)
- Express application → AI chat service: requests response (evidence: `backend/app.js`)
- Authentication and cart → JWT middleware: guards requests (evidence: `backend/services/auth.jsx`)
- Order service → JWT middleware: guards requests (evidence: `backend/services/order.jsx`)
- Authentication and cart → User model: reads and writes (evidence: `backend/services/auth.jsx`)
- Authentication and cart → Cart model: reads and writes (evidence: `backend/services/auth.jsx`)
- Authentication and cart → Location model: reads and writes (evidence: `backend/services/auth.jsx`)
- Order service → Order model: reads and writes (evidence: `backend/services/order.jsx`)
- Order service → Cart model: clears cart (evidence: `backend/services/order.jsx`)
- Order service → User model: loads user (evidence: `backend/services/order.jsx`)
- Order service → Location model: loads location (evidence: `backend/services/order.jsx`)
- Express application → MongoDB: connects (evidence: `backend/app.js`)
