Own product
Domi
A home-visit round loses more to a cancellation than a clinic does — the clinician is already on the road. Domi ranks the waiting list against the gap, texts the people who actually fit it, and books the first yes without anyone ringing round.
- Type
- Own product · UK
- Role
- Node 22 built-ins · node:sqlite in memory · Postgres (Supabase, London) as the durable record · service worker · Server-Sent Events · Twilio · postcodes.io and OSRM · Render and Fly.io
- Status
- Pre-launch
- Built with
- Node.js
- JavaScript
- PostgreSQL
- Supabase
- Render
- GitHub Actions
What it needed
- Interface
- Software
- Infrastructure
01
Problem
A home-visit practice loses more to a cancellation than a clinic does. The clinician is already out on the road, the gap is too short to fill by ringing round between other calls, and the people on the waiting list who would happily have taken it never hear that it existed.
Plenty of software keeps a diary. The part nobody does is act on the gap — work out who actually fits it, ask them, and book the answer, without a person in the office holding the whole thing in their head while the clock runs down.
02
Approach
The refill engine decides in two stages, and the first one is not negotiable.
Hard rules come first: only an optometrist for an eye examination, never a dispensing optician; an NHS sight test only when PCSE can still be notified 48 hours ahead; texts only to patients who take texts, with the rest listed for the office to ring. What survives that is then ranked — clinical priority, how local they are, days waited, preferred clinician — and every candidate shows the reasons it ranked where it did.
How close the gap is changes the shape of the offer.
Days or hours away, it goes to one person at a time with room for several rounds. Under an hour of slack, the top three are asked at once, the first YES wins and the others are told it has gone. Too close to confirm anyone, the slot is deliberately left open rather than spent on someone who cannot be ready.
The booking, the texts and the live update are one transaction.
Texts and events are only released once the database has committed, so a patient is never told about a visit that did not save, and two YES replies cannot both win the same slot.
An NHS rule sits in the code rather than in somebody's memory.
In England a home sight test needs a pre-visit notification to PCSE at least 48 hours ahead, so Domi will not offer an NHS test for a gap sooner than that — a gap today goes to a glasses delivery, a repair or a follow-up instead, none of which need notifying. Every NHS test booked or cancelled lands on a notifications list with its deadline, so the notification and the GOS 6 claim cannot drift apart.
Routes are planned properly where it is cheap to and approximately where it is not.
Up to seven visits in a half-day, every order is tried; beyond that it is nearest neighbour then 2-opt. Mornings stay mornings, nothing moves inside half an hour today, and a plan has to save at least ten minutes before it is offered at all.
The demo runs on Node's built-ins alone.
node:http, node:sqlite, node:crypto, and plain HTML, CSS and JavaScript in the browser with no build step. The single npm package, the Postgres client, is required lazily and only when a live database is configured — so the demo genuinely loads nothing. A live practice then runs on the same in-memory SQLite database as the demo, which is the point: every booking rule, transaction and test stays identical. Postgres is the record that survives a restart — triggers note every changed row, a committed transaction writes those rows to Postgres in order, and the server only answers once they are in.
03
Outcome
It is a working demo and no practice is using it.
That is the repository's own position and it is worth repeating rather than softening: the demo keeps everything in memory, holds invented patients only, resets itself, and lists six things needed before a real patient goes near it — a permanent UK database with a restore that has actually been tested, real accounts rather than demo ones, encrypted offline copies on clinicians' phones, secrets in a host's store, self-hosted or contracted routing, and the paperwork (a DPIA, ICO registration, processing agreements, the NHS Data Security and Protection Toolkit, Cyber Essentials).
The tests were measured by running them, not counted.
128 tests across 17 files: 125 pass, 0 fail, 3 skipped. They cover the refill ranking, the planner, the importer, the PCSE notice window, authentication and the live event stream.
Two decisions are worth naming because they cost something. Patients never see Domi — every text, the booking page and the invoices carry the practice's own name, which means the product gives up its own branding at exactly the moment a patient is paying attention. And the demo gives every visitor a private in-memory copy of the sample practice through AsyncLocalStorage, cleared after three hours idle, so two people on the same link cannot see or break each other's data — which costs a real database but makes the demo safe to hand to anyone.
The sample practice, Aire Valley Eyecare, is invented, and the repository records that it was checked against a web search before use. Every patient in these screenshots is invented too.
The screens
3 captures



If this looks like your problem
Tell me about it and I'll tell you what it takes.