Work / Healthcare
Designing a HIPAA-compliant infrastructure for a startup in the mental health industry
A HIPAA-compliant, multi-tenant architecture on AWS for a mental health startup: isolated ePHI, full audit logging, and a clear roadmap to implementation.

Audit-ready. Multi-tenant ePHI architecture, HIPAA-compliant by design, on AWS.
The Challenge
A mental health startup needed to design a highly secure and HIPAA-compliant infrastructure for their multi-tenant healthcare application.
The challenge for Quarry was to create an architecture that would:
- Ensure HIPAA compliance
- Provide robust security measures
- Support multiple user types (two clinician roles and patients)
- Allow for future scalability
- Minimize legal exposure and mitigate risk
The Solution
Quarry designed a comprehensive HIPAA-compliant architecture leveraging AWS services.
Production
Headless CMS
Content management
A headless CMS manages the marketing site’s content, in production and staging.
On the pathsMarketing content · Staging content
Production › Marketing VPC
Marketing site
EC2
The marketing site runs in its own VPC, outside the ePHI boundary, with flow logs like every VPC.
On the pathMarketing content
Production › ePHI boundary
Clinicians
Two clinician roles
The application serves two clinician roles. It is multi-tenant, and each group’s data is kept separate and secure.
On the pathClinician sessions
Production › ePHI boundary
Patients
App users
Patients use the same multi-tenant application, their data kept separate from the clinicians’.
On the pathPatient sessions
Production › ePHI boundary › Application VPC › Availability zone 1
Application server
EC2 · zone 1
The main application, run in two availability zones inside the production application VPC, where ePHI is isolated to specific services.
On the pathClinician sessions
Production › ePHI boundary › Application VPC › Availability zone 2
Application server
EC2 · zone 2
The application’s second availability zone. It also sends notifications and publishes de-identified case data to the Facebook app.
On the pathsPatient sessions · Notifications · De-identified case data
Production › ePHI boundary › Application VPC › Availability zone 1
Database
RDS primary
The application database, in a private subnet, replicated to a read replica in the second availability zone.
On the pathsClinician sessions · Replication
Production › ePHI boundary › Application VPC › Availability zone 2
Read replica
RDS
A read replica of the application database, in the second availability zone.
On the pathsPatient sessions · Replication
Production › ePHI boundary › HIPAA-eligible services
SMS and email
Twilio, SendGrid
Twilio sends SMS and SendGrid sends email for the application.
On the pathNotifications
Production › ePHI boundary › Logging
VPC flow logs
On every VPC
Flow logs run on every VPC, recording network activity for a detailed record of everything that happens.
On the pathAudit logging
Production › ePHI boundary › Logging
CloudWatch
Logs and monitoring
Collects the logs that establish a chain of custody for all data, so any issue can be traced to exactly what happened and when, with proactive notice of unexpected access to ePHI.
On the pathsAudit logging · Access alerts
Production › ePHI boundary › Logging
CloudTrail
System access log
A log of all system access: a vital HIPAA requirement.
On the pathAccess trail
Production › ePHI boundary › Logging
S3
Storage and backups
Data storage and backups use S3 buckets, the logs included.
On the pathsAudit logging · Access trail
Production › ePHI boundary › Access control
IAM
Access control
Only authorized users can reach specific parts of the system, meeting HIPAA’s minimum-necessary access requirement.
On the path
Production › ePHI boundary › Access control
SNS alerts
Unexpected access
SNS-driven alerts on unexpected access to ePHI.
On the pathAccess alerts
Production › Facebook app VPC › Availability zone 1
Facebook app
EC2
Publishes anonymized, de-identified case data to professional groups. It runs in its own VPC, outside the ePHI boundary.
On the pathsDe-identified case data · Facebook app data
Production › Facebook app VPC › Availability zone 1
App database
RDS
The Facebook app’s own database.
On the pathFacebook app data
Production
Professional groups
Professional groups on Facebook receive the de-identified case data.
On the pathsDe-identified case data · Staging publishing
Staging › Marketing VPC
Marketing site
EC2 · staging
The staging environment mirrors production, so changes are tested thoroughly before they go live.
On the pathStaging content
Staging › Application VPC › Availability zone 1
Application server
EC2 · staging
The staging environment mirrors production, so changes are tested thoroughly before they go live.
On the pathStaging application
Staging › Application VPC › Availability zone 1
Database
RDS · staging
The staging environment mirrors production, so changes are tested thoroughly before they go live.
On the pathStaging application
Staging › Facebook app VPC › Availability zone 1
Facebook app
EC2 · staging
The staging environment mirrors production, so changes are tested thoroughly before they go live.
On the pathsStaging Facebook app · Staging publishing
Staging › Facebook app VPC › Availability zone 1
App database
RDS · staging
The staging environment mirrors production, so changes are tested thoroughly before they go live.
On the pathStaging Facebook app
Read the diagram as text
- Clinician sessions
- Clinicians: Two clinician roles
- Application server: EC2 · zone 1
- Database: RDS primary
- Patient sessions
- Patients: App users
- Application server: EC2 · zone 2
- Read replica: RDS
- Replication
- Database: RDS primary
- Read replica: RDS
- Notifications
- Application server: EC2 · zone 2
- SMS and email: Twilio, SendGrid
- De-identified case data
- Application server: EC2 · zone 2
- Facebook app: EC2
- Facebook: Professional groups
- Facebook app data
- Facebook app: EC2
- App database: RDS
- Marketing content
- Headless CMS: Content management
- Marketing site: EC2
- Audit logging
- VPC flow logs: On every VPC
- CloudWatch: Logs and monitoring
- S3: Storage and backups
- Access trail
- CloudTrail: System access log
- S3: Storage and backups
- Access alerts
- CloudWatch: Logs and monitoring
- SNS alerts: Unexpected access
- Staging application
- Application server: EC2 · staging
- Database: RDS · staging
- Staging Facebook app
- Facebook app: EC2 · staging
- App database: RDS · staging
- Staging publishing
- Facebook app: EC2 · staging
- Facebook: Professional groups
- Staging content
- Headless CMS: Content management
- Marketing site: EC2 · staging
Boundaries
- ePHI boundary: Clinicians, Patients
- Marketing VPC: Marketing site
- Marketing VPC: Marketing site
- ePHI boundary › HIPAA-eligible services: SMS and email
- ePHI boundary › Logging: VPC flow logs, CloudWatch, CloudTrail, S3
- ePHI boundary › Access control: IAM, SNS alerts
- Facebook app VPC › Availability zone 1: Facebook app, App database
- Application VPC › Availability zone 1: Application server, Database
- Facebook app VPC › Availability zone 1: Facebook app, App database
- ePHI boundary › Application VPC › Availability zone 1: Application server, Database
- ePHI boundary › Application VPC › Availability zone 2: Application server, Read replica
We began with virtual private clouds, essentially isolated environments for each part of the system. This separation adds a strong layer of security, keeping user ePHI isolated to only production environments and further isolated to specific services within production to mitigate the risk of leakage.
Logging is a crucial part of this setup. We implemented CloudWatch and CloudTrail, with flow logs on every VPC. This gives us a detailed record of all activity that establishes a chain of custody for all data as well as a log of all system access. These are vital requirements for HIPAA compliance. If there’s ever an issue, we can trace exactly what happened and when, plus be proactively notified in the event of unexpected access to ePHI.
Data storage and backups use S3 buckets. Access control is managed through IAM, with SNS-driven alerts on unexpected access to ePHI, ensuring only authorized users can reach specific parts of the system and meeting HIPAA’s minimum-necessary access requirement.
The main application is designed to handle three types of users: two clinician roles and patients. It’s a multi-tenant setup, but each group’s data is kept separate and secure.
We’ve integrated some essential services too. There’s a headless CMS for content management, Twilio for SMS, and SendGrid for emails. We also developed a Facebook app that publishes anonymized, de-identified case data to professional groups.
Finally, we created a separate staging environment that mirrors the production setup. This allows for thorough testing before any changes go live.
The Results
While the full implementation is pending future funding, the infrastructure design itself has been a significant deliverable, offering the startup:
- A clear roadmap for HIPAA-compliant infrastructure
- Significantly reduced legal exposure and risk
- A scalable architecture supporting future growth
- Enhanced data security and privacy for all user types
- Comprehensive audit capabilities for potential breach investigations
- A foundation for building trust with healthcare providers and patients
The design’s focus on isolating services, maintaining detailed logs, and implementing multi-layered security measures positions the startup to confidently expand its services while maintaining strict HIPAA compliance.
Have a problem worth this kind of attention?
Start a projectMore work
ENGINEERINGDATA100% uptime since launch
Serving a AAA game reveal with 100% uptime on AWS
Confidential
STRATEGYENGINEERINGDATA40× member growth
Growing a travel membership from 6,000 to 250,000+ members
Harvest Hosts
ENGINEERINGDATASTRATEGYUnified.
From siloed tools to a single source of truth: a data platform and self-serve BI for a pharmacy group
Confidential