The Challenge
Our client, a healthtech startup, needed to scale their clinic management platform from 5 pilot clinics to 50+ across three states. The platform manages patient records, appointment scheduling, billing, and clinical workflows. Every feature must comply with HIPAA privacy and security rules.
The existing system was a monolith built for the pilot phase. It worked for 5 clinics but couldn't handle the load, multi-tenancy requirements, or compliance needs of a larger deployment.
HIPAA-First Architecture
We designed every architectural decision through the lens of HIPAA compliance:
- PHI isolation: All Protected Health Information stored in dedicated, encrypted databases with audit logging
- Minimum necessary access: Role-based access control with clinical context awareness — a receptionist sees scheduling, not clinical notes
- Audit trail: Every access to PHI is logged with who, what, when, and why — immutable and tamper-evident
- BAA management: Third-party service selection based on BAA (Business Associate Agreement) availability
- Encryption everywhere: AES-256 at rest, TLS 1.3 in transit, field-level encryption for sensitive identifiers
Data Model Design
Healthcare data modeling requires careful consideration:
- FHIR-based resources: Modeled core entities (Patient, Encounter, Observation, Appointment) using FHIR R4 standards
- Temporal data: Full history of changes for every record (not just current state) — critical for clinical data
- Multi-tenant isolation: Schema-per-clinic approach with shared infrastructure
- Consent management: Granular patient consent tracking — who can see what, with revocation capability
- Document management: Secure attachment storage with virus scanning, format validation, and access control
Healthcare Interoperability
Integrating with the healthcare ecosystem is uniquely challenging:
- HL7 FHIR APIs: Built RESTful APIs conforming to FHIR R4 for data exchange with other systems
- Lab integrations: Bidirectional interfaces with major lab networks for order entry and results delivery
- Insurance verification: Real-time eligibility checks against major payers
- Prescription management: e-Prescribing integration via Surescripts network
- Billing interfaces: Claims submission and remittance processing via clearinghouses
Each integration required its own compliance review, BAA, and data mapping exercise.
Scaling to 50+ Clinics
The scaling strategy addressed both technical and operational challenges:
- Database per region: Geographic data residency requirements meant separate database clusters per state
- CDN for static assets: Clinical form templates, educational materials, and UI assets served from edge locations
- Queue-based processing: Appointment reminders, billing batch processing, and report generation moved to async queues
- Monitoring & alerting: Custom health checks for each clinic's data pipeline, with escalation to on-call engineers
- Blue-green deployments: Zero-downtime deployments during clinic operating hours
We maintained sub-200ms API response times across all clinics even at 10x the original traffic.
Lessons Learned
- Start with compliance, not features: Building HIPAA compliance into the architecture from day one is 10x cheaper than retrofitting
- Healthcare workflows are complex: Spend time shadowing clinicians before writing code. Their workflows are more nuanced than you think
- Interoperability is the hard part: FHIR standards help but every EHR vendor implements them differently
- Downtime has patient impact: A 5-minute outage during clinic hours means patients not getting care. Availability requirements are non-negotiable
- Audit everything: When (not if) you face a compliance audit, comprehensive logs are your best defense
- Build for the 80%: Healthcare has infinite edge cases. Build for common workflows and have a manual fallback for the rest
Written by
Anya Sharma
Principal Engineer
Part of the Fixl engineering team, sharing insights from building production-grade software for startups and enterprises.