# mousahijazi/nexmart architecture

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

- Interactive diagram: https://gitdiagram.com/mousahijazi/nexmart
- Repository: https://github.com/mousahijazi/nexmart

## Overview

Nexmart is an ecommerce web application. A customer browses the storefront, manages a cart, and places and tracks orders; the backend exposes versioned APIs and applies business logic and persistence. The tree also shows product reviews, payment, authentication, and extensive admin management. Source excerpts confirm selected review, order, and authentication calls; most frontend route wiring and several backend domains are unsampled, so those connections are omitted or marked unverified.

Main entry points: [`client/src/app/api/backend/[...path]/route.js`](https://github.com/mousahijazi/nexmart/blob/main/client/src/app/api/backend/%5B...path%5D/route.js) (Backend proxy), [`server/src/service/orders/orderService.js`](https://github.com/mousahijazi/nexmart/blob/main/server/src/service/orders/orderService.js) (Order service), [`server/src/middlewares/auth.js`](https://github.com/mousahijazi/nexmart/blob/main/server/src/middlewares/auth.js) (Authentication), [`server/src/routes/v1/reviewRoutes.js`](https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/reviewRoutes.js) (Review routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_store["Storefront pages<br/>[page.jsx]"]
  node_catalog["Product browsing"]
  node_productdetail["Product details<br/>[page.jsx]"]
  node_cart["Cart"]
  node_checkout["Checkout and payment"]
  node_reviewsui["Product reviews"]
end

subgraph group_clientstate["Client state and access"]
  node_usercontext["User state<br/>[UserProvider.js]"]
  node_adminui["Admin dashboard"]
  node_proxy["Backend proxy<br/>[route.js]"]
end

subgraph group_api["Backend API"]
  node_app["Express application<br/>[app.js]"]
  node_reviewroutes["Review routes<br/>[reviewRoutes.js]"]
  node_orderroutes["Customer order routes<br/>[orderRoutes.js]"]
  node_adminroutes["Admin order routes"]
  node_auth["Authentication<br/>[auth.js]"]
  node_reviewcontroller["Review controller"]
  node_ordercontroller["Order controller<br/>[orderController.js]"]
  node_adminordercontroller["Admin order controller"]
end

subgraph group_domain["Commerce services"]
  node_reviewservice["Review service<br/>[reviewService.js]"]
  node_orderservice["Order service<br/>[orderService.js]"]
  node_adminorderservice["Admin order service"]
  node_cartservice["Cart pricing<br/>[cartService.js]"]
end

subgraph group_persistence["Persistence"]
  node_reviewmodel[("Review records<br/>[Review.js]")]
  node_productmodel[("Product records<br/>[Product.js]")]
  node_orderrepos[("Order repositories<br/>[orderRepository.js]")]
  node_orderitemrepos[("Order item repositories")]
  node_userrepos[("User repository<br/>[usersRepository.js]")]
end

node_customer(("Customer"))

node_customer -.->|"browses"| node_store
node_store -.->|"opens catalog"| node_catalog
node_customer -.->|"manages cart"| node_cart
node_customer -.->|"checks out"| node_checkout
node_app -->|"mounts API routes"| node_reviewroutes
node_reviewroutes -->|"routes requests"| node_reviewcontroller
node_reviewroutes -->|"authenticates"| node_auth
node_reviewcontroller -->|"calls"| node_reviewservice
node_reviewservice -->|"reads and writes"| node_reviewmodel
node_reviewservice -->|"updates ratings"| node_productmodel
node_orderroutes -->|"routes requests"| node_ordercontroller
node_orderroutes -->|"authenticates"| node_auth
node_ordercontroller -->|"calls"| node_orderservice
node_orderservice -->|"prices cart"| node_cartservice
node_orderservice -->|"reads and creates"| node_orderrepos
node_orderservice -->|"manages items"| node_orderitemrepos
node_orderservice -->|"reserves stock"| node_productmodel
node_adminroutes -->|"routes requests"| node_adminordercontroller
node_adminroutes -->|"authenticates"| node_auth
node_adminordercontroller -->|"calls"| node_adminorderservice
node_auth -->|"loads user session"| node_userrepos
node_proxy -.->|"forwards API traffic"| node_app
node_usercontext -.->|"uses backend"| node_proxy
node_catalog -.->|"requests products"| node_proxy
node_checkout -.->|"submits orders"| node_proxy
node_reviewsui -.->|"requests reviews"| node_proxy
node_adminui -.->|"requests admin data"| node_proxy

click node_store "https://github.com/mousahijazi/nexmart/blob/main/client/src/app/%5Blocale%5D/page.jsx"
click node_catalog "https://github.com/mousahijazi/nexmart/tree/main/client/src/components/products"
click node_productdetail "https://github.com/mousahijazi/nexmart/blob/main/client/src/app/%5Blocale%5D/products/%5Bid%5D/page.jsx"
click node_cart "https://github.com/mousahijazi/nexmart/tree/main/client/src/components/cart"
click node_checkout "https://github.com/mousahijazi/nexmart/tree/main/client/src/components/Checkout"
click node_reviewsui "https://github.com/mousahijazi/nexmart/blob/main/client/src/components/products/productReviews/ProductsReviews.jsx"
click node_usercontext "https://github.com/mousahijazi/nexmart/blob/main/client/src/Context/UserProvider.js"
click node_adminui "https://github.com/mousahijazi/nexmart/tree/main/client/src/components/Dashboard/AdminDashboard"
click node_proxy "https://github.com/mousahijazi/nexmart/blob/main/client/src/app/api/backend/%5B...path%5D/route.js"
click node_app "https://github.com/mousahijazi/nexmart/blob/main/server/src/app.js"
click node_reviewroutes "https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/reviewRoutes.js"
click node_orderroutes "https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/orders/orderRoutes.js"
click node_adminroutes "https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/orders/adminOrderRoutes.js"
click node_auth "https://github.com/mousahijazi/nexmart/blob/main/server/src/middlewares/auth.js"
click node_reviewcontroller "https://github.com/mousahijazi/nexmart/blob/main/server/src/controllers/reviewController.js"
click node_ordercontroller "https://github.com/mousahijazi/nexmart/blob/main/server/src/controllers/orders/orderController.js"
click node_adminordercontroller "https://github.com/mousahijazi/nexmart/blob/main/server/src/controllers/orders/adminOrderController.js"
click node_reviewservice "https://github.com/mousahijazi/nexmart/blob/main/server/src/service/reviewService.js"
click node_orderservice "https://github.com/mousahijazi/nexmart/blob/main/server/src/service/orders/orderService.js"
click node_adminorderservice "https://github.com/mousahijazi/nexmart/blob/main/server/src/service/orders/adminOrderService.js"
click node_cartservice "https://github.com/mousahijazi/nexmart/blob/main/server/src/service/cartService.js"
click node_reviewmodel "https://github.com/mousahijazi/nexmart/blob/main/server/src/model/Review.js"
click node_productmodel "https://github.com/mousahijazi/nexmart/blob/main/server/src/model/Product.js"
click node_orderrepos "https://github.com/mousahijazi/nexmart/blob/main/server/src/repositories/orderRepository.js"
click node_orderitemrepos "https://github.com/mousahijazi/nexmart/blob/main/server/src/repositories/orderItemRepository.js"
click node_userrepos "https://github.com/mousahijazi/nexmart/blob/main/server/src/repositories/usersRepository.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_store,node_catalog,node_productdetail,node_cart,node_checkout,node_reviewsui toneBlue
class node_usercontext,node_adminui,node_proxy toneAmber
class node_app,node_reviewroutes,node_orderroutes,node_adminroutes,node_auth,node_reviewcontroller,node_ordercontroller,node_adminordercontroller toneMint
class node_reviewservice,node_orderservice,node_adminorderservice,node_cartservice toneRose
class node_reviewmodel,node_productmodel,node_orderrepos,node_orderitemrepos,node_userrepos,node_customer toneIndigo
```

## Components

### Customer storefront

- [Storefront pages](https://github.com/mousahijazi/nexmart/blob/main/client/src/app/%5Blocale%5D/page.jsx): `client/src/app/[locale]/page.jsx`
- [Product browsing](https://github.com/mousahijazi/nexmart/tree/main/client/src/components/products): `client/src/components/products`
- [Product details](https://github.com/mousahijazi/nexmart/blob/main/client/src/app/%5Blocale%5D/products/%5Bid%5D/page.jsx): `client/src/app/[locale]/products/[id]/page.jsx`
- [Cart](https://github.com/mousahijazi/nexmart/tree/main/client/src/components/cart): `client/src/components/cart`
- [Checkout and payment](https://github.com/mousahijazi/nexmart/tree/main/client/src/components/Checkout): `client/src/components/Checkout`
- [Product reviews](https://github.com/mousahijazi/nexmart/blob/main/client/src/components/products/productReviews/ProductsReviews.jsx): `client/src/components/products/productReviews/ProductsReviews.jsx`

### Client state and access

- [User state](https://github.com/mousahijazi/nexmart/blob/main/client/src/Context/UserProvider.js): `client/src/Context/UserProvider.js`
- [Admin dashboard](https://github.com/mousahijazi/nexmart/tree/main/client/src/components/Dashboard/AdminDashboard): `client/src/components/Dashboard/AdminDashboard`
- [Backend proxy](https://github.com/mousahijazi/nexmart/blob/main/client/src/app/api/backend/%5B...path%5D/route.js): `client/src/app/api/backend/[...path]/route.js`

### Backend API

- [Express application](https://github.com/mousahijazi/nexmart/blob/main/server/src/app.js): `server/src/app.js`
- [Review routes](https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/reviewRoutes.js): `server/src/routes/v1/reviewRoutes.js`
- [Customer order routes](https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/orders/orderRoutes.js): `server/src/routes/v1/orders/orderRoutes.js`
- [Admin order routes](https://github.com/mousahijazi/nexmart/blob/main/server/src/routes/v1/orders/adminOrderRoutes.js): `server/src/routes/v1/orders/adminOrderRoutes.js`
- [Authentication](https://github.com/mousahijazi/nexmart/blob/main/server/src/middlewares/auth.js): `server/src/middlewares/auth.js`
- [Review controller](https://github.com/mousahijazi/nexmart/blob/main/server/src/controllers/reviewController.js): `server/src/controllers/reviewController.js`
- [Order controller](https://github.com/mousahijazi/nexmart/blob/main/server/src/controllers/orders/orderController.js): `server/src/controllers/orders/orderController.js`
- [Admin order controller](https://github.com/mousahijazi/nexmart/blob/main/server/src/controllers/orders/adminOrderController.js): `server/src/controllers/orders/adminOrderController.js`

### Commerce services

- [Review service](https://github.com/mousahijazi/nexmart/blob/main/server/src/service/reviewService.js): `server/src/service/reviewService.js`
- [Order service](https://github.com/mousahijazi/nexmart/blob/main/server/src/service/orders/orderService.js): `server/src/service/orders/orderService.js`
- [Admin order service](https://github.com/mousahijazi/nexmart/blob/main/server/src/service/orders/adminOrderService.js): `server/src/service/orders/adminOrderService.js`
- [Cart pricing](https://github.com/mousahijazi/nexmart/blob/main/server/src/service/cartService.js): `server/src/service/cartService.js`

### Persistence

- [Review records](https://github.com/mousahijazi/nexmart/blob/main/server/src/model/Review.js): `server/src/model/Review.js`
- [Product records](https://github.com/mousahijazi/nexmart/blob/main/server/src/model/Product.js): `server/src/model/Product.js`
- [Order repositories](https://github.com/mousahijazi/nexmart/blob/main/server/src/repositories/orderRepository.js): `server/src/repositories/orderRepository.js`
- [Order item repositories](https://github.com/mousahijazi/nexmart/blob/main/server/src/repositories/orderItemRepository.js): `server/src/repositories/orderItemRepository.js`
- [User repository](https://github.com/mousahijazi/nexmart/blob/main/server/src/repositories/usersRepository.js): `server/src/repositories/usersRepository.js`

### Other components

- **Customer**

## Connections

- Customer → Storefront pages: browses
- Storefront pages → Product browsing: opens catalog
- Customer → Cart: manages cart
- Customer → Checkout and payment: checks out
- Express application → Review routes: mounts API routes (evidence: `server/src/app.js`)
- Review routes → Review controller: routes requests (evidence: `server/src/routes/v1/reviewRoutes.js`)
- Review routes → Authentication: authenticates (evidence: `server/src/routes/v1/reviewRoutes.js`)
- Review controller → Review service: calls (evidence: `server/src/controllers/reviewController.js`)
- Review service → Review records: reads and writes (evidence: `server/src/service/reviewService.js`)
- Review service → Product records: updates ratings (evidence: `server/src/service/reviewService.js`)
- Customer order routes → Order controller: routes requests (evidence: `server/src/routes/v1/orders/orderRoutes.js`)
- Customer order routes → Authentication: authenticates (evidence: `server/src/routes/v1/orders/orderRoutes.js`)
- Order controller → Order service: calls (evidence: `server/src/controllers/orders/orderController.js`)
- Order service → Cart pricing: prices cart (evidence: `server/src/service/orders/orderService.js`)
- Order service → Order repositories: reads and creates (evidence: `server/src/service/orders/orderService.js`)
- Order service → Order item repositories: manages items (evidence: `server/src/service/orders/orderService.js`)
- Order service → Product records: reserves stock (evidence: `server/src/service/orders/orderService.js`)
- Admin order routes → Admin order controller: routes requests (evidence: `server/src/routes/v1/orders/adminOrderRoutes.js`)
- Admin order routes → Authentication: authenticates (evidence: `server/src/routes/v1/orders/adminOrderRoutes.js`)
- Admin order controller → Admin order service: calls (evidence: `server/src/controllers/orders/adminOrderController.js`)
- Authentication → User repository: loads user session (evidence: `server/src/middlewares/auth.js`)
- Backend proxy → Express application: forwards API traffic
- User state → Backend proxy: uses backend
- Product browsing → Backend proxy: requests products
- Checkout and payment → Backend proxy: submits orders
- Product reviews → Backend proxy: requests reviews
- Admin dashboard → Backend proxy: requests admin data
