# sameer07-bit/shopsahayak architecture

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

- Interactive diagram: https://gitdiagram.com/sameer07-bit/shopsahayak
- Repository: https://github.com/sameer07-bit/shopsahayak

## Overview

ShopSahayak is a retail-store business assistant spanning store operations, AI/voice interaction, and a browser interface. The documented owner workflow runs from reviewing inventory and sales, through an AI restock recommendation and purchase-order approval, to updated stock and business insights. The repository also contains customer Khata, authentication, OCR, notifications, and messaging capabilities. Arrows are limited to relationships visible in excerpts, the SOURCE INDEX, or README; several controllers and frontend modules were not sampled, so their internal connections are not inferred.

Main entry points: [`server.js`](https://github.com/sameer07-bit/shopsahayak/blob/main/server.js) (Express API), [`controllers/productController.js`](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/productController.js) (Product inventory), [`config/db.js`](https://github.com/sameer07-bit/shopsahayak/blob/main/config/db.js) (Database connection), [`js/app.js`](https://github.com/sameer07-bit/shopsahayak/blob/main/js/app.js) (Retail dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Store experience"]
  node_browser["Retail dashboard<br/>[app.js]"]
  node_demo["Guided demo<br/>[demo-flow.js]"]
  node_languages["Language support<br/>[translations.js]"]
end

subgraph group_operations["Retail operations"]
  node_sales["Sales and reports<br/>[salesController.js]"]
  node_products["Product inventory"]
  node_customers["Customer Khata"]
  node_suppliers["Suppliers and orders"]
  node_store["Store profile<br/>[storeController.js]"]
  node_notifications["Notifications"]
end

subgraph group_intelligence["AI and channels"]
  node_ai["AI assistant<br/>[aiController.js]"]
  node_voice["Voice assistant<br/>[voiceController.js]"]
  node_gemini["Retail AI engine<br/>[geminiClient.js]"]
  node_ocr["Handwriting OCR<br/>[ocrController.js]"]
  node_ocrservice["Gemini OCR service"]
  node_whatsapp["WhatsApp messaging"]
  node_sms["Registration messaging<br/>[smsService.js]"]
end

subgraph group_platform["API and persistence"]
  node_auth["Authentication<br/>[authController.js]"]
  node_api["Express API<br/>[server.js]"]
  node_mongoconfig["Database connection<br/>[db.js]"]
  node_mongo[("MongoDB")]
  node_dynamic["User data tables"]
end

node_owner(("Store owner"))

node_owner -->|"uses"| node_browser
node_browser -->|"runs walkthrough"| node_demo
node_browser -->|"offers languages"| node_languages
node_api -->|"connects"| node_mongoconfig
node_api -->|"mounts routes"| node_products
node_api -->|"mounts routes"| node_sales
node_api -->|"mounts routes"| node_customers
node_api -->|"mounts routes"| node_suppliers
node_api -->|"mounts routes"| node_store
node_api -->|"mounts routes"| node_auth
node_api -->|"mounts routes"| node_ai
node_api -->|"mounts routes"| node_voice
node_api -->|"mounts routes"| node_ocr
node_api -->|"mounts routes"| node_whatsapp
node_api -->|"mounts routes"| node_notifications
node_mongoconfig -->|"connects"| node_mongo
node_mongoconfig -->|"seeds products"| node_products
node_mongoconfig -->|"seeds customers"| node_customers
node_voice -->|"generates response"| node_gemini
node_voice -->|"reads context"| node_products
node_products -->|"records user data"| node_dynamic
node_products -->|"creates restock order"| node_suppliers
node_auth -->|"dispatches registration SMS"| node_sms
node_sms -->|"creates notification"| node_notifications
node_ocr -.->|"OCR processing"| node_ocrservice

click node_browser "https://github.com/sameer07-bit/shopsahayak/blob/main/js/app.js"
click node_demo "https://github.com/sameer07-bit/shopsahayak/blob/main/js/demo-flow.js"
click node_languages "https://github.com/sameer07-bit/shopsahayak/blob/main/js/translations.js"
click node_sales "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/salesController.js"
click node_products "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/productController.js"
click node_customers "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/customerController.js"
click node_suppliers "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/supplierController.js"
click node_store "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/storeController.js"
click node_auth "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/authController.js"
click node_ai "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/aiController.js"
click node_voice "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/voiceController.js"
click node_gemini "https://github.com/sameer07-bit/shopsahayak/blob/main/utils/geminiClient.js"
click node_ocr "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/ocrController.js"
click node_ocrservice "https://github.com/sameer07-bit/shopsahayak/blob/main/services/geminiOcrService.js"
click node_whatsapp "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/whatsappController.js"
click node_notifications "https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/notificationController.js"
click node_api "https://github.com/sameer07-bit/shopsahayak/blob/main/server.js"
click node_mongoconfig "https://github.com/sameer07-bit/shopsahayak/blob/main/config/db.js"
click node_dynamic "https://github.com/sameer07-bit/shopsahayak/blob/main/utils/dynamicTableManager.js"
click node_sms "https://github.com/sameer07-bit/shopsahayak/blob/main/utils/smsService.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_browser,node_demo,node_languages toneBlue
class node_sales,node_products,node_customers,node_suppliers,node_store,node_notifications toneAmber
class node_ai,node_voice,node_gemini,node_ocr,node_ocrservice,node_whatsapp,node_sms toneMint
class node_auth,node_api,node_mongoconfig,node_mongo,node_dynamic toneRose
class node_owner toneIndigo
```

## Components

### Store experience

- [Retail dashboard](https://github.com/sameer07-bit/shopsahayak/blob/main/js/app.js): `js/app.js`
- [Guided demo](https://github.com/sameer07-bit/shopsahayak/blob/main/js/demo-flow.js): `js/demo-flow.js`
- [Language support](https://github.com/sameer07-bit/shopsahayak/blob/main/js/translations.js): `js/translations.js`

### Retail operations

- [Sales and reports](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/salesController.js): `controllers/salesController.js`
- [Product inventory](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/productController.js): `controllers/productController.js`
- [Customer Khata](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/customerController.js): `controllers/customerController.js`
- [Suppliers and orders](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/supplierController.js): `controllers/supplierController.js`
- [Store profile](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/storeController.js): `controllers/storeController.js`
- [Notifications](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/notificationController.js): `controllers/notificationController.js`

### AI and channels

- [AI assistant](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/aiController.js): `controllers/aiController.js`
- [Voice assistant](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/voiceController.js): `controllers/voiceController.js`
- [Retail AI engine](https://github.com/sameer07-bit/shopsahayak/blob/main/utils/geminiClient.js): `utils/geminiClient.js`
- [Handwriting OCR](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/ocrController.js): `controllers/ocrController.js`
- [Gemini OCR service](https://github.com/sameer07-bit/shopsahayak/blob/main/services/geminiOcrService.js): `services/geminiOcrService.js`
- [WhatsApp messaging](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/whatsappController.js): `controllers/whatsappController.js`
- [Registration messaging](https://github.com/sameer07-bit/shopsahayak/blob/main/utils/smsService.js): `utils/smsService.js`

### API and persistence

- [Authentication](https://github.com/sameer07-bit/shopsahayak/blob/main/controllers/authController.js): `controllers/authController.js`
- [Express API](https://github.com/sameer07-bit/shopsahayak/blob/main/server.js): `server.js`
- [Database connection](https://github.com/sameer07-bit/shopsahayak/blob/main/config/db.js): `config/db.js`
- **MongoDB**
- [User data tables](https://github.com/sameer07-bit/shopsahayak/blob/main/utils/dynamicTableManager.js): `utils/dynamicTableManager.js`

### Other components

- **Store owner**

## Connections

- Store owner → Retail dashboard: uses
- Retail dashboard → Guided demo: runs walkthrough
- Retail dashboard → Language support: offers languages
- Express API → Database connection: connects (evidence: `server.js`)
- Express API → Product inventory: mounts routes (evidence: `server.js`)
- Express API → Sales and reports: mounts routes (evidence: `server.js`)
- Express API → Customer Khata: mounts routes (evidence: `server.js`)
- Express API → Suppliers and orders: mounts routes (evidence: `server.js`)
- Express API → Store profile: mounts routes (evidence: `server.js`)
- Express API → Authentication: mounts routes (evidence: `server.js`)
- Express API → AI assistant: mounts routes (evidence: `server.js`)
- Express API → Voice assistant: mounts routes (evidence: `server.js`)
- Express API → Handwriting OCR: mounts routes (evidence: `server.js`)
- Express API → WhatsApp messaging: mounts routes (evidence: `server.js`)
- Express API → Notifications: mounts routes (evidence: `server.js`)
- Database connection → MongoDB: connects (evidence: `config/db.js`)
- Database connection → Product inventory: seeds products (evidence: `config/db.js`)
- Database connection → Customer Khata: seeds customers (evidence: `config/db.js`)
- Voice assistant → Retail AI engine: generates response (evidence: `controllers/voiceController.js`)
- Voice assistant → Product inventory: reads context (evidence: `controllers/voiceController.js`)
- Product inventory → User data tables: records user data (evidence: `controllers/productController.js`)
- Product inventory → Suppliers and orders: creates restock order (evidence: `controllers/productController.js`)
- Authentication → Registration messaging: dispatches registration SMS (evidence: `controllers/authController.js`)
- Registration messaging → Notifications: creates notification (evidence: `utils/smsService.js`)
- Handwriting OCR → Gemini OCR service: OCR processing
