Pharmacy & Inventory
Management System
Production-grade desktop system built for real-world retail pharmacy operations. From batch-level inventory tracking to cryptographic session security — every layer is engineered for the chaos of a high-traffic dispensary counter.
What happens when a pharmacy
runs on paper and memory?
A retail pharmacy is not a simple storefront. On any given day, a mid-size dispensary juggles 2,000+ SKUs from dozens of manufacturers, each with different batch numbers, purchase prices, and expiry dates. Medicines arrive in bulk shipments that need to be split, shelved, and tracked at the batch level — not just by name.
Most pharmacies still manage this with handwritten registers or Excel sheets. The result? Expired stock slipping onto shelves. Purchase prices forgotten days after delivery. Return disputes escalating because no one can trace which batch a specific strip came from. Cashier errors in billing going unnoticed until end-of-day reconciliation fails.
This system was built to replace that entire workflow. Every medicine that enters the store is logged with its batch, supplier, cost, and expiry. Every sale deducts from the correct batch using FIFO logic. Every return reconciles quantities back to the ledger without creating phantom stock. Every user action — from a price change to a void — is audit-logged with the operator's identity and timestamp.
The goal was not to build a tech demo. It was to build a system that a 60-year-old pharmacist, working a 12-hour shift, can operate without training — and that surfaces problems before they become financial losses.
Built for speed. Verified by numbers.
Every layer, purpose-built.
Six technologies, each chosen for a specific architectural responsibility. No bloat, no redundancy.
Electron
Desktop Shell & OS IntegrationWraps the entire React application in a native desktop window with system-level access to file I/O, printer drivers, and OS notifications.
React + Vite
Frontend Runtime & BuildVite delivers sub-second hot module reloads during development. React handles all UI state — from POS cart mutations to real-time inventory search.
FastAPI
Backend API LayerA Python backend running inside the Electron process, exposing RESTful endpoints for every business operation with automatic OpenAPI documentation.
SQLite
Embedded Relational DatabaseZero-config, file-based SQL database living on the local machine. Handles concurrent read/write across inventory, sales, and user tables without a network round-trip.
JWT Auth
Session & Token SecurityStateless JSON Web Tokens authenticate every API request. Tokens carry role claims (Admin vs. Cashier) and expire on configurable intervals.
electron-builder
Packaging & Distribution (NSIS)Compiles the entire stack into a single .exe installer with NSIS scripting for Windows deployment — including auto-update, desktop shortcuts, and registry entries.
Four pillars. Zero compromises.
The system's architecture is divided into four independent subsystems, each handling a distinct operational domain with its own validation, error handling, and audit pipeline.
Intelligent Inventory Engine
Every medicine entering the system is tracked at the batch level — not just by name or SKU. Each batch carries its own purchase price, expiry date, supplier reference, and remaining quantity. When stock dips below a velocity-based threshold (calculated from historical sales cadence), the system surfaces reorder alerts before a stockout ever happens. Expiry warnings fire at 30, 15, and 7-day horizons, giving operators time to push near-expiry stock through discount channels or return pipelines.
Containerized FastAPI CRUD
The Python FastAPI backend launches as a child process inside Electron, binding to localhost on a randomized port. Every CRUD operation — from creating a purchase order to voiding a sale — resolves against the local SQLite database in single-digit milliseconds. Pydantic models enforce strict schema validation at the API boundary, so malformed requests never touch the database layer.
Cryptographic JWT & RBAC
Authentication uses HS256-signed JWTs with configurable expiry. The Admin role governs inventory write operations, vendor management, and financial reporting. Cashier accounts are scoped to POS billing and customer lookup — they cannot modify purchase prices, delete inventory records, or access audit logs. Token refresh logic prevents session hijacking without forcing disruptive re-logins during a shift.
Advanced POS & Return Logic
The billing engine handles multi-item carts with per-item discount logic, tax computation, and real-time stock deduction. Returns are where it gets complex: the system algorithmically reconciles returned quantities back to the correct batches (FIFO-based), recalculates profit margins, and adjusts the inventory ledger — all without leaving ghost quantities or negative stock. Partial returns on a single invoice are supported with line-item granularity.
Need a system built
this robust?
Whether it's a desktop application, an internal tool, or a full-stack platform — we architect systems that operators trust and businesses depend on.