Delivered remotely for a business based in Dublin, Ireland. Names withheld by agreement.
Project Overview
A pharmacy counter is not an ordinary retail checkout. Every dispensed pack carries strict batch provenance, cold-chain or expiry constraints, patient allergy checks, and statutory reporting duties—yet many dispensaries still run on aging desktop software or generic retail ERP extensions bolted onto fragmented spreadsheets. When a national medicine recall hits or a patient arrives with overlapping prescriptions from multiple specialists, staff lose precious minutes hunting paper batch logs or manually reconciling shelf stock.
Designed around European and Irish community and hospital pharmacy workflows in Dublin, we built a pharmacy management system powered by Laravel, Vue, and MySQL. The platform connects electronic prescription intake, real-time drug interaction screening, GS1 DataMatrix barcode verification, First-Expired-First-Out (FEFO) lot control, and automated wholesaler replenishment inside one fast, keyboard-first dispensary interface.
Dispensary & Stock Control Failures
Observations across busy urban dispensaries and clinical stockrooms highlighted four persistent bottlenecks:
- Blind batch consumption: Generic SKU inventory counted total boxes on hand while ignoring lot expiry dates, leaving expiring stock buried at the back of shelves and complicating targeted supplier recalls.
- Slow mouse-heavy counter interfaces: Pharmacists wearing gloves or juggling physical packs lost rhythm when legacy web forms forced repeated mouse clicks between barcode scans and label printing.
- Disconnected safety checks: Allergy flags, duplicate-therapy warnings, and controlled-drug thresholds sat in separate reference books or external portals rather than triggering inline before label print.
- Stockout surprises on critical lines: Replenishment relied on manual end-of-day walkarounds instead of real-time par-level velocity and supplier EDI availability.
Architectural Strategy
We anchored the backend around an immutable double-entry inventory ledger in MySQL controlled by a modular Laravel API, paired with a keyboard-first Vue 3 dispensary application. Rather than storing mutable stock_on_hand integers that hide discrepancies, every medication movement—wholesaler receipt, split-pack dispensing, inter-branch transfer, return, or wastage—writes an auditable movement record linked to a specific batch lot and actor.
To match physical counter speed, Vue manages local scanner focus states cleanly in Pinia and pre-loads active formulary interaction indexes in Redis so clinical safety checks execute in milliseconds as items hit the dispensing basket.
Core Capabilities
- FEFO Lot Allocation & Recall Tracing: Automatically picks earliest-expiring eligible lots during prescription filling and isolates recalled batch numbers across every branch in seconds.
- GS1 & FMD Barcode Verification: Parses 2D DataMatrix codes directly from HID scanners to verify GTIN, batch, expiry, and unique serial identifiers against anti-counterfeiting registries.
- Inline Clinical Screening: Cross-checks patient medication profiles for drug-drug interactions, therapeutic duplication, and documented allergies before dispensing sign-off.
- Split-Pack & Compounded Unit Math: Tracks full packs alongside loose tablet balances and fractional liquid volumes cleanly without rounding drift.
- Automated EDI Replenishment: Monitors real-time rolling demand and minimum shelf thresholds to stage draft purchase orders for pharmaceutical wholesalers.
Technical Architecture
USB barcode scanners feed GS1 payloads directly into the Vue dispensary client, which communicates over authenticated APIs with Laravel. Laravel runs clinical safety checks against Redis-cached formulary rules, allocates stock lots inside atomic MySQL InnoDB transactions, triggers external serialization verification where required, and dispatches thermal ZPL label jobs and asynchronous wholesaler ledger updates.
Flow: Barcode Scanner & Vue Dispensary UI → Laravel API & Clinical Screening (Redis Formulary) → MySQL InnoDB (FEFO Batch Locks & Ledger) → FMD Serialization & EDI Gateways → Thermal Label Print & Branch Sync
Separating high-frequency formulary lookups into Redis from transactional lot deductions in MySQL ensures busy multi-terminal counters never bottleneck on read contention.
Technology Stack
| Category | Technology detail |
|---|---|
| Backend Application | Laravel 11 API orchestrating dispensing queues, clinical checks, and supplier orders |
| Dispensary & POS UI | Vue 3 with TypeScript and Pinia delivering keyboard-driven scanning and verification screens |
| Inventory & Ledger DB | MySQL 8 managing lot-level stock balances, controlled-drug ledgers, and sales transactions |
| Cache & Job Queues | Redis powering drug-formulary lookup caches and Laravel background replenishment workers |
| Serialization & Scanners | GS1 DataMatrix and EU FMD verification gateways integrated with USB/HID barcode scanners |
| Clinical Decision Rules | Formulary drug-drug interaction, allergy, and dosage-range screening service in PHP/Redis |
| Label & Receipt Engine | Direct thermal label formatting (ZPL/ESC-POS) for prescription vials and patient leaflets |
| Container Runtime | Dockerized PHP-FPM, Nginx, and worker nodes with zero-downtime deployment pipelines |
| Audit & Reporting | Append-only MySQL dispensing registers and scheduled EDI procurement exports |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Concurrent dispensing across multiple stations risks overselling scarce cold-chain lots | Ordered MySQL SELECT ... FOR UPDATE row locks by (branch_id, batch_id) inside dispensing commits; enforces strict transaction discipline while preventing negative lot balances. |
| Running drug-interaction matrices across thousands of formulary pairs slows checkout | Pre-indexed interaction pairs and allergy class trees in Redis hash structures refreshed on formulary updates, avoiding multi-table SQL joins per scanned pack. |
| External FMD serialization APIs occasionally spike in latency during peak afternoon hours | Implemented non-blocking verification calls with configurable SOP fallback queues so pharmacists continue urgent dispensing cleanly and reconcile exceptions asynchronously. |
| Split-pack dispensing creates fractional inventory discrepancies in standard integer schemas | Modeled inventory at the base dispensing unit (tablet/ml) with pack-size conversion metadata on receipt, adding slight display formatting logic in Vue while keeping stock math exact. |
Regulatory Traceability & Access Controls
Operating retail and hospital pharmacies in Ireland demands stringent oversight over controlled schedules, patient medication histories, and anti-counterfeiting verification. Access policies inside Laravel enforce sharp role separation: pharmacy technicians can stage prescriptions, verify stock batches, and print labels, while clinical overrides for high-severity drug interactions and final controlled-substance release require verified pharmacist credentials or PIN re-authentication at the terminal.
Controlled-drug registers operate strictly as append-only ledgers inside MySQL. Wastage, broken vials, or stocktake adjustments require dual-staff sign-off and structured reason codes, producing exportable statutory audit trails without manual spreadsheet transcription. Encrypted backups and scoped branch permissions guarantee multi-site supervisors review aggregate stock metrics without exposing uninvolved patients' clinical profiles unnecessarily.
Dispensary Throughput & Ledger Integrity
Afternoon prescription surges test both database locking and UI ergonomics. In Vue, a dedicated hardware-scanner input parser distinguishes rapid barcode bursts from manual keyboard typing regardless of which form field currently holds focus, allowing staff to scan five packs consecutively without clicking back into a search box.
On the backend, stock balances reconcile against materialized batch summaries maintained inside the same MySQL transaction as ledger appends, keeping shelf-availability checks instantaneous while preserving full historical movement lineage. Scheduled Laravel workers calculate branch reorder proposals and expiring-stock alerts overnight so opening teams start every morning with actionable procurement queues.
Operational Outcomes
Replacing fragmented POS workflows with a batch-traceable Laravel and Vue pharmacy platform strengthened safety, speed, and stock accuracy across dispensing counters:
- End-to-end batch accountability: Automated FEFO allocation and GS1 barcode checks tie every dispensed unit back to its exact supplier lot and expiry window.
- Safer, faster counter verification: Inline clinical interaction screening and keyboard-driven Vue workflows protect patients without slowing peak-hour queues.
- Exact controlled-drug auditing: Immutable double-entry registers eliminate end-of-week reconciliation surprises and simplify statutory inspections.
- Proactive inventory health: Real-time split-pack tracking and automated wholesaler replenishment reduce emergency stockouts and minimize expired-shelf write-offs.