WeCare: Pharmacy POS & Dispensing Platform
Every branch on one live system, with each tenant's data walled off in the database and the owner watching it all from a phone.
A multi-tenant operations platform for a multi-branch pharmacy and clinic operator: point-of-sale dispensing, PhilHealth benefit dispensing and claims, inventory, and live executive dashboards across every branch.
- Live in production since August 2026 for a multi-branch pharmacy network
- 85 database migrations, all applied through version control
- 66 SQL functions and RPCs hold the business rules
- 5 user roles, branch-scoped by row-level security
- 14 unit-test suites; 260+ commits since June 2026
- Stock-value ledger load-tested at 10× production volume: 143 ms worst case

Multi-branch operator runs every branch from one platform, with data isolated per tenant and a live CEO view
Team of one· Solo architect & full-stack engineer
No team, no agency, no hand-offs. I owned this project end to end:
- Requirements
- Architecture
- UI & UX
- Database
- Stack
- React 19SupabaseRow-Level SecurityMulti-TenantPostgreSQL
Where AI does the work: Scheduled automation does the watching: low-stock and near-expiry alerts arrive every morning, and claims are assembled from the dispense record instead of paper.
What was broken, and what fixed it
Screens show the app's built-in demo data: fictional branches, patients, and amounts.
Problem: The owner could not see stock value, near-expiry batches, or items about to run out per branch until it was too late.
Fix: An executive dashboard and Command Center show today's sales, transactions, VAT, low stock, and near-expiry across every branch, with 30-day trends and product mix per branch.

Executive dashboard: medicine inventory and dispensed value across every branch at list and store prices, with a per-branch breakdown. 
Command center: today's sales, transactions, VAT, active branches, and low-stock and near-expiry alerts, with live activity across the network. 
Sales view: 30-day trend, product mix, and daily sales per branch. 
Inventory view: stock value and inventory health for each branch. 
The executive dashboard in dark mode. Problem: PhilHealth claims that are late or incomplete get denied, and the filing window closes after 60 days.
Fix: The counter checks the 12-digit PhilHealth ID and the remaining annual benefit, captures signatures, and prints a claim slip per dispense. Claims are assembled from the dispense records against the 60-day deadline.

PhilHealth outpatient dispensing: checks the member's remaining annual benefit and charges eligible medicines to PhilHealth. Patient details blurred. Problem: Receipts had to meet BIR rules for the POS to be accredited.
Fix: A touch-first POS with FEFO batches and Regular, Senior, and PWD pricing issues receipts, X readings, Z close, SC/PWD discount books, voids, and reprints following BIR RMO 24-2023.

Point of sale: a barcode-ready medicine catalog with regular, senior, and PWD pricing; prescription items require a prescriber. Problem: Items ran out and batches expired at a branch before anyone noticed.
Fix: Inventory tracks stock, batches, and reorder points per branch. An expiry view lists batches within 90 days, soonest first, replenishment builds per-branch picking lists, and low-stock and near-expiry alerts arrive every morning at 8 AM.

Inventory: stock, batches, and reorder points per branch, with movements, transfers, purchasing, and suppliers. Problem: The owner could not see what each branch's stock was worth, or why that number changed.
Fix: A Stock Value ledger reconciles opening stock, receipts, sales, dispenses, adjustments, and closing, day by day, and values stock three ways: PhilHealth price, store price, and supplier cost.

Stock value: why a branch's retail stock value moved, day by day, reconciled against a ledger that matches live stock. Problem: One platform had to serve many branches, and many pharmacy groups, without anyone seeing another's data.
Fix: Row-level security on every table scopes each user to their tenant and branch, so even a hand-crafted API call sees nothing it should not. A two-tenant test matrix checks that one tenant sees zero rows of another.
Approach
- The database is the security boundary: row-level security on every table, with tenant and branch scope taken from the signed-in user, so a hand-crafted API call still sees nothing it should not.
- Money-moving operations (sales, dispenses, stock receipts, voids) are single Postgres functions that check role, module, and stock in one transaction.
- Business rules live once in SQL: FEFO batch selection, the annual benefit cap, receipt numbering, and stock valuation. Every screen, export, and alert reads the same numbers.
- Executive views call purpose-built server-side aggregates instead of downloading raw rows.
What it does
Point of sale
- Touch-first cart with live stock per item
- Regular, Senior, and PWD pricing with Rx flags
- Receipts, X readings, Z close, SC/PWD discount books, voids, and reprints following BIR RMO 24-2023
- Thermal receipt printing
PhilHealth benefit dispensing
- 12-digit PhilHealth ID check and remaining annual benefit at the counter
- Prescriber auto-suggest, signatures, and a claim slip per dispense
- Dispense records with status, encoder, cost, and margin
- Claims assembled against the 60-day filing deadline
Inventory
- Live stock value at cost and retail, with batches and reorder points
- Expiry view of batches within 90 days, soonest first (FEFO)
- Replenishment with per-branch picking lists and Excel export
- Branch transfers and purchase orders
- Low-stock and near-expiry push alerts every morning at 8 AM
Executive dashboards
- Command Center: today's sales, transactions, VAT, low stock, and near-expiry across every branch
- Stock valued three ways: PhilHealth price, store price, and supplier cost
- Stock Value ledger reconciling opening, receipts, sales, dispenses, adjustments, and closing, day by day
- 30-day sales trends and product mix per branch
- Branded PDF, Excel, and CSV exports for the board
Multi-tenant SaaS
- Vendor console to provision tenants, branches, and users
- Module flags per tenant and per branch
- Monthly billing statements by email
Security and roles
- 5 roles: Pharmacist, Manager, Owner, CEO, Vendor
- Row-level security on every table
- Installable PWA with an offline shell
Architecture
Interface
- React 19
- PWA
Logic & APIs
- TypeScript
- Realtime
Data
- Supabase
- Row-Level Security
- Multi-Tenant
- PostgreSQL
Infrastructure & delivery
- Cloudflare
- Identity
- 1ReactPWATypeScriptCloudflare
React 19 and TypeScript PWA hosted on Cloudflare Pages.
- 2RealtimeSupabasePostgreSQLRow-level security
Supabase Postgres with row-level security, RPC functions, Auth, Realtime for live stock, and Storage for signatures and claim proof.
- 3
Edge Functions handle user provisioning, billing statements, and push digests; pg_cron schedules the 8 AM digest and monthly billing.
- 4Email
Web Push for alerts, transactional email for statements, and a local print bridge for thermal receipts.
Engineering
- Tenant isolation is tested, not assumed: a two-tenant matrix checks that one tenant sees zero rows of another on every table and role.
- Valuation, reconciliation, replenishment, billing, and Excel export are pure TypeScript modules with unit tests, shared by the UI and the exports.
- Stock-value ledger load-tested at 10× production volume, 143 ms worst case.
- CI runs lint, type-check, and tests; a pre-deploy guard blocks any build missing its production environment.
Outcome
- Live in production since August 2026.
- The operator runs every branch from one platform, with data isolated per tenant and a live CEO view.



