# chinnamnaidu592/nexcart_e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/chinnamnaidu592/nexcart_e-commerce
- Repository: https://github.com/chinnamnaidu592/nexcart_e-commerce

## Overview

NexCart is a Next.js storefront with customer accounts, persistent shopping state, checkout, and an admin console. The main customer journey is catalog discovery → product selection → cart → checkout and order history; separate branches cover authentication, wishlist, and admin operations. The graph combines sampled service/context behavior with README-documented product capabilities. Some page-to-component wiring and unsampled subsystems are documented only at a feature level, so those links are dashed where implementation calls were not shown.

Main entry points: [`src/services/orderService.js`](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/orderService.js) (Order service), [`src/services/userService.js`](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/userService.js) (User service), [`src/services/productService.js`](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/productService.js) (Product service), [`src/context/CartContext.jsx`](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/context/CartContext.jsx) (Cart state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_store["Storefront &amp; Catalog"]
  node_home["Home &amp; collections<br/>[page.jsx]"]
  node_catalog["Product discovery<br/>[page.jsx]"]
  node_product_detail["Product details<br/>[page.jsx]"]
  node_product_card["Product card<br/>[ProductCard.jsx]"]
end

subgraph group_purchase["Accounts &amp; Purchasing"]
  node_cart["Shopping cart<br/>[page.jsx]"]
  node_wishlist["Saved wishlist<br/>[page.jsx]"]
  node_checkout["Checkout<br/>[page.jsx]"]
  node_profile["Profile &amp; history<br/>[page.jsx]"]
end

subgraph group_admin["Admin Console"]
  node_admin_dashboard["Executive dashboard<br/>[page.jsx]"]
  node_inventory["Product management<br/>[page.jsx]"]
  node_order_admin["Order management<br/>[page.jsx]"]
  node_customer_admin["Customer management<br/>[page.jsx]"]
  node_analytics["Sales analytics"]
end

subgraph group_core["Application Services"]
  node_catalog_hook["Catalog hook<br/>[useProducts.js]"]
  node_product_service["Product service<br/>[productService.js]"]
  node_cart_state["Cart state<br/>[CartContext.jsx]"]
  node_local_storage[("Browser storage<br/>[storage.js]")]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_user_service["User service<br/>[userService.js]"]
  node_auth_api["Auth route<br/>[route.js]"]
  node_order_service["Order service<br/>[orderService.js]"]
  node_api_client["API client<br/>[apiClient.js]"]
end

node_shopper(("Shopper"))
node_product_api(("DummyJSON API"))

node_shopper -->|"browses"| node_home
node_shopper -->|"searches &amp; filters"| node_catalog
node_catalog -.->|"loads catalog"| node_catalog_hook
node_catalog_hook -->|"fetches products"| node_product_service
node_product_service -->|"requests data"| node_api_client
node_api_client -.->|"calls"| node_product_api
node_shopper -->|"selects product"| node_product_detail
node_product_detail -.->|"adds item"| node_cart_state
node_product_card -->|"adds item"| node_cart_state
node_product_card -.->|"bookmarks item"| node_wishlist
node_shopper -->|"reviews cart"| node_cart
node_cart_state -->|"persists cart"| node_local_storage
node_shopper -->|"signs in or registers"| node_auth
node_auth -->|"authenticates"| node_user_service
node_user_service -->|"stores session"| node_local_storage
node_user_service -->|"posts credentials"| node_auth_api
node_shopper -->|"places order"| node_checkout
node_checkout -->|"submits order"| node_order_service
node_order_service -->|"stores orders"| node_local_storage
node_profile -->|"loads history"| node_order_service
node_shopper -->|"views account"| node_profile
node_admin_dashboard -.->|"loads metrics"| node_analytics
node_admin_dashboard -.->|"shows recent orders"| node_order_service
node_inventory -.->|"manages catalog"| node_product_service
node_order_admin -.->|"updates status"| node_order_service
node_customer_admin -.->|"loads customers"| node_user_service

click node_home "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/page.jsx"
click node_catalog "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/products/page.jsx"
click node_catalog_hook "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/hooks/useProducts.js"
click node_product_service "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/productService.js"
click node_product_detail "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/products/%5Bid%5D/page.jsx"
click node_product_card "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/components/products/ProductCard.jsx"
click node_cart "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/cart/page.jsx"
click node_cart_state "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/context/CartContext.jsx"
click node_local_storage "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/utils/storage.js"
click node_wishlist "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/wishlist/page.jsx"
click node_auth "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/context/AuthContext.jsx"
click node_user_service "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/userService.js"
click node_auth_api "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/api/auth/%5Baction%5D/route.js"
click node_checkout "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/checkout/page.jsx"
click node_order_service "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/orderService.js"
click node_profile "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/profile/page.jsx"
click node_admin_dashboard "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/page.jsx"
click node_inventory "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/products/page.jsx"
click node_order_admin "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/orders/page.jsx"
click node_customer_admin "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/customers/page.jsx"
click node_analytics "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/analyticsService.js"
click node_api_client "https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/apiClient.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_home,node_catalog,node_product_detail,node_product_card toneBlue
class node_cart,node_wishlist,node_checkout,node_profile toneAmber
class node_admin_dashboard,node_inventory,node_order_admin,node_customer_admin,node_analytics,node_product_api toneMint
class node_catalog_hook,node_product_service,node_cart_state,node_local_storage,node_auth,node_user_service,node_auth_api,node_order_service,node_api_client toneRose
class node_shopper toneIndigo
```

## Components

### Storefront & Catalog

- [Home & collections](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/page.jsx): `src/app/page.jsx`
- [Product discovery](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/products/page.jsx): `src/app/products/page.jsx`
- [Product details](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/products/%5Bid%5D/page.jsx): `src/app/products/[id]/page.jsx`
- [Product card](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/components/products/ProductCard.jsx): `src/components/products/ProductCard.jsx`

### Accounts & Purchasing

- [Shopping cart](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/cart/page.jsx): `src/app/cart/page.jsx`
- [Saved wishlist](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/wishlist/page.jsx): `src/app/wishlist/page.jsx`
- [Checkout](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/checkout/page.jsx): `src/app/checkout/page.jsx`
- [Profile & history](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/profile/page.jsx): `src/app/profile/page.jsx`

### Admin Console

- [Executive dashboard](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/page.jsx): `src/app/admin/page.jsx`
- [Product management](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/products/page.jsx): `src/app/admin/products/page.jsx`
- [Order management](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/orders/page.jsx): `src/app/admin/orders/page.jsx`
- [Customer management](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/admin/customers/page.jsx): `src/app/admin/customers/page.jsx`
- [Sales analytics](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/analyticsService.js): `src/services/analyticsService.js`

### Application Services

- [Catalog hook](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/hooks/useProducts.js): `src/hooks/useProducts.js`
- [Product service](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/productService.js): `src/services/productService.js`
- [Cart state](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/context/CartContext.jsx): `src/context/CartContext.jsx`
- [Browser storage](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/utils/storage.js): `src/utils/storage.js`
- [Authentication state](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [User service](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/userService.js): `src/services/userService.js`
- [Auth route](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/app/api/auth/%5Baction%5D/route.js): `src/app/api/auth/[action]/route.js`
- [Order service](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/orderService.js): `src/services/orderService.js`
- [API client](https://github.com/chinnamnaidu592/nexcart_e-commerce/blob/main/src/services/apiClient.js): `src/services/apiClient.js`

### Other components

- **Shopper**
- **DummyJSON API**

## Connections

- Shopper → Home & collections: browses (evidence: `README.md`)
- Shopper → Product discovery: searches & filters (evidence: `README.md`)
- Product discovery → Catalog hook: loads catalog
- Catalog hook → Product service: fetches products (evidence: `src/hooks/useProducts.js`)
- Product service → API client: requests data (evidence: `src/services/productService.js`)
- API client → DummyJSON API: calls
- Shopper → Product details: selects product (evidence: `README.md`)
- Product details → Cart state: adds item
- Product card → Cart state: adds item (evidence: `src/components/products/ProductCard.jsx`)
- Product card → Saved wishlist: bookmarks item
- Shopper → Shopping cart: reviews cart (evidence: `README.md`)
- Cart state → Browser storage: persists cart (evidence: `src/context/CartContext.jsx`)
- Shopper → Authentication state: signs in or registers (evidence: `README.md`)
- Authentication state → User service: authenticates (evidence: `src/context/AuthContext.jsx`)
- User service → Browser storage: stores session (evidence: `src/services/userService.js`)
- User service → Auth route: posts credentials (evidence: `src/services/userService.js`)
- Shopper → Checkout: places order (evidence: `README.md`)
- Checkout → Order service: submits order (evidence: `src/app/checkout/page.jsx`)
- Order service → Browser storage: stores orders (evidence: `src/services/orderService.js`)
- Profile & history → Order service: loads history (evidence: `src/app/profile/page.jsx`)
- Shopper → Profile & history: views account (evidence: `README.md`)
- Executive dashboard → Sales analytics: loads metrics
- Executive dashboard → Order service: shows recent orders
- Product management → Product service: manages catalog (evidence: `README.md`)
- Order management → Order service: updates status (evidence: `README.md`)
- Customer management → User service: loads customers (evidence: `README.md`)
