Back to Systems EngineeringEdge-First Clinical Infrastructure

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.

RolePrincipal Healthcare Systems Architect
Timeline2024 — 2025
DomainEnterprise & Healthcare
EnvironmentMulti-Department Clinical Hospital Emergency Wards
Edge Latency (p95)18msGlobal Cloudflare edge response
Admin Bundle127 KBZero-bloat high-density HUD
Triage IngressInstantReal-time D1 queue telemetry
Auth PerimeterZero TrustCryptographic OTP & RBAC
CarePulse system logoCarePulse•Enterprise & Healthcare
Click to inspect
CarePulse: Clinical Operations & Real-Time Emergency Triage Platform Architecture Dashboard
Inspect Full Screen
Multi-Department Clinical Hospital Emergency Wards
Enterprise Confidentiality & Architectural Governance NoticeAll architecture topologies, state invariant proofs, and failure recovery protocols presented in this dossier are sanitized commercial abstractions. Production source code, database credentials, and proprietary business schemas remain strictly confidential and protected under commercial Non-Disclosure Agreements (NDAs).

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.

CarePulse :: ARCHITECTURAL TOPOLOGY
Interactive Data Bus • Click any subsystem to view formal guard invariant
SUBSYSTEM INVARIANT: Distributed TurnstileWorkers KV / D1
Layer: EDGE
Formal Correctness Invariant

Atomic token increment eliminating race conditions

Core Invariants & Non-Negotiable Guarantees

Bundle Budget Cap (<150KB)

The entire administrative console, routing, triage charts, and forms cannot exceed 150KB gzip. Measured in CI on every push; builds fail if bundle creeps.

Cryptographic Patient Verifiability

No patient check-in or clinical record handover can be mutated without an authenticated cryptographic OTP signature logged in the immutable telemetry stream.

Strict Edge Isolation

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

Failure Scenario: Regional ISP cut or hospital local gateway latency spike
Mechanism: Local hospital network experiences packet loss to external internet.
Recovery Protocol: Edge PWA service worker caches core clinical HUD assets, queuing pending triage updates locally until connection re-establishes.
Failure Scenario: Brute-force attack on triage check-in OTP ingress
Mechanism: Automated script attempts PIN iteration against patient appointment IDs.
Recovery Protocol: Edge worker activates sliding IP rate limiter at Cloudflare Anycast perimeter, dropping requests with 429 before touching D1 database.

Technologies & Engineering Standards

Edge Runtime
Cloudflare WorkersV8 IsolatesTypeScript
Data Layer
Cloudflare D1 SQLPrepared SQL StatementsSQLite Engine
Frontend
Next.js 15 (App Router)React 19Tailwind CSS v4Motion
Security & Auth
Cloudflare TurnstileCryptographic OTPStrict RBAC

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.