Platform Architecture

HIPAA-ready architecture built for mental health practices

Technology Stack

Frontend

  • Next.js 16 (React framework)
  • Tailwind CSS 4 (styling)
  • MDX (interactive lessons)

Backend

  • PostgreSQL (primary database)
  • Redis (caching + sessions)
  • Drizzle ORM

AI/ML

  • DistilBERT (distress classifier)
  • FastAPI (ML service)
  • Claude API (AI coach)

System Architecture

Client Layer
Next.js 16 • React • Tailwind CSS • MDX Interactive Components
API Layer
Next.js API Routes • Lucia Auth • Audit Logging • Rate Limiting
AI Services
DistilBERT Classifier • Claude API Coach • RAG Pipeline
Data Services
PostgreSQL • Redis • Drizzle ORM • Migrations
External Services
Polar Payments • Email • SMS • Analytics
Infrastructure Layer
Dokploy Hosting • HIPAA-Ready Cloud • Encrypted Storage • Automated Backups

HIPAA-Ready Architecture

The platform is built to HIPAA standards. For workloads involving real PHI, each practice runs on a dedicated instance with a signed BAA; the shared education instance is designed for de-identified use.

Security Measures

  • End-to-end encryption for patient data
  • Encrypted database storage (AES-256)
  • Secure session management (Lucia auth)
  • NPI verification for provider authentication
  • Role-based access control (RBAC)
  • Audit logging for all PHI access

Privacy Controls

  • Patient consent tracking and management
  • Data retention policies (configurable)
  • Secure data deletion workflows
  • PHI access logs and monitoring
  • Provider-patient data segregation
  • Incident response protocols

AI/ML Systems

MAIA Distress Classifier

Real-time classification of supported reflections, check-ins, coach messages, and forum submissions to identify possible distress.

Model
DistilBERT (distilled BERT)
Deployment
FastAPI service on Dokploy
Response Time
<500ms average

AI Wellness Coach (Claude)

Context-aware therapeutic guidance using RAG (Retrieval-Augmented Generation) with course content and patient progress.

Model
Claude (Anthropic)
Context
Patient progress + course content
Safety
Built-in crisis protocols

Data Flow & Processing

1

Patient Interaction

Patient completes lesson, quiz, journal entry, or uses AI coach

2

Data Capture & Storage

Encrypted data stored in PostgreSQL with audit logging

3

AI Analysis (if applicable)

Distress classifier analyzes text for safety concerns

4

Provider Notification

Mild or crisis-level results enter the secure queue and immediately email every active linked provider

5

Analytics Aggregation

De-identified data aggregated for completion rates, quiz scores, engagement metrics

Questions About the Architecture?

Schedule a technical deep dive with our team

Schedule Technical Demo