# manivuppala124/balaji-cool-drinks architecture

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

- Interactive diagram: https://gitdiagram.com/manivuppala124/balaji-cool-drinks
- Repository: https://github.com/manivuppala124/balaji-cool-drinks

## Overview

Sri Balaji is a dual retail/wholesale storefront and store-operations platform. Shoppers browse products, maintain a cart, and place orders; the server authenticates requests, verifies prices and stock, persists the order, and notifies administrators. Staff also manage catalog, inventory, customers, credits, cash-register sessions, settings, and reports. The graph combines documented capabilities with sampled routing and source-index references; unsampled page-to-endpoint wiring is not expanded into asserted calls.

Main entry points: [`server/server.js`](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/server.js) (Express API), [`server/src/controllers/orderController.js`](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/orderController.js) (Order processing), [`client/src/App.jsx`](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/App.jsx) (React application), [`client/src/services/endpoints.js`](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/services/endpoints.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer and admin client"]
  node_app["React application<br/>[App.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_cartstate["Cart state<br/>[CartContext.jsx]"]
  node_storefront["Storefront pages"]
  node_adminui["Admin workspace"]
  node_pos["Point of sale<br/>[POS.jsx]"]
  node_cashui["Cash register UI<br/>[CashRegister.jsx]"]
end

subgraph group_api["API and access"]
  node_api["API client<br/>[endpoints.js]"]
  node_server["Express API<br/>[server.js]"]
  node_auth["Authentication<br/>[authController.js]"]
  node_access["Auth and roles<br/>[auth.js]"]
end

subgraph group_commerce["Commerce operations"]
  node_catalog["Catalog management"]
  node_orders["Order processing<br/>[orderController.js]"]
  node_inventory["Inventory management"]
end

subgraph group_operations["Store operations"]
  node_customers["Customer management"]
  node_credits["Customer credits"]
  node_register["Cash register"]
  node_reports["Sales reports"]
  node_settings["Shop settings"]
  node_notifications["Notifications"]
end

subgraph group_data["Persistence and services"]
  node_orderdata["Order records<br/>[Order.js]"]
  node_productdata["Product records<br/>[Product.js]"]
  node_creditdata["Credit records<br/>[Credit.js]"]
  node_userdata["User records<br/>[User.js]"]
  node_mongo[("MongoDB")]
  node_audit["Audit logging<br/>[auditService.js]"]
end

node_shopper(("Shopper"))
node_staff(("Store staff"))

node_shopper -->|"uses"| node_app
node_staff -->|"uses"| node_app
node_app -->|"provides"| node_authstate
node_app -->|"provides"| node_cartstate
node_app -->|"routes to"| node_storefront
node_app -->|"routes to"| node_adminui
node_storefront -.->|"updates"| node_cartstate
node_storefront -.->|"requests"| node_api
node_adminui -.->|"requests"| node_api
node_pos -->|"requests"| node_api
node_cashui -->|"requests"| node_api
node_authstate -->|"calls"| node_api
node_api -->|"sends REST requests"| node_server
node_server -->|"routes auth"| node_auth
node_server -->|"routes products"| node_catalog
node_server -->|"routes orders"| node_orders
node_server -->|"routes admin operations"| node_inventory
node_server -->|"routes admin operations"| node_customers
node_server -->|"routes admin operations"| node_credits
node_server -->|"routes admin operations"| node_register
node_server -->|"routes admin operations"| node_reports
node_server -->|"routes settings"| node_settings
node_server -->|"uses guards"| node_access
node_auth -->|"reads and writes"| node_userdata
node_access -->|"loads user"| node_userdata
node_orders -->|"creates orders"| node_orderdata
node_orders -->|"checks stock"| node_productdata
node_orders -->|"checks settings"| node_settings
node_orders -->|"notifies admins"| node_notifications
node_orders -->|"deducts stock"| node_inventory
node_orders -.->|"creates credit orders"| node_credits
node_catalog -->|"manages products"| node_productdata
node_catalog -->|"records changes"| node_audit
node_credits -->|"manages credits"| node_creditdata
node_credits -->|"records changes"| node_audit
node_register -->|"reads collections"| node_creditdata
node_register -->|"reads sales"| node_orderdata
node_reports -->|"aggregates orders"| node_orderdata
node_reports -->|"reads costs"| node_productdata
node_notifications -->|"selects recipients"| node_userdata
node_orderdata -.->|"persists"| node_mongo
node_productdata -.->|"persists"| node_mongo
node_creditdata -.->|"persists"| node_mongo
node_userdata -.->|"persists"| node_mongo

click node_app "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/App.jsx"
click node_authstate "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/context/AuthContext.jsx"
click node_cartstate "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/context/CartContext.jsx"
click node_storefront "https://github.com/manivuppala124/balaji-cool-drinks/tree/main/client/src/pages"
click node_adminui "https://github.com/manivuppala124/balaji-cool-drinks/tree/main/client/src/pages/admin"
click node_pos "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/pages/admin/POS.jsx"
click node_cashui "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/pages/admin/CashRegister.jsx"
click node_api "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/services/endpoints.js"
click node_server "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/server.js"
click node_auth "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/authController.js"
click node_access "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/middleware/auth.js"
click node_catalog "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/productController.js"
click node_orders "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/orderController.js"
click node_inventory "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/inventoryController.js"
click node_customers "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/customerController.js"
click node_credits "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/creditController.js"
click node_register "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/cashRegisterController.js"
click node_reports "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/reportController.js"
click node_settings "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/settingsController.js"
click node_notifications "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/services/notificationService.js"
click node_orderdata "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/Order.js"
click node_productdata "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/Product.js"
click node_creditdata "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/Credit.js"
click node_userdata "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/User.js"
click node_audit "https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/services/auditService.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_authstate,node_cartstate,node_storefront,node_adminui,node_pos,node_cashui toneBlue
class node_api,node_server,node_auth,node_access toneAmber
class node_catalog,node_orders,node_inventory toneMint
class node_customers,node_credits,node_register,node_reports,node_settings,node_notifications toneRose
class node_orderdata,node_productdata,node_creditdata,node_userdata,node_mongo,node_audit,node_shopper,node_staff toneIndigo
```

## Components

### Customer and admin client

- [React application](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Auth state](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Cart state](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/context/CartContext.jsx): `client/src/context/CartContext.jsx`
- [Storefront pages](https://github.com/manivuppala124/balaji-cool-drinks/tree/main/client/src/pages): `client/src/pages`
- [Admin workspace](https://github.com/manivuppala124/balaji-cool-drinks/tree/main/client/src/pages/admin): `client/src/pages/admin`
- [Point of sale](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/pages/admin/POS.jsx): `client/src/pages/admin/POS.jsx`
- [Cash register UI](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/pages/admin/CashRegister.jsx): `client/src/pages/admin/CashRegister.jsx`

### API and access

- [API client](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/client/src/services/endpoints.js): `client/src/services/endpoints.js`
- [Express API](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/server.js): `server/server.js`
- [Authentication](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/authController.js): `server/src/controllers/authController.js`
- [Auth and roles](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`

### Commerce operations

- [Catalog management](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/productController.js): `server/src/controllers/productController.js`
- [Order processing](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/orderController.js): `server/src/controllers/orderController.js`
- [Inventory management](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/inventoryController.js): `server/src/controllers/inventoryController.js`

### Store operations

- [Customer management](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/customerController.js): `server/src/controllers/customerController.js`
- [Customer credits](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/creditController.js): `server/src/controllers/creditController.js`
- [Cash register](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/cashRegisterController.js): `server/src/controllers/cashRegisterController.js`
- [Sales reports](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/reportController.js): `server/src/controllers/reportController.js`
- [Shop settings](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/controllers/settingsController.js): `server/src/controllers/settingsController.js`
- [Notifications](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/services/notificationService.js): `server/src/services/notificationService.js`

### Persistence and services

- [Order records](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/Order.js): `server/src/models/Order.js`
- [Product records](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/Product.js): `server/src/models/Product.js`
- [Credit records](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/Credit.js): `server/src/models/Credit.js`
- [User records](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/models/User.js): `server/src/models/User.js`
- **MongoDB**
- [Audit logging](https://github.com/manivuppala124/balaji-cool-drinks/blob/main/server/src/services/auditService.js): `server/src/services/auditService.js`

### Other components

- **Shopper**
- **Store staff**

## Connections

- Shopper → React application: uses
- Store staff → React application: uses
- React application → Auth state: provides (evidence: `client/src/App.jsx`)
- React application → Cart state: provides (evidence: `client/src/App.jsx`)
- React application → Storefront pages: routes to (evidence: `client/src/App.jsx`)
- React application → Admin workspace: routes to (evidence: `client/src/App.jsx`)
- Storefront pages → Cart state: updates
- Storefront pages → API client: requests (evidence: `client/src/pages/admin/POS.jsx`)
- Admin workspace → API client: requests (evidence: `client/src/pages/admin/POS.jsx`)
- Point of sale → API client: requests (evidence: `client/src/pages/admin/POS.jsx`)
- Cash register UI → API client: requests (evidence: `client/src/pages/admin/CashRegister.jsx`)
- Auth state → API client: calls (evidence: `client/src/context/AuthContext.jsx`)
- API client → Express API: sends REST requests
- Express API → Authentication: routes auth (evidence: `server/server.js`)
- Express API → Catalog management: routes products
- Express API → Order processing: routes orders (evidence: `server/server.js`)
- Express API → Inventory management: routes admin operations
- Express API → Customer management: routes admin operations
- Express API → Customer credits: routes admin operations
- Express API → Cash register: routes admin operations
- Express API → Sales reports: routes admin operations
- Express API → Shop settings: routes settings
- Express API → Auth and roles: uses guards
- Authentication → User records: reads and writes (evidence: `server/src/controllers/authController.js`)
- Auth and roles → User records: loads user (evidence: `server/src/middleware/auth.js`)
- Order processing → Order records: creates orders (evidence: `server/src/controllers/orderController.js`)
- Order processing → Product records: checks stock (evidence: `server/src/controllers/orderController.js`)
- Order processing → Shop settings: checks settings (evidence: `server/src/controllers/orderController.js`)
- Order processing → Notifications: notifies admins (evidence: `server/src/controllers/orderController.js`)
- Order processing → Inventory management: deducts stock
- Order processing → Customer credits: creates credit orders
- Catalog management → Product records: manages products (evidence: `server/src/controllers/productController.js`)
- Catalog management → Audit logging: records changes (evidence: `server/src/controllers/productController.js`)
- Customer credits → Credit records: manages credits (evidence: `server/src/controllers/creditController.js`)
- Customer credits → Audit logging: records changes (evidence: `server/src/controllers/creditController.js`)
- Cash register → Credit records: reads collections (evidence: `server/src/controllers/cashRegisterController.js`)
- Cash register → Order records: reads sales (evidence: `server/src/controllers/cashRegisterController.js`)
- Sales reports → Order records: aggregates orders (evidence: `server/src/controllers/reportController.js`)
- Sales reports → Product records: reads costs (evidence: `server/src/controllers/reportController.js`)
- Notifications → User records: selects recipients (evidence: `server/src/services/notificationService.js`)
- Order records → MongoDB: persists
- Product records → MongoDB: persists
- Credit records → MongoDB: persists
- User records → MongoDB: persists
