MediStock
Clinic Inventory & Expiry Management
MediStock is a self-hosted inventory platform for independent clinics and small pharmacies. It brings medicines, consumables, and controlled-substance records into one system, replacing spreadsheet tracking with batch-level stock records, expiry checks, and purchasing workflows. The platform runs on the clinic's local network, keeping supply data within its own infrastructure. Staff can identify batches approaching expiration, follow expiry-aware dispensing rules, and review stock movements. Purchase order drafts support replenishment, while audit records document inventory activity for inspection and review.
Keep Expiry Dates, Stock Movements, and Reorders Connected
Challenges
- Available stock depended on batches and locations. Dispensing needed to account for expiration dates and storage areas, including refrigerators, controlled cabinets, and general shelves.
- Concurrent dispensing required consistent balances. Multiple sessions needed to work against the same stock records without allocating the same quantity twice.
- Expiry checks needed to happen during dispensing. Reports could highlight approaching expiration dates, but batch selection and expired-stock restrictions also needed to apply when stock was issued.
- Inventory activity needed a traceable history. Controlled-substance movements and differences found during physical counts required records that could be reviewed afterward.
- Offline activity needed reconciliation. Keeping the dispensing screen available during a brief interruption also required a way to reconcile its recorded movements when connectivity returned.
Our Approach
- Record movements in a stock ledger. Every stock movement creates an append-only entry with a signed quantity. Batch availability is derived from those entries, preserving the history behind each balance.
- Apply expiry checks inside database transactions. During connected dispensing, the system locks the relevant batch rows, selects the earliest-expiring eligible batch that satisfies the requested quantity, and records the deduction atomically.
- Maintain a current availability view. A Redis-backed read model holds availability by item and location. Ledger events refresh this view, allowing the dashboard to retrieve balances without recalculating the complete movement history for each request.
- Connect replenishment with procurement approval. Historical dispensing activity informs reorder points and safety stock levels. Stock below its threshold generates a purchase order draft for procurement review, approval, and PDF export.
- Document controlled-substance movements and discrepancies. The register captures the dispensing user, patient reference, quantity, and running balance. Cycle-count reports compare physical quantities with system records.
- Proposed offline reconciliation design. Before a device disconnects, the server would reserve specific batch quantities for it and remove those quantities from shared availability. Offline dispensing would be limited to that allocation, with local expiration checks and a unique ID for each transaction.
On reconnection, the server would validate permissions and reconcile pending movements against the reservation inside database transactions. Duplicate submissions would be ignored, and conflicting entries would remain available for review against physical stock. Corrections would create additional ledger entries rather than overwrite history. Unused reservations would return to shared availability after reconciliation.
Development & Framework
- Frontend: React, Inertia.js, TypeScript, Tailwind CSS, shadcn/ui
- Ledger Tables: TanStack Table
- Backend: Laravel 12
- Database: MySQL 8
- Caching and Queues: Redis
- Offline Interface: Service workers
- Feature Flags: Laravel Pennant
- Authentication: Laravel Fortify
- Access Roles: Pharmacist, Inventory Manager, Procurement, Auditor
- Controlled-Substance Access: Multi-factor authentication
- Document Storage: Local disk with spatie/laravel-medialibrary
- PDF Generation: barryvdh/laravel-dompdf
- Testing: Pest and database transaction tests for stock-ledger mutations
- Static Analysis: PHPStan level 6
Key Features
Expiry-Aware Stock Rotation
First-Expired, First-Out logic guides batch selection during dispensing. Visual indicators highlight batches approaching expiration.
Expired stock is blocked by default. The documented exception workflow requires a supervisor's digital signature and a mandatory reason code.
Reorder Drafts & Procurement Approval
Item-level reorder points and safety stock calculations use historical dispensing activity. Low stock triggers a purchase order draft that procurement can review, approve, and export as a PDF.
Controlled-Substance Register
Each movement records the dispensing user, patient reference, quantity, and running balance. Multi-factor authentication is enforced for controlled-substance workflows.
Cycle-Count Discrepancy Reports
Physical counts are compared with system balances to identify differences. PDF discrepancy reports support investigation alongside the recorded stock history.
Offline Dispensing Interface
Service workers cache the dispensing interface for brief network interruptions, with logs synchronized when connectivity returns. Laravel Pennant controls availability of the offline module. Device-level stock reservations and exception handling form the proposed reconciliation extension.
Local Hosting & Document Storage
The application operates on the clinic's local network. Supplier documents are stored locally, with access organized around Pharmacist, Inventory Manager, Procurement, and Auditor roles.
Structure/Layout
MediStock uses a Laravel backend serving a React single-page application through Inertia.js. Inventory records connect items with batches, expiration dates, storage locations, and stock movements. Connected dispensing runs through database transactions. Accepted movements enter the ledger, and an event listener refreshes the Redis availability view used by the dashboard. Procurement follows a separate approval path. Stock thresholds generate purchase-order drafts, while cycle counts produce discrepancy reports for reviewing differences between physical stock and recorded balances. The offline interface caches the dispensing screen and synchronizes logs after connectivity returns. The proposed reconciliation extension would add device-specific stock allocations, duplicate checks, and an exception-review process before reservations are released.
Branding & Visuals
The interface centers on the information staff need to review stock: batch quantities, expiration dates, storage locations, and movement records. Near-expiry flags draw attention to batches requiring review, while the ledger table provides the entries behind each balance.
Purchase order drafts and discrepancy reports carry that information into procurement and stock-review workflows. The emphasis is on making operational details clear where staff need them.
Start Your Journey With Us
Need self-hosted clinic inventory software with batch tracking, expiry controls, and procurement workflows? Red Star Technologies can help you develop a system around your inventory processes and local hosting requirements.
Tell us how your team manages stock, dispensing records, and replenishment.
Discuss Your Inventory Platform