The Problem
Pharmaceutical businesses juggle complex workflows — managing thousands of SKUs across multiple warehouses, tracking batch-level expiry dates, handling GST-compliant invoicing, and coordinating with dozens of suppliers. Most off-the-shelf ERP systems are either too generic or prohibitively expensive for mid-sized pharma distributors.
Pharmik ERP was built to solve this — a purpose-built system that handles the full lifecycle from procurement to billing, with real-time inventory tracking and compliance baked in.
Architecture
The system follows a classic three-tier architecture with a React SPA frontend, Express REST API, and PostgreSQL database:
- React Dashboard — Role-based views for admin, warehouse, and sales teams with real-time data visualization
- Express API — RESTful endpoints with JWT authentication, input validation, and rate limiting
- PostgreSQL — Relational schema optimized for inventory queries, with batch-level tracking and audit logs
- Redis — Session caching and real-time inventory count synchronization
┌──────────────────────┐
│ React Dashboard │
│ (Redux + Chart.js) │
└──────────────────────┘
│
▼
┌──────────────────────┐
│ Express REST API │
│ (JWT + Validation) │
└──────────────────────┘
│
┌─────┴─────┐
▼ ▼
┌────────┐ ┌────────┐
│PostgreSQL│ │ Redis │
│(Primary)│ │(Cache) │
└────────┘ └────────┘
Key Features
Inventory Management — Track stock across multiple warehouses with batch-level granularity. Automatic low-stock alerts, expiry tracking, and dead-stock identification.
Smart Billing — GST-compliant invoice generation with auto-calculated taxes, discount tiers, and credit tracking. Supports bulk billing and recurring orders.
Supplier Portal — Purchase order management, delivery tracking, and payment reconciliation. Suppliers get read-only access to their order pipeline.
Analytics Dashboard — Revenue trends, top-selling products, stock turnover rates, and supplier performance metrics — all visualized with interactive Chart.js charts.
Results
| Metric | Value | |--------|-------| | Total modules | 8 (Inventory, Billing, Suppliers, Analytics, Users, Reports, Settings, Audit) | | API endpoints | 45+ | | Database tables | 22 | | Role types | 4 (Admin, Manager, Warehouse, Sales) | | Average API response | < 120ms | | Data validation | Joi + PostgreSQL constraints |
Key Learnings
-
Batch-level tracking is essential for pharma. Unlike generic inventory systems, pharmaceutical stock must track manufacturing dates, expiry dates, and batch numbers per unit. This drove the entire database schema design.
-
Role-based access prevents costly mistakes. Separating admin, warehouse, and sales views reduced data-entry errors by keeping each team focused on their workflow.
-
Chart.js + React is a powerful combo. Interactive analytics dashboards with drill-down capabilities made the data actionable — managers actually used the reports instead of exporting to Excel.
-
PostgreSQL's query planner shines with relational data. Complex joins across inventory, orders, and suppliers stayed fast because PostgreSQL optimizes multi-table queries far better than document databases would have.