Loading…
Loading…
An inventory system for pharmacies covering stock levels, dispensing, and expiry tracking, with alerting to reduce both shortages and waste.

An inventory system that keeps a pharmacy's stock accurate in real time, tracking receipts, dispensing, and expiry across every product and batch. Automated thresholds surface low stock and approaching expiry before they become shortages or waste, and each dispensing event adjusts counts immediately so the recorded quantity matches the shelf.
Manual stock tracking drifts out of sync the moment a shelf and a spreadsheet disagree. The consequences carry real cost and safety weight: essential medicines run out unnoticed, over-ordered stock ties up capital, and expired products sit undetected until someone reaches for them. Batch-level detail (which lot expires when) is exactly what manual methods handle worst.
Workflow analysis of dispensing and restocking showed that inventory error accumulates at the transaction level (a dispense not recorded, a delivery logged in bulk without batch detail) rather than in periodic counts. It also confirmed that expiry risk is inherently per-batch, not per-product. These findings drove a model that records every stock movement as it happens and tracks quantity and expiry at the lot level.



The relational model centers on Product, Batch, StockMovement, Supplier, and User. A Product has many Batches, each with its own quantity and expiry date; a Batch belongs to a Supplier via its receipt. Every receipt, dispense, and adjustment is recorded as a StockMovement referencing a Batch, so current quantity is the sum of movements and full history is preserved. Alert thresholds are stored per Product, letting reorder points and expiry windows be tuned individually.
A REST API over /api/products, /api/batches, /api/movements, and /api/suppliers, where dispensing and receiving are modeled as movement-creating endpoints (POST /api/movements) rather than direct quantity edits, so stock can never change without an auditable record. Alert queries expose items below threshold or nearing expiry. Authentication is JWT-based, with role-based authorization distinguishing dispensing, receiving, and management permissions.
A Next.js frontend with route segments for catalog, receiving, dispensing, and reporting, composed from a shared component library (tables, forms, alert cards). Server components render inventory and report data; client components handle the dispensing and receiving forms with immediate validation. An alerts panel is a shared component surfaced across relevant screens.
A Node.js and Express.js backend over PostgreSQL (via Prisma), organized into routes, controllers, and services. Stock calculations and threshold evaluation live in the service layer; movement creation runs in transactions so concurrent dispenses cannot corrupt counts. A scheduled job evaluates expiry and reorder thresholds to generate alerts, keeping that logic out of request handlers.



Links will be added when the project is published.
Get in touch
We'd be glad to discuss how a solution like this could fit your organization.