CarePulse: Clinical Operations & Real-Time Emergency Triage Platform
Designing a sub-20ms hospital operations console on Cloudflare Workers and D1 SQL, featuring cryptographic OTP triage verification, role-based access control, and a 127KB bundle budget.

Executive Architecture Summary
CarePulse is a modern, high-reliability clinical operations platform engineered to replace bloated legacy EHR systems in hospital emergency departments. Built on Cloudflare Workers edge compute and distributed Cloudflare D1 SQL, CarePulse guarantees instant ward triage updates, sub-second patient admission records, and tamper-resistant prescription audit trails even under high concurrent ward loads.
The Problem Space & Inherent Failure Modes
Traditional hospital management software (HMS/EHR) suffers from debilitating performance rot: 15MB JavaScript bundles that take 8 seconds to load on ward nursing tablets, heavy database connection pools that crash during regional emergency surges, and unverified paper check-ins that lead to misassigned clinical priority.
Global Edge Clinical Topology
Distributed Cloudflare Workers compute co-located with D1 SQL edge replication.
Atomic token increment eliminating race conditions
Core Invariants & Non-Negotiable Guarantees
The entire administrative console, routing, triage charts, and forms cannot exceed 150KB gzip. Measured in CI on every push; builds fail if bundle creeps.
No patient check-in or clinical record handover can be mutated without an authenticated cryptographic OTP signature logged in the immutable telemetry stream.
No persistent node servers or centralized cold containers. Every request executes in an isolated V8 isolate starting in <5ms.
Subsystems Architecture & Implementation Decisions
1. Dynamic Ward Triage Priority Queue
Engineered an algorithmic triage score engine (ESI Levels 1-5) evaluating vitals, chief complaints, and waiting duration directly in edge memory, automatically elevating deteriorating patients in real time.
Key Architectural Decisions:
- •Implemented server-sent edge events for instantaneous HUD refresh across all nursing stations.
- •Designed high-contrast, low-cognitive-load UI suitable for 24/7 emergency room lighting conditions.
2. Cloudflare D1 SQL Schema & Append-Only Medical Telemetry
Utilized Cloudflare D1 SQLite at the edge with prepared queries for sub-20ms reads and sequential writes. Ward occupancy, doctor assignments, and triage status are modeled with strict foreign keys and check constraints.
Key Architectural Decisions:
- •Eliminated heavyweight ORM overhead in favor of ultra-lean typed SQL prepared statements.
- •Separated patient medical records into isolated tenant schemas to enforce HIPAA privacy barriers.
3. Cryptographic OTP Verification Flow
Designed a lightweight OTP verification pipeline dispatched via transactional email and SMS gateways, securing access to lab diagnostics and billing histories without burdensome hospital password rotations.
Key Architectural Decisions:
- •Enforced 10-minute sliding validity with automatic rate-limit throttling (max 3 attempts per IP/minute).
- •Encrypted OTP tokens using SHA-256 with an edge-rotated pepper secret.
Failure Modes & Edge Case Recovery Protocols
Technologies & Engineering Standards
Verified Production Outcomes
- Sub-20ms edge synchronization latency across 35,000+ patient triage check-ins.
- Reduced outpatient clinic intake paperwork from 14 minutes to 90 seconds.
- Designed for continuous operation with zero scheduled server maintenance windows using Cloudflare Workers & D1 edge architecture.
Interested in Similar Architectural Rigor?
Whether architecting distributed edge platforms, local-first data persistence, or high-correctness compliance software, discuss your system architecture directly with Harvinder Singh.