Rebuilding a Telemedicine Platform to Serve 1.4M Patients Across 11 States
The Challenge
A mid-sized US health network had built their telemedicine platform four years earlier — a single-tenant Rails monolith backed by a Postgres RDS instance. When COVID accelerated adoption, concurrent consultation volume hit 3× projections. The platform was dropping sessions, breaching HIPAA audit-trail requirements, and costing $420k/month in infrastructure.
The client came to us with a hard constraint: the FHIR R4 and Epic/Cerner EHR integrations could not be disrupted. Any downtime during the migration window would affect active patient consultations.
Our Approach
We ran a 3-week architecture discovery, mapping every external integration, data flow, and compliance boundary before writing a line of code.
Phase 1 — Strangler Fig Migration (weeks 1–8)
We introduced an API gateway layer in front of the Rails monolith, routing 10% of traffic to the new Node.js microservices. This let us validate latency and data integrity in production without risk.
Key services extracted:
- Consultation Orchestrator — manages session lifecycle, video token issuance, and EHR write-back
- FHIR Adapter — translates internal events to FHIR R4 Resources and pushes to Epic/Cerner via HL7 FHIR APIs
- Audit Trail Service — event-sourced Kafka consumer writing immutable compliance logs to S3
Phase 2 — Video Infrastructure (weeks 6–12)
The original platform used a shared Twilio Video deployment with no regional routing. We rebuilt this with:
- Regional Twilio Rooms with participant pinning to the nearest AWS region
- WebRTC fallback to TURN relays when peer-to-peer failed
- Sub-140ms median latency across US regions
Phase 3 — Data Migration & Cutover (weeks 10–14)
We ran dual-write for 3 weeks — writing every consultation record to both the old Postgres monolith and the new event-sourced system. After reconciliation confirmed 100% parity, we cut over with a 4-minute read-only maintenance window.
Tech Stack
| Layer | Technology |
|---|---|
| API Gateway | AWS API Gateway + Lambda authorisers |
| Services | Node.js 20 + TypeScript |
| Messaging | Apache Kafka on MSK |
| Video | Twilio Programmable Video |
| Database | Aurora PostgreSQL (multi-AZ) + Redis |
| EHR Integration | FHIR R4 + Epic on FHIR + Cerner Ignite APIs |
| Compliance | HIPAA BAA, audit logs on S3 Glacier |
| Infrastructure | Terraform + EKS + ArgoCD |
Results
2.1× concurrent consultation capacity at the same infrastructure footprint as before.
−38% monthly infrastructure cost — from $420k to $260k/month. The new event-driven architecture eliminated polling loops that were generating unnecessary EC2 and RDS load.
99.99% uptime SLA maintained across all 11 states for the 9 months post-launch.
< 140ms video latency (P95) across all US regions, down from 380ms with the previous architecture.
Zero HIPAA audit findings in the first compliance review post-launch. The immutable Kafka + S3 audit trail satisfied all requirements with no remediation needed.
What We Learned
The strangler fig pattern worked precisely because we invested three weeks in discovery before migration. Teams that skip discovery on legacy migrations almost always encounter undocumented integrations mid-flight — we found six in the initial audit.
The hardest part was not the technology. It was convincing the client's compliance officer that event sourcing on Kafka satisfied HIPAA immutability requirements better than their existing row-level database triggers. We brought in independent HIPAA counsel to validate the architecture — worth every dollar.