Overview
Clair Companion is the app that pairs with Clair Health's wristband. The band records sensor data through the day and night and stores it on the band; the app syncs it over Bluetooth, and the platform turns it into cycle-phase, sleep and hormone insights that come back to the app.
Clair Health is a US company. I work remotely from Jaipur and joined as the founding engineer, the first engineer they hired. I started the backend from an empty repository, designed and built the infrastructure it runs on in Azure, and still own both. I also work on the mobile app and look after DevOps, but most of my time goes to backend and infrastructure.
This is company work, so the write-up stays at the level of architecture and decisions. No proprietary code, data or internal names.
Highlights
- 01Founding engineer: started the backend and infrastructure from scratch
- 02Bluetooth sync from the wristband into a React Native app
- 03Direct, chunked uploads of raw sensor data to Azure Blob
- 04Async decode pipeline with Python services and autoscaled workers
- 05GitOps deploys to staging and production on Azure Kubernetes
- 06Self-hosted observability, alerting and on-call
How data moves
- The band records and stores. Sensors write to storage on the band, so nothing is lost while the phone is away.
- The app syncs over Bluetooth. When the phone is nearby, the app pulls the new data off the band.
- Uploads go straight to storage. The app asks the API for a short-lived signed URL and uploads the raw files in chunks directly to Azure Blob Storage. Large uploads never pass through the API.
- Decoding happens off the request path. The API records the upload and queues a job. Workers and Python services decode the raw files, compute night-level biomarkers and stream signals, and write the results to PostgreSQL and ClickHouse.
- Insights come back. The hormone forecaster and the API combine those signals into the cycle, sleep and hormone views the app shows.
Architecture

Everything server-side runs on Azure Kubernetes Service, in separate staging and production environments. A GitHub Actions build pushes an image, updates the GitOps repository, and ArgoCD syncs the cluster from it. The same pipeline promotes a change from staging to production.
What I built
The backend, from an empty repo
- A NestJS API with Prisma and PostgreSQL: authentication (email, Google and Apple sign-in, password and email-change flows), users and profiles, device pairing, uploads, health logging, cycle and hormone data, and the insights the app shows.
- Redis and BullMQ for background jobs, caching and rate limits, with separate queue groups so heavy decode work never starves user-facing jobs.
- ClickHouse for high-volume sensor time series that would be slow and expensive in Postgres.
The infrastructure on Azure
- The first Dockerfile, Kubernetes manifests, TLS ingress and CI/CD pipeline, then the move to a dedicated GitOps repository where each environment is a folder.
- Secrets come from HashiCorp Vault into the pods, and pods restart automatically when a secret changes. Nothing sensitive lives in env files or images.
- KEDA scales the decode, signal and hormone workers on queue depth, including an overnight worker for the nightly hormone runs.
- Redis moved to a self-hosted, highly available setup with automatic failover.
- Azure alerts are managed in Terraform, applied from GitHub Actions through OIDC, so no cloud credentials are stored in CI.
The data pipeline
- Signed-URL uploads to Azure Blob Storage: the app appends raw data to the same file in chunks, and stale partial files are detected and reset.
- An async decode queue, then a separate Python (FastAPI) decoder service that streams large files from Blob instead of loading them into memory.
- Python services for night-level biomarkers, streaming signals and hormone forecasting, wired into the same queues and deploy pipeline.
The Companion app
- React Native (Expo) features, mostly the Bluetooth sync that pulls stored data off the band, plus sign-in, profile, health logging, cycle and hormone screens, backups and data export.
Observability and on-call
- Prometheus, Grafana and Loki for metrics, dashboards and logs, including device logs shipped from the app, plus Sentry for errors in the app and the backend. Alerts go to Slack through Alertmanager.
- I'm on call for the platform. Two incidents I wrote up: moving decoding off the request path and extracting the Python decoder into its own service.
Engineering decisions
- Large uploads bypass the API. Raw band files can be tens of megabytes. Sending them straight to Blob with signed URLs keeps API pods small and fast, and appending in chunks means a dropped connection only loses the last chunk.
- Heavy work is always a job. Decoding inline caused 502s under load. Now the API responds immediately and workers do the work, scaling on queue depth.
- Git is the source of truth for the cluster. Every change to production is a reviewed commit that ArgoCD applies, so rollbacks are a revert and the cluster never drifts from what's in the repo.
- Secrets are never copied around. Vault is the only place a secret lives; the cluster reads it at runtime.
- Monitoring is built in, not bought per seat. A self-hosted stack (and Clair Watch, below) covers metrics, logs, uptime and errors for a small team at a fraction of the cost.
Around the app
I also built the internal tools that keep the platform running:
- Device Dashboard: a Next.js app for the ops team showing fleet health, firmware versions and where every band's data is in the upload and decode pipeline.
- Clair Study: the Expo app and NestJS API for Clair's perimenopause pilot study (screening, consent, baseline and follow-up check-ins).
- Clair Watch: self-hosted uptime checks, heartbeats, error tracking and incident alerts for every service.
Stack
| Layer | Technologies |
|---|---|
| Frontend | React Native, Expo, TypeScript, Bluetooth (BLE), Next.js |
| Backend | NestJS, Prisma, PostgreSQL, Redis, BullMQ, ClickHouse, Python, FastAPI |
| Infrastructure | Azure Kubernetes (AKS), ArgoCD, HashiCorp Vault, KEDA, Terraform, GitHub Actions, Prometheus, Grafana, Loki, Sentry, Azure Blob Storage |