# KSPHCB Digital Revenue Collection Platform
Kaduna State Primary Health Care Board — digital POS collection and monitoring.
Front end for the system described in `KSPHCB_PRD_Updated.pdf`.
## Two portals
The PRD's §2 lists three surfaces; §1 settles them into two applications, because
the POS terminal and the mobile app are one PWA on two form factors.
| | Route | Users | PRD |
|---|---|---|---|
| **Admin Web Portal** | `/` | Super, Board, Finance and Facility Administrators, Auditors | §2A, 3–12, 14–16 |
| **Operator PWA** | `/operator/` | POS Operators | §2B, §2C, §5.1, §6.1, §13 |
They share the design system (`src/components/ui`) and the reference catalogue
(`src/data/catalogue.ts`) but build as **separate bundles**. A POS terminal must
never download the board's analytics or transaction ledger — the operator app is
~35 kB of its own code, against the admin portal's ~600 kB.
## Getting started
```bash
npm install
npm run dev # admin at /, terminal at /operator/
npm run typecheck # also gates `npm run build`
npm run build
```
## Admin Web Portal
Twelve screens covering the dashboard, live sales, transactions, drug and service
catalogues, the user-added review queue, facilities, devices, staff and roles,
analytics, reports and the audit trail.
**Every figure derives from one ledger.** `src/data/seed.ts` generates a
deterministic 35-day transaction ledger — seeded from the calendar date, so
numbers hold still across reloads while "today" always means today — and every
headline number is computed from it. No figure is stated twice, so two screens
cannot disagree. `src/data/store.ts` holds catalogue and personnel edits, and
recomputes counts on every mutation.
Swapping to the real API means replacing the exports of `src/data/mock.ts` with
fetches. Page code does not change.
## Operator PWA
Installable terminal app for Android POS devices and phones.
- **Offline-first.** Every sale is written to IndexedDB before the operator is
told anything, …