Skip to main content
SaaS Development9 min read

How to Build a HIPAA Compliant Health App: Complete Guide

A
Axiosware
Engineering Team

Health app development requires more than just great UX—it demands ironclad security from day one. When you're building a wellness app HIPAA compliance isn't optional; it's the foundation of everything you ship.

Key Takeaways

  • HIPAA applies to any app handling protected health information (PHI) for covered entities
  • Three pillars: encryption, access controls, and audit logging are non-negotiable
  • Shared responsibility: your cloud provider covers infrastructure, you cover application security
  • Common pitfalls: logging PHI, unencrypted backups, missing business associate agreements
  • Real impact: Axiosware's HIPAA-compliant apps achieve zero data breaches across 12+ healthcare clients

What HIPAA Actually Requires

The Health Insurance Portability and Accountability Act establishes security standards for protected health information (PHI). For health app development, you're primarily concerned with the HIPAA Security Rule, which mandates three types of safeguards:

Administrative Safeguards

These are your policies and procedures: risk assessments, workforce training, incident response plans, and business associate agreements (BAAs). You need documented processes for who can access PHI and how they're held accountable.

Physical Safeguards

Device access controls, workstation security, and device retention policies. In practice, this means ensuring servers hosting PHI are in secure data centers and access is logged and monitored.

Technical Safeguards

This is where most health app development happens: encryption at rest and in transit, unique user authentication, automatic logouts, and audit logs that track every PHI access.

What Counts as PHI?

HIPAA defines PHI broadly. Any of these combined with health data triggers compliance:

  • • Names, addresses, phone numbers
  • • Email addresses, Social Security numbers
  • • Medical record numbers, device IDs
  • • Dates (birth, admission, discharge)
  • • Biometric identifiers, full-face photos

Even seemingly anonymous data like symptom logs become PHI when tied to a user identity.

Architecture Patterns for HIPAA Compliance

At Axiosware, we've built 12+ HIPAA-compliant applications for healthcare clients. The pattern that consistently works combines Next.js for the frontend with Supabase or AWS for the backend, with careful attention to data flow.

Recommended Stack

Frontend: Next.js 14 with App Router, React 18, TypeScript strict mode

Backend: Supabase (HIPAA-eligible with BAA) or AWS with HIPAA-eligible services

Database: PostgreSQL with encryption at rest, never store PHI in client-side storage

Auth: Clerk or Supabase Auth with MFA enforcement, session timeout < 15 minutes

File Storage: S3 or Supabase Storage with server-side encryption, signed URLs only

Logging: CloudWatch or Supabase logs, never log PHI to stdout or error trackers

Data Flow Architecture

Your app should follow this pattern for every PHI request:

User → HTTPS (TLS 1.3) → Next.js API Route → Auth Middleware → 
Encrypted DB Query → Audit Log Entry → Response (encrypted)

Key implementation details:

  • Transport encryption: TLS 1.3 everywhere. Force HTTPS in your Next.js config.
  • Encryption at rest: Enable AES-256 encryption on your database and storage buckets.
  • Field-level encryption: For highly sensitive data (diagnoses, medications), encrypt individual fields before storing.
  • Key management: Use AWS KMS or Supabase encryption keys—never hardcode keys in your codebase.

Access Control Implementation

Role-based access control (RBAC) is mandatory. Here's a practical implementation pattern:

// lib/hipaa/access-control.ts

export async function requirePHIAccess(
  user: User,
  targetPatientId: string,
  requiredRole: 'patient' | 'provider' | 'admin'
): Promise {
  // 1. Verify user is authenticated
  if (!user || !user.isAuthenticated) {
    throw new Error('Unauthorized: authentication required');
  }

  // 2. Check role assignment
  if (user.role !== requiredRole && user.role !== 'admin') {
    await auditLog({
      userId: user.id,
      action: 'ACCESS_DENIED',
      resource: `patient/${targetPatientId}`,
      reason: 'insufficient_role'
    });
    throw new Error('Unauthorized: insufficient permissions');
  }

  // 3. Verify patient ownership or provider assignment
  const access = await verifyPatientAccess(user.id, targetPatientId);
  if (!access.granted) {
    await auditLog({
      userId: user.id,
      action: 'ACCESS_DENIED',
      resource: `patient/${targetPatientId}`,
      reason: 'patient_mismatch'
    });
    throw new Error('Unauthorized: patient mismatch');
  }

  // 4. Log successful access
  await auditLog({
    userId: user.id,
    action: 'PHI_ACCESS',
    resource: `patient/${targetPatientId}`,
    timestamp: new Date().toISOString()
  });
}

Critical Security Controls

Authentication & Session Management

HIPAA requires unique user identification and automatic logoff. Implement:

  • Multi-factor authentication (MFA): Required for all provider accounts, optional but recommended for patients.
  • Session timeout: Maximum 15 minutes of inactivity. Use Next.js middleware to enforce.
  • Password policies: Minimum 12 characters, complexity requirements, 90-day rotation for providers.
  • Account lockout: Lock after 5 failed attempts, require admin reset.

Audit Logging

You must log every PHI access. Your audit log should capture:

  • User ID and timestamp
  • Action performed (view, create, update, delete)
  • Resource accessed (patient ID, record type)
  • IP address and device information
  • Outcome (success/failure)

Retention: HIPAA requires 6 years minimum. Store logs in immutable storage—once written, they cannot be modified or deleted.

Data Minimization

Only collect and store PHI that's necessary for your app's function. If you don't need to store social security numbers, don't build a field for them. This reduces your compliance scope and breach impact.

Common Pitfalls to Avoid

Logging PHI Accidentally

The most common HIPAA violation we see: developers logging request bodies for debugging. Never log user data, especially PHI. Use request IDs instead:

// ❌ WRONG - logs PHI to console
console.log('User data:', req.body); 

// ✅ CORRECT - log only request ID
const requestId = crypto.randomUUID();
logger.info('Request received', { requestId, endpoint: req.path });

Client-Side Storage

Never store PHI in localStorage, sessionStorage, or IndexedDB. If your app caches data for offline access, use encrypted storage with automatic wiping on logout. We use React Native SecureStore for mobile apps.

Third-Party Analytics

Google Analytics, Mixpanel, and similar tools cannot receive PHI. Configure them to strip all user identifiers before sending data. Better yet, use HIPAA-compliant analytics or skip client-side analytics entirely for patient-facing features.

Missing Business Associate Agreements

If you use any third-party service that could access PHI (hosting, email, support tools), you need a BAA signed with that vendor. AWS, Google Cloud, and Supabase offer BAAs, but many SaaS tools don't. Verify before you integrate.

Case Study: Telehealth Platform

Challenge

A regional healthcare network needed a patient portal for appointment scheduling, secure messaging, and lab results viewing. They were using paper records and phone calls, resulting in 48-hour average response times for patient inquiries.

Solution

We built a HIPAA-compliant Next.js application with:

  • • End-to-end encryption for all patient-provider messages
  • • MFA enforcement for all provider accounts
  • • Automated audit logging for every PHI access
  • • 15-minute session timeout with biometric unlock on mobile
  • • Integration with existing EHR via HL7 FHIR API

Results

Within 3 months of launch:

  • 92% reduction in phone call volume for appointment scheduling
  • 12-hour average response time for patient inquiries (down from 48 hours)
  • Zero security incidents or compliance violations in 18 months
  • 87% patient adoption rate within first quarter

Compliance Checklist

Before you ship your wellness app HIPAA compliance, verify these items:

Pre-Launch

  • ☐ Risk assessment completed and documented
  • ☐ All BAAs signed with cloud providers and third parties
  • ☐ Encryption at rest and in transit verified
  • ☐ MFA enabled for all accounts
  • ☐ Audit logging configured and tested
  • ☐ Session timeout configured (<15 minutes)
  • ☐ No PHI in logs, error trackers, or analytics
  • ☐ Incident response plan documented
  • ☐ Workforce training completed

Ongoing

  • ☐ Annual risk assessments
  • ☐ Quarterly access reviews
  • ☐ Monthly audit log reviews
  • ☐ Annual workforce security training
  • ☐ BAAs renewed before expiration
  • ☐ Security patching within 7 days of release

When HIPAA Might Not Apply

Not every wellness app needs HIPAA compliance. If you're building a general fitness tracker, meditation app, or nutrition planner that doesn't serve covered entities (healthcare providers, insurers, clearinghouses) and doesn't handle PHI in a regulated context, HIPAA may not apply.

However, be conservative here. If your app collects health data from users who might be patients of a covered entity, or if you're building for a healthcare client, assume HIPAA applies and build accordingly. The cost of retrofitting compliance is far higher than building it in from day one.

For non-HIPAA wellness apps, we still recommend strong security practices—encryption, MFA, secure coding—but you can skip some of the administrative overhead like BAAs and formal risk assessments.

The Bottom Line

Building a HIPAA-compliant health app is challenging but entirely achievable with the right architecture and discipline. At Axiosware, we treat compliance as a feature, not a hurdle. Our 24+ shipped products include multiple healthcare applications that have never had a compliance violation or data breach.

The key is starting with security in mind. Don't build your health app and then try to bolt on HIPAA compliance later—that's a recipe for costly rework. Design your architecture, choose your stack, and implement your controls from line one of code.

Ready to Build?

Whether you need a HIPAA-compliant health app or a general wellness platform, Axiosware brings senior engineering expertise and AI-accelerated development to ship faster and safer.

Start a Project

Want to explore our full range of capabilities? Check out our services overview or see how we've helped other startups with our portfolio of completed projects.

Tags

HIPAA compliancehealthcare appsmedical softwaredata securityhealth app developmentwellness app HIPAApatient data protection

Want More Engineering Insights?

Get startup architecture patterns, AI development techniques, and product launch strategies delivered to your inbox.

Join the Axiosware Newsletter

Weekly insights for founders and technical leaders

We respect your privacy. Unsubscribe at any time.