All projects
PrivateActive DevelopmentWeb App

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.

468
REST API operations
143
Database tables
15
Toggleable modules
65
Permissions
350
Test files
3
Portals

Built with

Node.jsHonoSQLiteReactViteJestOpenAPIDocker

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.

Node pnpm React SQLite Contract parity License


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.

BackendA 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.
StorageSQLite through Node's built-in node:sqlite in WAL mode. 102 tables, no native module to compile, one file to copy.
FrontendThree Vite + React 18 single-page apps, one per portal, sharing five local packages for UI, formatting, appearance, accessibility and design tokens.
AuthJWT (HS256 via jose), 15-minute access tokens, single-use rotating refresh tokens, Argon2id passwords.
TenancyEvery record carries a tenant_id; a person is separate from their membership at a hospital, so one login can hold several.

The three portals

PortalWho it is forDev port
Patient portalAppointments, results, prescriptions, messages, the patient's own record4313
Operations dashboardThe platform team only: health, incidents, establishments, terminology, plans, the team4312
Staff workspaceClinicians, front desk and administrators, each shown what their role allows4180

Architecture

API gateway — Hono on Node 24 · :8787

Portals — Vite + React 18

Patient
:4313

Operations
:4312

Staff
:4180

Middleware
JWT · tenant resolution
RBAC · permissions · audit

339 REST operations
/api/v1/*

Notification fan-out
SMS · email · WhatsApp
Telegram · push · webhook

SQLite
node:sqlite · WAL
102 tables

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

SQLiteGatewayBrowserSQLiteGatewayBrowseron 401 the portal silently refreshesand retries once, rotating the refresh tokenGET /api/v1/patients (Bearer access token)1verify JWT → { sub, role, tid, eid }2resolve tenant from Origin / X-Tenant-Key3requireRole(...) then requirePermission("...")4SELECT ... WHERE tenant_id = ?5rows for this hospital only6INSERT INTO audit_events7200 { ok: true, data }8

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.

one person, many memberships

one hospital, many staff

scoped

scoped

scoped

IDENTITIES

text

id

PK

text

email

not unique

text

password_hash

USERS

text

id

PK

text

identity_id

FK

text

tenant_id

FK

text

role

TENANTS

text

id

PK

text

slug

UK

text

name

PATIENTS

ENCOUNTERS

AUDIT_EVENTS

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.

ModuleKeyWhat it gates
LaboratorylabsOrders, catalogue, panels, results, verification
RadiologyradiologyImaging orders and reports
PharmacypharmacyPrescriptions and dispensing
InpatientinpatientAdmissions, beds, IPD encounters
BillingbillingInvoices, payments, revenue cycle
Secure MessagingmessagingSecure patient/clinician messaging
AI AssistantaiCogniGate-backed assistance
Keep drugs privatedrug_keepKeeping the hospital's own drugs off the shared list
More attendants per patientextra_attendantsMore than 2 attendant passes at once for one patient
Emergency Codesemergency_codesCode definitions and activations
Emergency DepartmentemergencyArrivals board, triage colour, handover
Queue ManagementqueueToken issue, live queue, waiting-hall screens
TelehealthtelehealthTele-visit encounters
Chronos RotachronosRooms, busy hours and room holds kept in Chronos
Forms and ConsentsformsForm templates, consents, charts on the patient file
InsuranceinsurancePayers, insurance cover, cashless pre-authorisation
Operation theatretheatreTheatres, surgical cases, safety checklist, times
Bio-medical wastebiowasteWaste register, accidents and Form IV totals
General stockinventoryStorerooms, 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.

GET /api/v1/admin/export.ndjson

pnpm run tenant:import file.ndjson --db ./restored.db

Hospital in a
running deployment

one NDJSON file
manifest · rows · files · trailer

a database holding
that hospital and nobody else

  • 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.

StatusItems
✅ Built26
🔶 Enhance — exists, needs commercial depth21
🆕 New — not yet started58
Total105

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

LayerTechnology
RuntimeNode.js 24
APIHono · jose (JWT) · Argon2id · zod
DatabaseSQLite via built-in node:sqlite, WAL mode
FrontendReact 18 · Vite · local workspace packages
Toolingpnpm workspaces · Jest · ESLint · Prettier
OpsDocker 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_events with 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_SECRET and 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.

Local Storage Notice

This site uses local storage to cache GitHub data for better performance, and an anonymous visit counter. No personal data is stored or shared.