Doctor OS
Clinic software for Indian practices, from the first token in the morning to the collection report at night, plus a Patient Passport that the patient, not the clinic, controls.
My role: Designed and built end to end: data model, API, web app, desktop app and AWS deployment.
- Node.js 22
- Express 5
- PostgreSQL
- React 18
- Vite
- Electron
- React Native
- AWS
Screen 1 of 5: Doctor OS home: next patient, token queue and today's schedule
The problem
Small Indian clinics run on paper registers, re-typed prescriptions and WhatsApp chases. Patient history is scattered across every clinic and lab a patient has visited, and none of it is shareable without either losing privacy or losing the record.
How it fits together
Clients — React 18 web app, an Electron desktop app and an Expo mobile app, all talking to the same /api/v1.
- 01
Clients · Web · Desktop · Mobile
React 18 web app, an Electron desktop app and an Expo mobile app, all talking to the same /api/v1.
- 02
nginx · static + load balancer
Serves the static React build and spreads /api across the API replicas.
- 03
Express 5 API · N stateless replicas
Stateless replicas with /healthz and /readyz, graceful SIGTERM draining and structured pino logs.
- 04
PostgreSQL 16 · data + LISTEN/NOTIFY
Clinical data, consent grants, sessions and OTPs. LISTEN/NOTIFY fans realtime queue updates out to every replica.
See it running
Key decisions
A stateless API from day one
Every replica is interchangeable: sessions, OTPs, rate limits and idempotency keys live in Postgres, realtime fan-out uses LISTEN/NOTIFY, and files go to S3 behind signed URLs. Scaling out is `docker compose up --scale api=N`, and SIGTERM drains in-flight requests so rolling deploys are safe.
Consent as data, not as a checkbox
Access requests record what was asked, grants record what was allowed (never wider than the request), scoped to patient, clinic, doctor and record type, with an expiry. One service decides what each scope reveals, and the same rules serve the patient's own view, clinic views and share links.
Separate token issuers per surface
Staff, Passport and share-link tokens each have their own issuer, so no token works outside the surface it was minted for. Receptionists never receive clinical fields at all; they are removed on the server, not hidden in the UI.
Immutable clinical records
Signed lab results are never edited: an amendment inserts version n+1. Bill corrections mark the original and record a replacement in the same transaction. Every mutation lands in an audit log with before and after values.
What I traded, and why
- Postgres does jobs Redis or a queue would normally do (rate limits, realtime fan-out). That keeps operations to one database today; each piece sits behind a small interface so it can move to Redis or NATS without rework.
- Payments are record-only, with no gateway. Clinics already take cash and UPI; recording them well mattered more than processing them.
What I'd do next, or differently
- Move background work (SMS reminders, report PDFs) into a worker process with pg-boss, keeping the API request/response only.
- Point reporting queries at a read replica as clinics grow.




