# mohitsojitra/e-commerce-store architecture

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

- Interactive diagram: https://gitdiagram.com/mohitsojitra/e-commerce-store
- Repository: https://github.com/mohitsojitra/e-commerce-store

## Overview

This is a React/Redux storefront backed by an Express API and MongoDB. Shoppers browse products, view product details, manage a cart, and sign up or sign in; cart and user requests use bearer-token authentication. The graph follows the documented frontend routes into Redux/API calls and the backend's mounted routes into controllers and models. Some screens and backend modules were not excerpted, so their documented or indexed relationships are shown, while uncertain storage and runtime links are omitted.

Main entry points: [`e-comerce-frontend/src/App.jsx`](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/App.jsx) (App routing), [`e-comerce-frontend/src/utils/Api.js`](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/utils/Api.js) (HTTP client), [`e-comerce-backend/backend/server.js`](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/server.js) (Express server), [`e-comerce-backend/backend/middleware/middleware.js`](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/middleware/middleware.js) (Token verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop["Storefront"]
  node_app["App routing<br/>[App.jsx]"]
  node_home["Home screen<br/>[HomeScreen.jsx]"]
  node_productscreen["Product screen<br/>[ProductScreen.jsx]"]
  node_cartscreen["Cart screen<br/>[CartScreen.jsx]"]
  node_authscreens["Sign-in and sign-up<br/>[index.jsx]"]
  node_navigation["Navigation drawer<br/>[SideDrawer.jsx]"]
end

subgraph group_state["Client state and API"]
  node_redux["Redux store<br/>[store.js]"]
  node_productactions["Product actions<br/>[productActions.js]"]
  node_cartactions["Cart actions<br/>[cartActions.js]"]
  node_useractions["User actions<br/>[userAction.js]"]
  node_apihelper["HTTP client<br/>[Api.js]"]
  node_tokenstore["Token storage<br/>[localstorage.js]"]
end

subgraph group_api["Backend API"]
  node_server["Express server<br/>[server.js]"]
  node_dbconnection["Database connection<br/>[db.js]"]
end

subgraph group_identity["Identity and access"]
  node_userroutes["User routes<br/>[userRoutes.js]"]
  node_usercontroller["User controller<br/>[user.controller.js]"]
  node_usermodel[("User records<br/>[User.js]")]
  node_authmiddleware["Token verification<br/>[middleware.js]"]
  node_tokenutils["Token utilities"]
end

subgraph group_catalog["Catalog and cart"]
  node_productroutes["Product routes<br/>[productRoutes.js]"]
  node_productcontroller["Product controller"]
  node_productmodel[("Product records<br/>[Product.js]")]
  node_cartroutes["Cart routes<br/>[cartRoutes.js]"]
  node_cartcontroller["Cart controller<br/>[cart.controller.js]"]
  node_cartmodel[("Cart records<br/>[Cart.js]")]
end

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

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_productscreen
node_app -->|"routes to"| node_cartscreen
node_app -->|"routes to"| node_authscreens
node_app -->|"renders"| node_navigation
node_home -->|"dispatches"| node_productactions
node_productscreen -->|"dispatches"| node_productactions
node_productscreen -->|"dispatches"| node_cartactions
node_cartscreen -->|"dispatches"| node_cartactions
node_app -->|"loads cart"| node_cartactions
node_app -->|"loads user"| node_useractions
node_productactions -->|"requests data"| node_apihelper
node_cartactions -->|"requests data"| node_apihelper
node_useractions -->|"requests data"| node_apihelper
node_authscreens -->|"submits credentials"| node_apihelper
node_apihelper -->|"reads token"| node_tokenstore
node_redux -->|"provides state"| node_app
node_apihelper -.->|"sends HTTP requests"| node_server
node_server -->|"connects"| node_dbconnection
node_server -->|"mounts"| node_productroutes
node_server -->|"mounts"| node_cartroutes
node_server -->|"mounts"| node_userroutes
node_productroutes -->|"routes to"| node_productcontroller
node_productcontroller -->|"queries"| node_productmodel
node_cartroutes -->|"routes to"| node_cartcontroller
node_cartcontroller -->|"queries"| node_cartmodel
node_cartroutes -->|"guards requests"| node_authmiddleware
node_userroutes -->|"routes to"| node_usercontroller
node_userroutes -->|"guards profile"| node_authmiddleware
node_usercontroller -->|"queries"| node_usermodel
node_authmiddleware -->|"loads user"| node_usermodel
node_authmiddleware -->|"verifies token"| node_tokenutils
node_usercontroller -->|"creates token"| node_tokenutils
node_dbconnection -.->|"connects"| node_mongodb

click node_app "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/App.jsx"
click node_home "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/HomeScreen.jsx"
click node_productscreen "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/ProductScreen.jsx"
click node_cartscreen "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/CartScreen.jsx"
click node_authscreens "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/SignIn/index.jsx"
click node_navigation "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/components/SideDrawer.jsx"
click node_redux "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/store.js"
click node_productactions "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/actions/productActions.js"
click node_cartactions "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/actions/cartActions.js"
click node_useractions "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/actions/userAction.js"
click node_apihelper "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/utils/Api.js"
click node_tokenstore "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/utils/localstorage.js"
click node_server "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/server.js"
click node_productroutes "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/routes/productRoutes.js"
click node_productcontroller "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/controller/productControllers.js"
click node_productmodel "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/models/Product.js"
click node_cartroutes "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/routes/cartRoutes.js"
click node_cartcontroller "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/controller/cart.controller.js"
click node_cartmodel "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/models/Cart.js"
click node_userroutes "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/routes/userRoutes.js"
click node_usercontroller "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/controller/user.controller.js"
click node_usermodel "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/models/User.js"
click node_authmiddleware "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/middleware/middleware.js"
click node_tokenutils "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/utils/utility.function.js"
click node_dbconnection "https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/config/db.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_app,node_home,node_productscreen,node_cartscreen,node_authscreens,node_navigation toneBlue
class node_redux,node_productactions,node_cartactions,node_useractions,node_apihelper,node_tokenstore,node_mongodb toneAmber
class node_server,node_dbconnection toneMint
class node_userroutes,node_usercontroller,node_usermodel,node_authmiddleware,node_tokenutils toneRose
class node_productroutes,node_productcontroller,node_productmodel,node_cartroutes,node_cartcontroller,node_cartmodel,node_shopper toneIndigo
```

## Components

### Storefront

- [App routing](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/App.jsx): `e-comerce-frontend/src/App.jsx`
- [Home screen](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/HomeScreen.jsx): `e-comerce-frontend/src/screens/HomeScreen.jsx`
- [Product screen](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/ProductScreen.jsx): `e-comerce-frontend/src/screens/ProductScreen.jsx`
- [Cart screen](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/CartScreen.jsx): `e-comerce-frontend/src/screens/CartScreen.jsx`
- [Sign-in and sign-up](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/screens/SignIn/index.jsx): `e-comerce-frontend/src/screens/SignIn/index.jsx`
- [Navigation drawer](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/components/SideDrawer.jsx): `e-comerce-frontend/src/components/SideDrawer.jsx`

### Client state and API

- [Redux store](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/store.js): `e-comerce-frontend/src/redux/store.js`
- [Product actions](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/actions/productActions.js): `e-comerce-frontend/src/redux/actions/productActions.js`
- [Cart actions](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/actions/cartActions.js): `e-comerce-frontend/src/redux/actions/cartActions.js`
- [User actions](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/redux/actions/userAction.js): `e-comerce-frontend/src/redux/actions/userAction.js`
- [HTTP client](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/utils/Api.js): `e-comerce-frontend/src/utils/Api.js`
- [Token storage](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-frontend/src/utils/localstorage.js): `e-comerce-frontend/src/utils/localstorage.js`

### Backend API

- [Express server](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/server.js): `e-comerce-backend/backend/server.js`
- [Database connection](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/config/db.js): `e-comerce-backend/backend/config/db.js`

### Identity and access

- [User routes](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/routes/userRoutes.js): `e-comerce-backend/backend/routes/userRoutes.js`
- [User controller](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/controller/user.controller.js): `e-comerce-backend/backend/controller/user.controller.js`
- [User records](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/models/User.js): `e-comerce-backend/backend/models/User.js`
- [Token verification](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/middleware/middleware.js): `e-comerce-backend/backend/middleware/middleware.js`
- [Token utilities](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/utils/utility.function.js): `e-comerce-backend/backend/utils/utility.function.js`

### Catalog and cart

- [Product routes](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/routes/productRoutes.js): `e-comerce-backend/backend/routes/productRoutes.js`
- [Product controller](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/controller/productControllers.js): `e-comerce-backend/backend/controller/productControllers.js`
- [Product records](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/models/Product.js): `e-comerce-backend/backend/models/Product.js`
- [Cart routes](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/routes/cartRoutes.js): `e-comerce-backend/backend/routes/cartRoutes.js`
- [Cart controller](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/controller/cart.controller.js): `e-comerce-backend/backend/controller/cart.controller.js`
- [Cart records](https://github.com/mohitsojitra/e-commerce-store/blob/master/e-comerce-backend/backend/models/Cart.js): `e-comerce-backend/backend/models/Cart.js`

### Other components

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

## Connections

- Shopper → App routing: uses (evidence: `e-comerce-frontend/src/App.jsx`)
- App routing → Home screen: routes to (evidence: `e-comerce-frontend/src/App.jsx`)
- App routing → Product screen: routes to (evidence: `e-comerce-frontend/src/App.jsx`)
- App routing → Cart screen: routes to (evidence: `e-comerce-frontend/src/App.jsx`)
- App routing → Sign-in and sign-up: routes to (evidence: `e-comerce-frontend/src/App.jsx`)
- App routing → Navigation drawer: renders (evidence: `e-comerce-frontend/src/App.jsx`)
- Home screen → Product actions: dispatches (evidence: `e-comerce-frontend/src/screens/HomeScreen.jsx`)
- Product screen → Product actions: dispatches (evidence: `e-comerce-frontend/src/screens/ProductScreen.jsx`)
- Product screen → Cart actions: dispatches (evidence: `e-comerce-frontend/src/screens/ProductScreen.jsx`)
- Cart screen → Cart actions: dispatches (evidence: `e-comerce-frontend/src/screens/CartScreen.jsx`)
- App routing → Cart actions: loads cart (evidence: `e-comerce-frontend/src/App.jsx`)
- App routing → User actions: loads user (evidence: `e-comerce-frontend/src/App.jsx`)
- Product actions → HTTP client: requests data (evidence: `e-comerce-frontend/src/redux/actions/productActions.js`)
- Cart actions → HTTP client: requests data (evidence: `e-comerce-frontend/src/redux/actions/cartActions.js`)
- User actions → HTTP client: requests data (evidence: `e-comerce-frontend/src/redux/actions/userAction.js`)
- Sign-in and sign-up → HTTP client: submits credentials (evidence: `e-comerce-frontend/src/screens/SignIn/index.jsx`)
- HTTP client → Token storage: reads token (evidence: `e-comerce-frontend/src/utils/Api.js`)
- Redux store → App routing: provides state (evidence: `e-comerce-frontend/src/main.jsx`)
- HTTP client → Express server: sends HTTP requests
- Express server → Database connection: connects (evidence: `e-comerce-backend/backend/server.js`)
- Express server → Product routes: mounts (evidence: `e-comerce-backend/backend/server.js`)
- Express server → Cart routes: mounts (evidence: `e-comerce-backend/backend/server.js`)
- Express server → User routes: mounts (evidence: `e-comerce-backend/backend/server.js`)
- Product routes → Product controller: routes to (evidence: `e-comerce-backend/backend/routes/productRoutes.js`)
- Product controller → Product records: queries (evidence: `e-comerce-backend/backend/controller/productControllers.js`)
- Cart routes → Cart controller: routes to (evidence: `e-comerce-backend/backend/routes/cartRoutes.js`)
- Cart controller → Cart records: queries (evidence: `e-comerce-backend/backend/controller/cart.controller.js`)
- Cart routes → Token verification: guards requests (evidence: `e-comerce-backend/backend/routes/cartRoutes.js`)
- User routes → User controller: routes to (evidence: `e-comerce-backend/backend/routes/userRoutes.js`)
- User routes → Token verification: guards profile (evidence: `e-comerce-backend/backend/routes/userRoutes.js`)
- User controller → User records: queries (evidence: `e-comerce-backend/backend/controller/user.controller.js`)
- Token verification → User records: loads user (evidence: `e-comerce-backend/backend/middleware/middleware.js`)
- Token verification → Token utilities: verifies token (evidence: `e-comerce-backend/backend/middleware/middleware.js`)
- User controller → Token utilities: creates token (evidence: `e-comerce-backend/backend/controller/user.controller.js`)
- Database connection → MongoDB: connects
