Cortexley
Case Studies

What Changes When You Build POS for Regulated Retail

Ali Azaan·Founder, Cortexley··7 min read

BSc (Hons) Software Engineering, Liverpool John Moores University. Has shipped Shopify migrations, custom POS systems, and AI automation builds for ecommerce and regulated-retail clients.

Compliance isn't a feature, it's an architecture decision

Why batch-level tracking and audit logging need to be designed in from the schema up. This is the lesson that separates a pharmacy POS build from a general retail POS — not the UI, not the reporting, but the data model underneath everything.

Batch-level tracking means every unit of stock has a provenance: which batch it came from, when it was manufactured, when it expires, and what the controlled-substance classification is if applicable. A generic inventory system tracks product-level stock. A pharmacy needs batch-level stock. That's not a configuration difference — it's a schema difference. You can't add batch-level tracking to a system that wasn't built for it without rebuilding the core tables that every other feature depends on.

Audit logging has the same characteristic. An audit log that was added after the fact to a system that wasn't designed for it is incomplete by definition — it logs the actions the developers remembered to log, not every action that could matter in an examination. A purpose-built audit log is embedded in the transaction layer: every state change in inventory, every sale, every return, every stock adjustment generates a log entry automatically, regardless of which part of the UI initiated it.

We learned this on the first pharmacy build. The client had a previous system that had had batch tracking added post-hoc. The stock counts were mostly correct. The audit logs were incomplete in ways that only became visible during a compliance examination — specific report formats that the regulators expected, showing batch provenance for controlled substances over a date range, could not be produced cleanly. Building the second system with batch tracking and audit logging as first-class schema entities from day one produced a system that passed the same examination without any special-case reporting work.

Designing for staff, not just data

Checkout flows built for speed under real-world pharmacy counter conditions. A compliance-first system that is slow to operate is a system that staff will work around. Workarounds create compliance gaps. Designing for staff speed is not in tension with compliance — it's part of it.

The pharmacy counter is a high-pressure environment. Staff are handling multiple customers, managing queue expectations, answering clinical questions, and operating the POS simultaneously. A checkout flow that requires four screens to process a sale — product scan, batch selection, quantity confirmation, payment — will be circumvented within a month. Staff will find ways to skip steps, use override functions, or default to whatever path processes the fastest.

The design solution is to make the compliant path the fast path. Batch selection, in most cases, should default automatically to the oldest batch (FEFO — first expired, first out). Override should be available when the default is wrong, but the default should handle 90% of transactions without intervention. Payment processing should be one step. Receipt printing should be triggered by the payment confirmation, not a separate button press.

We mapped every transaction type — standard sale, prescription refill, controlled substance, return, exchange, bulk order — and for each one designed the fastest compliant path. Counter staff were involved in the design review, not just the UAT. The insight that changed the most flows was simple: staff's hands are often occupied. Multi-step flows that require switching between keyboard, touchscreen, and scanner are harder than flows that use a single input mode per step.

What regulators actually check

The specific reports and logs that matter during an audit. This section is practical because the requirements are specific and public — knowing what the examination looks for makes it possible to design the system around producing those outputs cleanly.

For pharmacy retail in most jurisdictions, regulators focus on three areas: controlled substance tracking (what was dispensed, to whom, in what quantity, from which batch, on what date), expiry management (what products are within 90 days of expiry, what has been removed from inventory and why), and staff authorisation (who is authorised to perform which transaction types, and whether those permissions were respected in every transaction).

The controlled substance report is the most scrutinised. It needs to be producible by date range, by product, and by batch number. It needs to include the pharmacist or authorised staff member on each transaction. It needs to reconcile closing inventory against opening inventory plus purchases minus dispensed quantities — every variance needs an explanation.

Building the system to produce these reports on demand — not as a special export function, but as a standard reporting interface — means that compliance is not an event (the audit) but an operational state (the system is always in a reportable condition). This is the architectural goal: a system where the compliance report is produced by querying the same data that drives the daily operation, not by a separate compliance module that aggregates after the fact.

Generalizing beyond pharmacy

How the same patterns apply to other regulated retail categories. The pharmacy build produced an architectural template — batch tracking, audit logging, role-based permissions, FEFO inventory — that also shaped an optical retail build and applies with minor modifications to any regulated retail environment.

Food retail with traceability requirements (restaurant chains, specialty food retailers) needs batch provenance for the same reason pharmacy does: a recall requires knowing which inventory came from which batch and where it was sold. The schema is the same; the specific fields (temperature logs, supplier certifications) differ.

Alcohol retail and tobacco retail have age-verification and licensing requirements that translate to the same audit log architecture: who performed the verification, what method was used, at what time. The operational UX is different — a visual age check is a human action that needs to be logged, not a system action — but the logging architecture is identical.

High-value goods retail (jewellery, watches, firearms) has serial-number-level tracking requirements that are analogous to batch-level tracking. The data model is a one-to-one relationship (unit → serial number) rather than a many-to-one relationship (units → batch), but the compliance reporting requirements — provenance, chain of custody, authorised disposition — follow the same pattern.

Frequently asked questions

What does a pharmacy POS system need to do that a regular POS doesn't?

Batch-level stock tracking, controlled substance dispensing logs, expiry management with FEFO inventory logic, staff authorisation levels with audit trails, and the ability to produce compliance reports by date range, product, and batch number. These are architecture requirements, not features — they need to be built into the data model from the start.

How long does a custom pharmacy POS take to build?

A single-branch pharmacy POS with full compliance reporting typically takes 14–18 weeks. Multi-branch deployments with centralised stock management and inter-branch transfer workflows add 4–6 weeks. Hardware integration (receipt printers, barcode scanners, cash drawers) is included in these timelines.

Work with us

Need help with your project?

We build Shopify stores, custom software, and AI tools for ecommerce brands — remote, worldwide.