PulseWard
A multi-tenant hospital management system, offline on the ward or hosted.
A hospital management system for clinics, hospitals, diagnostic laboratories, pharmacies and groups: appointments, charts, orders, results, prescriptions, pharmacy stock, beds, emergency, billing and insurance, across three portals backed by one API. Every row carries a tenant, so one deployment runs many hospitals without their data meeting, and any hospital can export what it owns and leave.
Built with
Highlights
- ▸Registration, the doctor's list, charts, lab and imaging orders, prescriptions, pharmacy dispensing, beds and discharge, an emergency board with the ambulance crew's handover, one bill for all of it.
- ▸One API gateway serves three portals (patient, staff, platform operations) and every route is gated by role, by tenant and by whether the hospital has that module switched on.
- ▸Multi-tenancy is a row, not a deployment: a doctor practising at two hospitals has one login and two memberships, and nothing clinical crosses between them.
- ▸Sixteen modules can each be switched off per hospital, each saying plainly what stops, what is kept and how many records it holds. One build serves a clinic, a laboratory, a pharmacy or a hospital.
- ▸Runs offline on hardware the hospital owns or hosted, with no migration between the two, and a hospital can export every row it owns as one file, so leaving is supported, not negotiated.
What it does on a working day
A patient books or walks in, is registered and gets a hospital number. The front desk fills the doctor's list. The doctor opens the chart, records vitals and a note, orders a test or an X-ray and writes a prescription. The lab or the imaging room results it, the pharmacy dispenses against the slip, and the cashier raises one bill for all of it. A patient who is admitted has a bed, a ward round and a discharge summary. A patient who arrives by ambulance goes on an arrivals board with a triage colour and the crew's structured handover.
That whole path is one system rather than a clinical product with a billing product beside it, because the gap between the two is where small hospitals actually lose money: the test that was done and never charged for, the prescription the pharmacy never saw. Sixteen modules sit on that spine and each can be switched off, so a single doctor's clinic, a diagnostic laboratory, a pharmacy and a two hundred bed hospital all run the same build with different pieces turned on.
What a patient walks out with is printed and verifiable: a prescription slip carrying a code that stays answerable for as long as the record exists, a discharge summary, a lab report, an identity card.
Why one process instead of a service per concern
The first version of this was a set of services: auth, notifications, clinical, billing. It was harder to run than it was to write, and the hospital it was for has one Mac mini.
So it collapsed into a single Hono app on Node 24 with SQLite in WAL mode. That is not a shortcut. A hospital with forty staff generates a workload a single process handles with room to spare, and the thing that actually fails in a small hospital is not throughput, it is somebody having to keep five containers alive. One process with one database file can be backed up by copying it, restored by putting it back, and understood by one person.
The parts that would genuinely be someone else's problem are the ones kept outside: scheduling goes to Chronos Ledger and any AI call leaves through CogniGate on the hospital's own account. Each of those sits behind an interface, so a hospital that does not want one gets a version without it rather than a broken page.
Owned hardware, and a door out
The design constraints came from a real small hospital, not from a market study. Its network drops. Its doctors want to see the ward from home. Its budget is a hardware purchase, not a per-seat subscription. So it runs offline on a machine the hospital owns, reached from outside over a private tunnel rather than an exposed port, and it moves to a hosted instance without a migration because storage and scheduling sit behind interfaces. Indian health network (ABDM) identity is wired in from the start rather than bolted on, and modules are priced separately, so a clinic that will never admit a patient does not pay for an inpatient ward.
Telling a hospital its data is its own only counts if there is a route out that does not go through us. The export is a file: every record the tenant owns, streamed as one archive that declares every table inside it, with retention set by the hospital rather than by us. Billing follows the same rule. An account that stops paying walks down a ladder (a notice, then read only, then the narrow set of routes needed to settle the bill and take the data out) instead of falling off a cliff. There is no state in which a hospital is locked away from its own records.
From the README
PulseWard HMS
A multi-tenant hospital management system: one API, three portals, any number of hospitals.
One Hono gateway on Node 24 backs three role-specific web portals. Every row carries a tenant. Every hospital can be handed its own data and walk away with it.
What this is
A hospital signs up, gets its own workspace, and never sees another hospital's data. A doctor who practises at three of them signs in once. An administrator turns modules on and off, writes the roles their hospital actually has, and can export everything the hospital put in as one file — and read that file back into a database with one command.
| Backend | A single Hono API gateway on Node 24. Every route, the auth, the tenancy, the audit trail and the notification fan-out live in this one service, which runs as one or more identical worker processes, so there is no second service to keep in step. |
| Storage | SQLite through Node's built-in node:sqlite in WAL mode. 102 tables, no native module to compile, one file to copy. |
| Frontend | Three Vite + React 18 single-page apps, one per portal, sharing five local packages for UI, formatting, appearance, accessibility and design tokens. |
| Auth | JWT (HS256 via jose), 15-minute access tokens, single-use rotating refresh tokens, Argon2id passwords. |
| Tenancy | Every record carries a tenant_id; a person is separate from their membership at a hospital, so one login can hold several. |
The three portals
| Portal | Who it is for | Dev port |
|---|---|---|
| Patient portal | Appointments, results, prescriptions, messages, the patient's own record | 4313 |
| Operations dashboard | The platform team only: health, incidents, establishments, terminology, plans, the team | 4312 |
| Staff workspace | Clinicians, front desk and administrators, each shown what their role allows | 4180 |
Architecture
In production an nginx reverse proxy (nginx/nginx.conf) serves the
built patient portal and staff workspace and forwards /api/* to the gateway container
(see docker-compose.yml). The operations dashboard is not served
there; it runs only at the platform's own desk.
What happens to a request
Multi-tenancy: a person, and their memberships
A real person is one row in identities — email is deliberately not unique across
tenants. Each users row is that person's membership at one hospital, carrying the
tenant_id, the role and the link back to the identity.
A doctor practising at three hospitals has one identity and three membership rows, and the workspace switcher moves between them without any clinical data crossing the boundary. The only thing visible across tenants is free/busy calendar intervals — never the patient, the reason, or which hospital the appointment belongs to.
Modules a hospital can turn on
Sixteen modules, each switched on or off per tenant from the Modules page of the staff workspace. Switching one off hides it from the portals. For every module except AI Assistant, Telehealth, Keep drugs private and More attendants per patient, switching it off also closes that module's routes at the API, so the gate is not a matter of which buttons are drawn.
| Module | Key | What it gates |
|---|---|---|
| Laboratory | labs | Orders, catalogue, panels, results, verification |
| Radiology | radiology | Imaging orders and reports |
| Pharmacy | pharmacy | Prescriptions and dispensing |
| Inpatient | inpatient | Admissions, beds, IPD encounters |
| Billing | billing | Invoices, payments, revenue cycle |
| Secure Messaging | messaging | Secure patient/clinician messaging |
| AI Assistant | ai | CogniGate-backed assistance |
| Keep drugs private | drug_keep | Keeping the hospital's own drugs off the shared list |
| More attendants per patient | extra_attendants | More than 2 attendant passes at once for one patient |
| Emergency Codes | emergency_codes | Code definitions and activations |
| Emergency Department | emergency | Arrivals board, triage colour, handover |
| Queue Management | queue | Token issue, live queue, waiting-hall screens |
| Telehealth | telehealth | Tele-visit encounters |
| Chronos Rota | chronos | Rooms, busy hours and room holds kept in Chronos |
| Forms and Consents | forms | Form templates, consents, charts on the patient file |
| Insurance | insurance | Payers, insurance cover, cashless pre-authorisation |
| Operation theatre | theatre | Theatres, surgical cases, safety checklist, times |
| Bio-medical waste | biowaste | Waste register, accidents and Form IV totals |
| General stock | inventory | Storerooms, items and packs, receiving, issuing |
Roles and permissions
Seven built-in role slots — owner, platform_staff, admin, clinician, patient,
frontdesk, ops — sit under a per-tenant custom-role layer:
- 52 permission keys describe what can be done, independent of any job title.
- 21 role presets give a hospital a running start (ward nurse, lab technologist, pharmacist, billing clerk, and so on). Presets for a module a tenant has switched off are not offered.
- A tenant writes the roles it actually has, names them in its own vocabulary, and hands one to a person. The role name is the gate.
- Separation of duties is enforced where it matters: whoever entered a lab result is the one account that cannot sign it off.
Data portability
A hospital's data is the hospital's. Both directions exist and are tested end to end.
- Export streams one line at a time, so the peak cost is the largest single table rather than the whole hospital. It carries a manifest saying which tables are in it and which are deliberately not, and a trailer saying what should have arrived — a download cut in half is detectable rather than quietly short.
- Import refuses rather than half-writes: an incomplete file, a hospital already present, a table or column this software does not have, or a file trying to bring its own people in all stop the whole thing inside one transaction.
- Scans travel too. Each attached file follows the rows in pieces and is checked against its fingerprint on arrival, so a file changed or cut short on the way refuses the import instead of landing on a chart.
- Passwords never travel. People are rebuilt from their membership rows at import time and land holding a credential nobody has; anyone the target database already knows keeps the password they already had.
Running it
Prerequisites are Node.js 24 and Corepack-enabled pnpm 11.27.1.
corepack enable && corepack prepare pnpm@11.27.1 --activate
pnpm install --frozen-lockfile
cp .env.example .env
pnpm run jwt:generate -- --apply # writes a fresh JWT_SECRET into .env
pnpm run dev # gateway on :8787 plus all three portals
docs/development.md has the rest: where each surface
listens, the demo accounts seeded into an empty database, every environment
variable, the full command list, how the tests are laid out and how a release is
cut.
Documentation
The VitePress site under docs/site/ is the operator-facing manual:
- API reference
- Architecture — auth flow · data model · service map · deployment
- Local development · Multi-tenancy · Environment variables
The specification pack
docs/spec/ is the product source of truth: every capability a
hospital needs, with a stable ID, a status and a delivery phase. It is what the build
follows, item by item.
| Status | Items |
|---|---|
| ✅ Built | 26 |
| 🔶 Enhance — exists, needs commercial depth | 21 |
| 🆕 New — not yet started | 58 |
| Total | 105 |
Start at docs/spec/README.md for the master inventory, or
03-roadmap.md for the phased plan and its ordering rules.
Repository layout
pulseward-hms/
├── apps/
│ ├── admin-console/ # Staff workspace (React + Vite, :4180)
│ ├── operations-dashboard/ # Ops dashboard (React + Vite, :4312)
│ ├── patient-portal/ # Patient portal (React + Vite, :4313)
│ └── landing-page/ # Static marketing site
├── packages/ # ui · format · appearance · a11y · design-tokens
├── services/
│ └── api-gateway/ # The single Hono backend — routes, auth, DB, notifications
├── docs/
│ ├── site/ # VitePress documentation site
│ └── spec/ # Product specification pack (the source of truth)
├── tests/ # Jest API, UI, tooling and contract-parity tests
├── scripts/ # Release pipeline, lifecycle and quality-gate tooling
├── nginx/ # Production reverse-proxy config
└── docker-compose.yml # Production stack: gateway + nginx + SPAs
Tech stack
| Layer | Technology |
|---|---|
| Runtime | Node.js 24 |
| API | Hono · jose (JWT) · Argon2id · zod |
| Database | SQLite via built-in node:sqlite, WAL mode |
| Frontend | React 18 · Vite · local workspace packages |
| Tooling | pnpm workspaces · Jest · ESLint · Prettier |
| Ops | Docker Compose · nginx · VitePress · GitHub Actions |
Security posture
- Tenant isolation is a property of every query, not a middleware afterthought, and is covered by dedicated cross-tenant tests.
- Least privilege through 52 permission keys checked at the route, on top of role gates. A hospital can narrow a role but cannot widen one past what the module allows.
- Audit — every consequential action appends to
audit_eventswith actor, scope and IP; PHI reads are auditable per tenant. - Credentials at rest — Argon2id (19 MiB, 2 passes) for passwords, an older bcrypt
hash replaced at the next sign-in; notification provider secrets sealed with
JWT_SECRETand never returned by any route. - Tokens — 15-minute access tokens, single-use refresh tokens rotated on every use and revocable from the server side.
License
Proprietary and confidential. See LICENSE.md.