# yarrowtech/rms-2 architecture

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

- Interactive diagram: https://gitdiagram.com/yarrowtech/rms-2
- Repository: https://github.com/yarrowtech/rms-2

## Overview

This is a multi-tenant retail and vendor management system: a React departmental interface calls a FastAPI backend whose route modules implement operations over MongoDB. A representative buying workflow is vendor catalogue discovery, purchase planning and purchase-order handling, then goods receipt and stock management. The repository also exposes production/job-work, finance, analytics, onboarding, subscriptions, and internal collaboration features. The README is only the Vite template; feature identification comes from the tree and sampled source. Unsampled subsystems are included where their paths are clear, but their internal connections are not assumed.

Main entry points: [`rms_backend/app/db.py`](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/db.py) (MongoDB collections), [`rms_backend/app/main.py`](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/main.py) (FastAPI application), [`src/App.jsx`](https://github.com/yarrowtech/rms-2/blob/main/src/App.jsx) (Department app), [`rms_backend/app/routes/grn_routes.py`](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/grn_routes.py) (Goods receipt)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_web["Department app<br/>[App.jsx]"]
  node_api_config["API configuration<br/>[api.js]"]
  node_buyer_ui["Buyer workspace<br/>[mbuyer.jsx]"]
  node_vendor_ui["Vendor workspace<br/>[MSeller.jsx]"]
  node_inventory_ui["Inventory workspace"]
  node_production_ui["Production workspace"]
  node_finance_ui["Finance workspace<br/>[Finance.jsx]"]
  node_chat["Internal chat"]
  node_notifications["Notification bell"]
end

subgraph group_backend["API and access"]
  node_api["FastAPI application<br/>[main.py]"]
  node_auth["Tenant access<br/>[deps.py]"]
end

subgraph group_procurement["Buying and vendors"]
  node_catalogue["Vendor catalogue"]
  node_vendors["Vendor management<br/>[vendor_routes.py]"]
  node_purchase_orders["Purchase orders"]
  node_buying_plan["Purchase planning<br/>[mbuyer_routes.py]"]
  node_procurement_notices["Procurement notices"]
end

subgraph group_operations["Stock and production"]
  node_receiving["Goods receipt<br/>[grn_routes.py]"]
  node_products["Product management<br/>[products.py]"]
  node_inventory["Inventory operations<br/>[inventoryroutes.py]"]
  node_job_work["Production and job work<br/>[job_work_routes.py]"]
end

subgraph group_platform["Shared services"]
  node_database[("MongoDB collections<br/>[db.py]")]
  node_identity["Product identity"]
  node_subscriptions["Subscriptions"]
  node_analytics["Analytics routes"]
end

node_users(("Retail staff"))

node_users -->|"uses"| node_web
node_web -->|"routes to"| node_buyer_ui
node_web -->|"routes to"| node_vendor_ui
node_web -->|"routes to"| node_inventory_ui
node_web -->|"routes to"| node_production_ui
node_web -->|"routes to"| node_finance_ui
node_buyer_ui -->|"uses API base"| node_api_config
node_vendor_ui -->|"uses API base"| node_api_config
node_production_ui -->|"uses API base"| node_api_config
node_api -->|"registers routes"| node_catalogue
node_api -->|"registers routes"| node_vendors
node_api -->|"registers routes"| node_purchase_orders
node_api -->|"registers routes"| node_procurement_notices
node_api -->|"registers routes"| node_subscriptions
node_api -->|"registers routes"| node_receiving
node_api -->|"uses access checks"| node_auth
node_catalogue -->|"references vendor routes"| node_vendors
node_catalogue -->|"reads and writes"| node_database
node_vendors -->|"reads and writes"| node_database
node_purchase_orders -->|"reads and writes"| node_database
node_purchase_orders -->|"uses notice routes"| node_procurement_notices
node_buying_plan -->|"reads purchase data"| node_database
node_receiving -->|"reads and writes"| node_database
node_receiving -->|"uses identity helpers"| node_identity
node_products -->|"reads and writes"| node_database
node_products -->|"uses receipt logic"| node_receiving
node_inventory -->|"reads and writes"| node_database
node_inventory -->|"uses identity helpers"| node_identity
node_job_work -->|"reads stock"| node_database
node_job_work -->|"references purchasing"| node_purchase_orders
node_job_work -->|"references receipt workflow"| node_receiving
node_subscriptions -->|"reads and writes"| node_database
node_analytics -.->|"reads data"| node_database

click node_web "https://github.com/yarrowtech/rms-2/blob/main/src/App.jsx"
click node_api_config "https://github.com/yarrowtech/rms-2/blob/main/src/config/api.js"
click node_buyer_ui "https://github.com/yarrowtech/rms-2/blob/main/src/components/Mbuyer/mbuyer.jsx"
click node_vendor_ui "https://github.com/yarrowtech/rms-2/blob/main/src/components/Merchandiser_Seller/MSeller.jsx"
click node_inventory_ui "https://github.com/yarrowtech/rms-2/blob/main/src/components/InventoryManagement/InventoryManagement.jsx"
click node_production_ui "https://github.com/yarrowtech/rms-2/blob/main/src/components/Production/ProductionJobWork.jsx"
click node_finance_ui "https://github.com/yarrowtech/rms-2/blob/main/src/components/Finance/Finance.jsx"
click node_api "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/main.py"
click node_auth "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/deps.py"
click node_database "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/db.py"
click node_catalogue "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/catalogue_routes.py"
click node_vendors "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/vendor_routes.py"
click node_purchase_orders "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/purchaseorder_routes.py"
click node_buying_plan "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/mbuyer_routes.py"
click node_procurement_notices "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/procurement_notification_routes.py"
click node_receiving "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/grn_routes.py"
click node_products "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/products.py"
click node_inventory "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/inventoryroutes.py"
click node_job_work "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/job_work_routes.py"
click node_identity "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/product_identity.py"
click node_subscriptions "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/subscription_routes.py"
click node_analytics "https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/analytics_routes.py"
click node_chat "https://github.com/yarrowtech/rms-2/blob/main/src/components/InternalChatPanel.jsx"
click node_notifications "https://github.com/yarrowtech/rms-2/blob/main/src/components/InternalNotificationBell.jsx"

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_api_config,node_buyer_ui,node_vendor_ui,node_inventory_ui,node_production_ui,node_finance_ui,node_chat,node_notifications toneBlue
class node_api,node_auth toneAmber
class node_catalogue,node_vendors,node_purchase_orders,node_buying_plan,node_procurement_notices toneMint
class node_receiving,node_products,node_inventory,node_job_work toneRose
class node_database,node_identity,node_subscriptions,node_analytics,node_users toneIndigo
```

## Components

### Web interface

- [Department app](https://github.com/yarrowtech/rms-2/blob/main/src/App.jsx): `src/App.jsx`
- [API configuration](https://github.com/yarrowtech/rms-2/blob/main/src/config/api.js): `src/config/api.js`
- [Buyer workspace](https://github.com/yarrowtech/rms-2/blob/main/src/components/Mbuyer/mbuyer.jsx): `src/components/Mbuyer/mbuyer.jsx`
- [Vendor workspace](https://github.com/yarrowtech/rms-2/blob/main/src/components/Merchandiser_Seller/MSeller.jsx): `src/components/Merchandiser_Seller/MSeller.jsx`
- [Inventory workspace](https://github.com/yarrowtech/rms-2/blob/main/src/components/InventoryManagement/InventoryManagement.jsx): `src/components/InventoryManagement/InventoryManagement.jsx`
- [Production workspace](https://github.com/yarrowtech/rms-2/blob/main/src/components/Production/ProductionJobWork.jsx): `src/components/Production/ProductionJobWork.jsx`
- [Finance workspace](https://github.com/yarrowtech/rms-2/blob/main/src/components/Finance/Finance.jsx): `src/components/Finance/Finance.jsx`
- [Internal chat](https://github.com/yarrowtech/rms-2/blob/main/src/components/InternalChatPanel.jsx): `src/components/InternalChatPanel.jsx`
- [Notification bell](https://github.com/yarrowtech/rms-2/blob/main/src/components/InternalNotificationBell.jsx): `src/components/InternalNotificationBell.jsx`

### API and access

- [FastAPI application](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/main.py): `rms_backend/app/main.py`
- [Tenant access](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/deps.py): `rms_backend/app/routes/deps.py`

### Buying and vendors

- [Vendor catalogue](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/catalogue_routes.py): `rms_backend/app/routes/catalogue_routes.py`
- [Vendor management](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/vendor_routes.py): `rms_backend/app/routes/vendor_routes.py`
- [Purchase orders](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/purchaseorder_routes.py): `rms_backend/app/routes/purchaseorder_routes.py`
- [Purchase planning](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/mbuyer_routes.py): `rms_backend/app/routes/mbuyer_routes.py`
- [Procurement notices](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/procurement_notification_routes.py): `rms_backend/app/routes/procurement_notification_routes.py`

### Stock and production

- [Goods receipt](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/grn_routes.py): `rms_backend/app/routes/grn_routes.py`
- [Product management](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/products.py): `rms_backend/app/routes/products.py`
- [Inventory operations](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/inventoryroutes.py): `rms_backend/app/routes/inventoryroutes.py`
- [Production and job work](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/job_work_routes.py): `rms_backend/app/routes/job_work_routes.py`

### Shared services

- [MongoDB collections](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/db.py): `rms_backend/app/db.py`
- [Product identity](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/product_identity.py): `rms_backend/app/product_identity.py`
- [Subscriptions](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/subscription_routes.py): `rms_backend/app/routes/subscription_routes.py`
- [Analytics routes](https://github.com/yarrowtech/rms-2/blob/main/rms_backend/app/routes/analytics_routes.py): `rms_backend/app/routes/analytics_routes.py`

### Other components

- **Retail staff**

## Connections

- Retail staff → Department app: uses (evidence: `src/App.jsx`)
- Department app → Buyer workspace: routes to (evidence: `src/App.jsx`)
- Department app → Vendor workspace: routes to (evidence: `src/App.jsx`)
- Department app → Inventory workspace: routes to (evidence: `src/App.jsx`)
- Department app → Production workspace: routes to (evidence: `src/App.jsx`)
- Department app → Finance workspace: routes to (evidence: `src/App.jsx`)
- Buyer workspace → API configuration: uses API base
- Vendor workspace → API configuration: uses API base
- Production workspace → API configuration: uses API base (evidence: `src/components/Production/ProductionJobWork.jsx`)
- FastAPI application → Vendor catalogue: registers routes (evidence: `rms_backend/app/main.py`)
- FastAPI application → Vendor management: registers routes (evidence: `rms_backend/app/main.py`)
- FastAPI application → Purchase orders: registers routes (evidence: `rms_backend/app/main.py`)
- FastAPI application → Procurement notices: registers routes (evidence: `rms_backend/app/main.py`)
- FastAPI application → Subscriptions: registers routes (evidence: `rms_backend/app/main.py`)
- FastAPI application → Goods receipt: registers routes (evidence: `rms_backend/app/main.py`)
- FastAPI application → Tenant access: uses access checks (evidence: `rms_backend/app/main.py`)
- Vendor catalogue → Vendor management: references vendor routes (evidence: `rms_backend/app/routes/catalogue_routes.py`)
- Vendor catalogue → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/catalogue_routes.py`)
- Vendor management → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/vendor_routes.py`)
- Purchase orders → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/purchaseorder_routes.py`)
- Purchase orders → Procurement notices: uses notice routes (evidence: `rms_backend/app/routes/purchaseorder_routes.py`)
- Purchase planning → MongoDB collections: reads purchase data (evidence: `rms_backend/app/routes/mbuyer_routes.py`)
- Goods receipt → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/grn_routes.py`)
- Goods receipt → Product identity: uses identity helpers (evidence: `rms_backend/app/routes/grn_routes.py`)
- Product management → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/products.py`)
- Product management → Goods receipt: uses receipt logic (evidence: `rms_backend/app/routes/products.py`)
- Inventory operations → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/inventoryroutes.py`)
- Inventory operations → Product identity: uses identity helpers (evidence: `rms_backend/app/routes/inventoryroutes.py`)
- Production and job work → MongoDB collections: reads stock (evidence: `rms_backend/app/routes/job_work_routes.py`)
- Production and job work → Purchase orders: references purchasing (evidence: `rms_backend/app/routes/job_work_routes.py`)
- Production and job work → Goods receipt: references receipt workflow (evidence: `rms_backend/app/routes/job_work_routes.py`)
- Subscriptions → MongoDB collections: reads and writes (evidence: `rms_backend/app/routes/subscription_routes.py`)
- Analytics routes → MongoDB collections: reads data
