# saraswatiautopartsnoreply-pixel/inventroy architecture

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

- Interactive diagram: https://gitdiagram.com/saraswatiautopartsnoreply-pixel/inventroy
- Repository: https://github.com/saraswatiautopartsnoreply-pixel/inventroy

## Overview

Saraswati Inventory System is a multi-warehouse automotive-parts inventory and sales workspace. Managers search and maintain fitment-aware stock, create sales orders, reserve rack quantities for an assigned packer, and follow packing through dispatch, invoices, and sales history; packers work only their assigned warehouse orders. The React application calls an Express API, which owns authentication, business operations, and persistence. README capabilities also include reporting, CSV transfer, WooCommerce, Razorpay payment links, packing photos, and push alerts. Server route excerpts are partial, so uncertain subsystem links are omitted.

Main entry points: [`server/index.js`](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/index.js) (Application API), [`src/App.jsx`](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/src/App.jsx) (Inventory workspace), [`src/csv.js`](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/src/csv.js) (CSV transfer), [`server/models/Product.js`](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Product.js) (Parts and fitment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web workspace"]
  node_web["Inventory workspace<br/>[App.jsx]"]
  node_csv["CSV transfer<br/>[csv.js]"]
end

subgraph group_operations["Inventory and orders"]
  node_api["Application API<br/>[index.js]"]
  node_catalog["Parts and fitment<br/>[Product.js]"]
  node_orders["Sales and packing<br/>[Order.js]"]
  node_payments["Payment links<br/>[PaymentLink.js]"]
  node_photos["Packing photos<br/>[PackingPhoto.js]"]
end

subgraph group_records["Persistence and history"]
  node_users[("Accounts and roles<br/>[User.js]")]
  node_sessions[("Team sessions<br/>[UserSession.js]")]
  node_activity[("Activity history<br/>[ActivityEvent.js]")]
  node_rack[("Rack locations<br/>[Rack.js]")]
  node_settings[("System settings<br/>[SystemSetting.js]")]
  node_counter[("Product numbering<br/>[ProductCounter.js]")]
  node_pushsubs[("Push subscriptions")]
end

subgraph group_integrations["External services"]
  node_mongo[("MongoDB")]
  node_redis[("Redis cache")]
  node_woocommerce["WooCommerce"]
  node_razorpay["Razorpay"]
  node_browserpush["Browser push<br/>[sw.js]"]
end

node_user(("Admin, manager, packer"))

node_user -->|"uses"| node_web
node_web -->|"requests"| node_api
node_web -->|"transfers CSV"| node_csv
node_api -->|"reads and writes"| node_catalog
node_api -->|"manages orders"| node_orders
node_api -->|"manages links"| node_payments
node_api -->|"manages photos"| node_photos
node_api -->|"authenticates"| node_users
node_api -->|"tracks sessions"| node_sessions
node_api -.->|"records activity"| node_activity
node_api -.->|"manages racks"| node_rack
node_api -->|"loads settings"| node_settings
node_api -.->|"allocates numbers"| node_counter
node_api -.->|"stores subscriptions"| node_pushsubs
node_api -->|"persists"| node_mongo
node_api -->|"caches searches"| node_redis
node_api -->|"syncs catalog and orders"| node_woocommerce
node_api -->|"updates payment status"| node_razorpay
node_api -.->|"sends alerts"| node_browserpush

click node_web "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/src/App.jsx"
click node_csv "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/src/csv.js"
click node_api "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/index.js"
click node_catalog "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Product.js"
click node_orders "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Order.js"
click node_payments "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/PaymentLink.js"
click node_photos "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/PackingPhoto.js"
click node_users "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/User.js"
click node_sessions "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/UserSession.js"
click node_activity "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/ActivityEvent.js"
click node_rack "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Rack.js"
click node_settings "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/SystemSetting.js"
click node_counter "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/ProductCounter.js"
click node_pushsubs "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/PushSubscription.js"
click node_browserpush "https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/public/sw.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_web,node_csv toneBlue
class node_api,node_catalog,node_orders,node_payments,node_photos toneAmber
class node_users,node_sessions,node_activity,node_rack,node_settings,node_counter,node_pushsubs toneMint
class node_mongo,node_redis,node_woocommerce,node_razorpay,node_browserpush toneRose
class node_user toneIndigo
```

## Components

### Web workspace

- [Inventory workspace](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/src/App.jsx): `src/App.jsx`
- [CSV transfer](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/src/csv.js): `src/csv.js`

### Inventory and orders

- [Application API](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/index.js): `server/index.js`
- [Parts and fitment](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Product.js): `server/models/Product.js`
- [Sales and packing](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Order.js): `server/models/Order.js`
- [Payment links](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/PaymentLink.js): `server/models/PaymentLink.js`
- [Packing photos](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/PackingPhoto.js): `server/models/PackingPhoto.js`

### Persistence and history

- [Accounts and roles](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/User.js): `server/models/User.js`
- [Team sessions](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/UserSession.js): `server/models/UserSession.js`
- [Activity history](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/ActivityEvent.js): `server/models/ActivityEvent.js`
- [Rack locations](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/Rack.js): `server/models/Rack.js`
- [System settings](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/SystemSetting.js): `server/models/SystemSetting.js`
- [Product numbering](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/ProductCounter.js): `server/models/ProductCounter.js`
- [Push subscriptions](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/server/models/PushSubscription.js): `server/models/PushSubscription.js`

### External services

- **MongoDB**
- **Redis cache**
- **WooCommerce**
- **Razorpay**
- [Browser push](https://github.com/saraswatiautopartsnoreply-pixel/inventroy/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Admin, manager, packer**

## Connections

- Admin, manager, packer → Inventory workspace: uses (evidence: `README.md`)
- Inventory workspace → Application API: requests (evidence: `src/App.jsx`)
- Inventory workspace → CSV transfer: transfers CSV (evidence: `src/App.jsx`)
- Application API → Parts and fitment: reads and writes (evidence: `server/index.js`)
- Application API → Sales and packing: manages orders (evidence: `server/index.js`)
- Application API → Payment links: manages links (evidence: `server/index.js`)
- Application API → Packing photos: manages photos (evidence: `server/index.js`)
- Application API → Accounts and roles: authenticates (evidence: `server/index.js`)
- Application API → Team sessions: tracks sessions (evidence: `server/index.js`)
- Application API → Activity history: records activity (evidence: `server/index.js`)
- Application API → Rack locations: manages racks (evidence: `server/index.js`)
- Application API → System settings: loads settings (evidence: `server/index.js`)
- Application API → Product numbering: allocates numbers (evidence: `server/index.js`)
- Application API → Push subscriptions: stores subscriptions (evidence: `server/index.js`)
- Application API → MongoDB: persists (evidence: `server/index.js`)
- Application API → Redis cache: caches searches (evidence: `server/index.js`)
- Application API → WooCommerce: syncs catalog and orders (evidence: `README.md`)
- Application API → Razorpay: updates payment status (evidence: `README.md`)
- Application API → Browser push: sends alerts
