# lalitj2104/shop-drop architecture

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

- Interactive diagram: https://gitdiagram.com/lalitj2104/shop-drop
- Repository: https://github.com/lalitj2104/shop-drop

## Overview

ShopDrop is a multi-role commerce application: shoppers browse products, manage carts and wishlists, place and track orders, and review purchases; retailers manage products and orders, while admins have separate management screens. A companion games app offers several logged-in games and a leaderboard. The backend exposes commerce and game routes, with MongoDB-backed models and a Socket.IO game server. Frontend-to-API wiring and several route/controller details were not shown, so those connections are omitted rather than inferred.

Main entry points: [`backend/index.js`](https://github.com/lalitj2104/shop-drop/blob/main/backend/index.js) (Commerce API), [`backend/models`](https://github.com/lalitj2104/shop-drop/tree/main/backend/models) (Commerce models), [`game/src/App.js`](https://github.com/lalitj2104/shop-drop/blob/main/game/src/App.js) (Games application), [`frontend/src/App.jsx`](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/App.jsx) (Web application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopper["Shopper experience"]
  node_shopper["Shopper routes<br/>[index.jsx]"]
  node_shopperpages["Shopper pages"]
end

subgraph group_selleradmin["Seller and admin"]
  node_retailerroutes["Retailer routes<br/>[index.jsx]"]
  node_retailerpages["Retailer dashboard"]
  node_adminroutes["Admin routes<br/>[index.jsx]"]
  node_adminpages["Admin screens<br/>[Admin.jsx]"]
end

subgraph group_commerceapi["Commerce services"]
  node_commerceentry["Commerce API<br/>[index.js]"]
  node_useraccounts["Account services<br/>[userController.js]"]
  node_retailaccounts["Retailer services"]
  node_catalog["Product catalog"]
  node_cart["Cart operations<br/>[cartController.js]"]
  node_orders["Order lifecycle<br/>[orderController.js]"]
  node_reviews["Product reviews"]
  node_wishlist["Wishlist<br/>[userController.js]"]
  node_adminapi["Admin services<br/>[adminContoller.js]"]
end

subgraph group_identitydata["Identity and data"]
  node_userauth["User authentication<br/>[isAuth.js]"]
  node_retailauth["Retailer authentication<br/>[retailAuth.js]"]
  node_models[("Commerce models")]
  node_gameusers[("Game accounts<br/>[gameUser.js]")]
end

subgraph group_games["Games"]
  node_gamefrontend["Games application<br/>[App.js]"]
  node_gameportal["Game portal<br/>[Main.js]"]
  node_gameplay["Game experiences"]
  node_leaderboard["Leaderboard<br/>[LeaderBoard.js]"]
  node_gameapi["Game API<br/>[gameRoute.js]"]
  node_gamelogic["Multiplayer logic<br/>[game-logic.js]"]
end

node_frontendapp["Web application<br/>[App.jsx]"]
node_mongodb[("MongoDB")]
node_player(("Player"))

node_frontendapp -->|"mounts routes"| node_shopper
node_frontendapp -->|"mounts routes"| node_retailerroutes
node_frontendapp -->|"mounts routes"| node_adminroutes
node_shopper -.->|"routes to"| node_shopperpages
node_retailerroutes -.->|"routes to"| node_retailerpages
node_adminroutes -.->|"routes to"| node_adminpages
node_commerceentry -.->|"mounts routes"| node_useraccounts
node_commerceentry -.->|"mounts routes"| node_retailaccounts
node_commerceentry -->|"mounts routes"| node_catalog
node_commerceentry -->|"mounts routes"| node_wishlist
node_commerceentry -->|"mounts routes"| node_orders
node_commerceentry -->|"mounts routes"| node_cart
node_commerceentry -->|"mounts routes"| node_reviews
node_commerceentry -->|"mounts routes"| node_adminapi
node_userauth -->|"loads user"| node_models
node_retailauth -->|"loads retailer"| node_models
node_orders -->|"reads and writes"| node_models
node_catalog -->|"reads and writes"| node_models
node_reviews -->|"reads and writes"| node_models
node_retailaccounts -->|"reads and writes"| node_models
node_useraccounts -->|"reads and writes"| node_models
node_commerceentry -->|"connects database"| node_mongodb
node_gamefrontend -->|"routes to"| node_gameportal
node_gamefrontend -->|"routes to"| node_gameplay
node_gamefrontend -->|"routes to"| node_leaderboard
node_gameportal -.->|"serves games"| node_player
node_gameapi -->|"uses accounts"| node_gameusers
node_commerceentry -->|"mounts route"| node_gameapi
node_commerceentry -->|"dispatches socket events"| node_gamelogic
node_gamelogic -->|"handles connection"| node_player
node_leaderboard -.->|"fetches scores"| node_gameapi

click node_shopper "https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/routes/user/index.jsx"
click node_shopperpages "https://github.com/lalitj2104/shop-drop/tree/main/frontend/src/pages"
click node_retailerroutes "https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/routes/retailer/index.jsx"
click node_retailerpages "https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/pages/RetailerDashboard/RetailerDashboard.jsx"
click node_adminroutes "https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/routes/Admin/index.jsx"
click node_adminpages "https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/pages/Admin/Admin.jsx"
click node_frontendapp "https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/App.jsx"
click node_commerceentry "https://github.com/lalitj2104/shop-drop/blob/main/backend/index.js"
click node_useraccounts "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/userController.js"
click node_retailaccounts "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/retailerController.js"
click node_catalog "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/productController.js"
click node_cart "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/cartController.js"
click node_orders "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/orderController.js"
click node_reviews "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/reviewController.js"
click node_wishlist "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/userController.js"
click node_adminapi "https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/adminContoller.js"
click node_userauth "https://github.com/lalitj2104/shop-drop/blob/main/backend/middleware/isAuth.js"
click node_retailauth "https://github.com/lalitj2104/shop-drop/blob/main/backend/middleware/retailAuth.js"
click node_models "https://github.com/lalitj2104/shop-drop/tree/main/backend/models"
click node_gamefrontend "https://github.com/lalitj2104/shop-drop/blob/main/game/src/App.js"
click node_gameportal "https://github.com/lalitj2104/shop-drop/blob/main/game/src/components/Main/Main.js"
click node_gameplay "https://github.com/lalitj2104/shop-drop/tree/main/game/src/components"
click node_leaderboard "https://github.com/lalitj2104/shop-drop/blob/main/game/src/components/Main/LeaderBoard/LeaderBoard.js"
click node_gameapi "https://github.com/lalitj2104/shop-drop/blob/main/backend/routes/gameRoute.js"
click node_gamelogic "https://github.com/lalitj2104/shop-drop/blob/main/backend/utils/game-logic.js"
click node_gameusers "https://github.com/lalitj2104/shop-drop/blob/main/backend/models/gameUser.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_shopper,node_shopperpages toneBlue
class node_retailerroutes,node_retailerpages,node_adminroutes,node_adminpages,node_mongodb toneAmber
class node_commerceentry,node_useraccounts,node_retailaccounts,node_catalog,node_cart,node_orders,node_reviews,node_wishlist,node_adminapi toneMint
class node_userauth,node_retailauth,node_models,node_gameusers toneRose
class node_gamefrontend,node_gameportal,node_gameplay,node_leaderboard,node_gameapi,node_gamelogic,node_player toneIndigo
class node_frontendapp toneTeal
```

## Components

### Shopper experience

- [Shopper routes](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/routes/user/index.jsx): `frontend/src/routes/user/index.jsx`
- [Shopper pages](https://github.com/lalitj2104/shop-drop/tree/main/frontend/src/pages): `frontend/src/pages`

### Seller and admin

- [Retailer routes](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/routes/retailer/index.jsx): `frontend/src/routes/retailer/index.jsx`
- [Retailer dashboard](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/pages/RetailerDashboard/RetailerDashboard.jsx): `frontend/src/pages/RetailerDashboard/RetailerDashboard.jsx`
- [Admin routes](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/routes/Admin/index.jsx): `frontend/src/routes/Admin/index.jsx`
- [Admin screens](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/pages/Admin/Admin.jsx): `frontend/src/pages/Admin/Admin.jsx`

### Commerce services

- [Commerce API](https://github.com/lalitj2104/shop-drop/blob/main/backend/index.js): `backend/index.js`
- [Account services](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Retailer services](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/retailerController.js): `backend/controllers/retailerController.js`
- [Product catalog](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/productController.js): `backend/controllers/productController.js`
- [Cart operations](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/cartController.js): `backend/controllers/cartController.js`
- [Order lifecycle](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Product reviews](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Wishlist](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Admin services](https://github.com/lalitj2104/shop-drop/blob/main/backend/controllers/adminContoller.js): `backend/controllers/adminContoller.js`

### Identity and data

- [User authentication](https://github.com/lalitj2104/shop-drop/blob/main/backend/middleware/isAuth.js): `backend/middleware/isAuth.js`
- [Retailer authentication](https://github.com/lalitj2104/shop-drop/blob/main/backend/middleware/retailAuth.js): `backend/middleware/retailAuth.js`
- [Commerce models](https://github.com/lalitj2104/shop-drop/tree/main/backend/models): `backend/models`
- [Game accounts](https://github.com/lalitj2104/shop-drop/blob/main/backend/models/gameUser.js): `backend/models/gameUser.js`

### Games

- [Games application](https://github.com/lalitj2104/shop-drop/blob/main/game/src/App.js): `game/src/App.js`
- [Game portal](https://github.com/lalitj2104/shop-drop/blob/main/game/src/components/Main/Main.js): `game/src/components/Main/Main.js`
- [Game experiences](https://github.com/lalitj2104/shop-drop/tree/main/game/src/components): `game/src/components`
- [Leaderboard](https://github.com/lalitj2104/shop-drop/blob/main/game/src/components/Main/LeaderBoard/LeaderBoard.js): `game/src/components/Main/LeaderBoard/LeaderBoard.js`
- [Game API](https://github.com/lalitj2104/shop-drop/blob/main/backend/routes/gameRoute.js): `backend/routes/gameRoute.js`
- [Multiplayer logic](https://github.com/lalitj2104/shop-drop/blob/main/backend/utils/game-logic.js): `backend/utils/game-logic.js`

### Other components

- [Web application](https://github.com/lalitj2104/shop-drop/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- **MongoDB**
- **Player**

## Connections

- Web application → Shopper routes: mounts routes (evidence: `frontend/src/App.jsx`)
- Web application → Retailer routes: mounts routes (evidence: `frontend/src/App.jsx`)
- Web application → Admin routes: mounts routes (evidence: `frontend/src/App.jsx`)
- Shopper routes → Shopper pages: routes to
- Retailer routes → Retailer dashboard: routes to
- Admin routes → Admin screens: routes to
- Commerce API → Account services: mounts routes
- Commerce API → Retailer services: mounts routes
- Commerce API → Product catalog: mounts routes (evidence: `backend/index.js`)
- Commerce API → Wishlist: mounts routes (evidence: `backend/index.js`)
- Commerce API → Order lifecycle: mounts routes (evidence: `backend/index.js`)
- Commerce API → Cart operations: mounts routes (evidence: `backend/index.js`)
- Commerce API → Product reviews: mounts routes (evidence: `backend/index.js`)
- Commerce API → Admin services: mounts routes (evidence: `backend/index.js`)
- User authentication → Commerce models: loads user (evidence: `backend/middleware/isAuth.js`)
- Retailer authentication → Commerce models: loads retailer (evidence: `backend/middleware/retailAuth.js`)
- Order lifecycle → Commerce models: reads and writes (evidence: `backend/controllers/orderController.js`)
- Product catalog → Commerce models: reads and writes (evidence: `backend/controllers/productController.js`)
- Product reviews → Commerce models: reads and writes (evidence: `backend/controllers/reviewController.js`)
- Retailer services → Commerce models: reads and writes (evidence: `backend/controllers/retailerController.js`)
- Account services → Commerce models: reads and writes (evidence: `backend/controllers/userController.js`)
- Commerce API → MongoDB: connects database (evidence: `backend/index.js`)
- Games application → Game portal: routes to (evidence: `game/src/App.js`)
- Games application → Game experiences: routes to (evidence: `game/src/App.js`)
- Games application → Leaderboard: routes to (evidence: `game/src/App.js`)
- Game portal → Player: serves games
- Game API → Game accounts: uses accounts (evidence: `backend/routes/gameRoute.js`)
- Commerce API → Game API: mounts route (evidence: `backend/index.js`)
- Commerce API → Multiplayer logic: dispatches socket events (evidence: `backend/index.js`)
- Multiplayer logic → Player: handles connection
- Leaderboard → Game API: fetches scores
