How imdurgeshhh/pharmacy-management-system works
This is a multi-tenant pharmacy management system. Staff sign in, enter the workspace, manage medicines and purchasing, and use point of sale to bill customers; the backend applies authentication and tenant/role checks, handles domain operations, and persists data in PostgreSQL. The README also describes supplier and wholesale operations, prescription/invoice OCR, and report/export capabilities. Some backend route-to-controller links are supported by the source index rather than excerpts; OCR and reporting internals were not sampled, so their deeper connections are omitted.
Main entry points: server.js REST API · App.jsx Workspace shell · db.js Database connection · saleController.js Sales and billing
Components 25
Web workspace
- Workspace shell
frontend/src/App.jsx - Client state
frontend/src/store/useStore.js - Retail POS
frontend/src/pages/POS.jsx - Inventory workspace
frontend/src/pages/Inventory.jsx - Purchase workspace
frontend/src/pages/Purchases.jsx - Employee workspace
frontend/src/pages/Employees.jsx - Reports workspace
frontend/src/pages/Reports.jsx - Supplier workspace
frontend/src/pages/Suppliers.jsx
Identity and access
- Identity loading
backend/middleware/auth.js - Tenant and role checks
backend/middleware/roleCheck.js - Request validation
backend/middleware/validate.js
Pharmacy operations
- REST API
backend/server.js - Sales and billing
backend/controllers/saleController.js - Inventory domain
backend/controllers/inventoryController.js - Purchase domain
backend/controllers/purchaseController.js - Employee management
backend/controllers/employeeController.js - Supplier and wholesale
backend/controllers/wholesaleController.js - Customer records
backend/controllers/customerController.js
Persistence and billing
- Quantity calculations
backend/utils/quantity.js - Invoice generation
backend/utils/invoiceGenerator.js - Database connection
backend/config/db.js - PostgreSQL
Scanning and reporting
- Prescription and invoice OCR
backend/controllers/ocrController.js - Reports and analytics
backend/controllers/reportController.js
Other components
- Pharmacy staff
Connections 34
- Pharmacy staff → Workspace shell: uses
- Workspace shell → Client state: reads state
frontend/src/App.jsx - Workspace shell → Retail POS: routes to
frontend/src/App.jsx - Retail POS → Client state: reads state
frontend/src/pages/POS.jsx - Workspace shell → Inventory workspace: routes to
frontend/src/App.jsx - Workspace shell → Purchase workspace: routes to
frontend/src/App.jsx - Workspace shell → Employee workspace: routes to
frontend/src/App.jsx - Workspace shell → Reports workspace: routes to
frontend/src/App.jsx - Workspace shell → Supplier workspace: routes to
frontend/src/App.jsx - Retail POS → REST API: requests
- Inventory workspace → REST API: requests
- Purchase workspace → REST API: requests
- Employee workspace → REST API: requests
- Reports workspace → REST API: requests
- Supplier workspace → REST API: requests
- REST API → Identity loading: mounts routes
backend/server.js - REST API → Inventory domain: routes inventory
- REST API → Sales and billing: routes sales
backend/server.js - REST API → Purchase domain: routes purchases
backend/server.js - REST API → Employee management: routes employees
- REST API → Prescription and invoice OCR: routes OCR
backend/server.js - REST API → Reports and analytics: routes reports
backend/server.js - REST API → Supplier and wholesale: routes wholesale
backend/server.js - Identity loading → Database connection: loads profile
backend/middleware/auth.js - Identity loading → Tenant and role checks: supplies identity
backend/middleware/roleCheck.js - Inventory domain → Database connection: queries
backend/controllers/inventoryController.js - Purchase domain → Database connection: queries
backend/controllers/purchaseController.js - Sales and billing → Database connection: queries
backend/controllers/saleController.js - Sales and billing → Quantity calculations: calculates quantities
backend/controllers/saleController.js - Purchase domain → Quantity calculations: normalizes quantities
backend/controllers/purchaseController.js - Sales and billing → Invoice generation: generates invoices
backend/controllers/saleController.js - Database connection → PostgreSQL: connects
backend/config/db.js - Inventory domain → Request validation: validates input
backend/routes/inventoryRoutes.js - Employee management → Request validation: validates input
backend/routes/employeeRoutes.js