CPAE Clinic — Healthcare Ecosystem & AI

Imagem personagem

Technologies

TypeScript 75% SCSS 15% PLpgSQL 10%

Topics

saas ehr nestjs nextjs expo rbac minio redis postgresql

An enterprise healthcare ecosystem engineered end-to-end solo as lead specialist, unifying clinic operations, Electronic Health Records (EHR), an institutional public portal, and clinical blog (cpae-zen-hub) within a monorepo architecture. Architected the migration from monolithic controllers to decoupled microservices and integrated self-hosted local AI inference on VPS utilizing Google Gemma and Qwen for clinical assistance without exposing sensitive medical data. The infrastructure combines NestJS, Next.js, Expo/React Native, strict multi-tenant PostgreSQL isolation, granular RBAC, S3-compatible MinIO storage, and Redis/Bull asynchronous workers.

Technical Highlights

Multi-Tenant SaaS

Logical patient data isolation between multiple client clinics in PostgreSQL using AsyncLocalStorage in the HTTP cycle and native Row-Level Security (RLS) via Prisma ORM.

PII Sanitization

Privacy filter based on regular expressions (Regex) to detect and redact patient CPFs, phone numbers, and names from medical charts before sending to external AI APIs.

Billing & Insurances

Complex transactional engine validating Health Guide quotes before batch scheduling, combined with dynamic AI token budget control to prevent billing overruns.

Infrastructure & Queues

Microservices isolated in Docker containers, Redis (Bull Queue) for background job processing, MinIO for S3 storage, and integrated Playwright testing.

Production codebase is confidential. Public architecture study available above.