๐๏ธ System Architecture Overview
Migraine Tracker is built on a modern, decoupled architecture designed for speed, security, and scalability. Because we handle highly sensitive health data, our system is strictly segmented to ensure encryption boundaries and data isolation.
Here is a high-level look at how all the pieces of the Migraine Tracker ecosystem talk to each other.
๐บ๏ธ The Ecosystem Map
โโโโโโโโโโโโโโโโโโโ OAuth / JWT โโโโโโโโโโโโโโโโโโโโ
โ โ โโโโโโโโโโโโโโโโโโโโโโ> โ โ
โ React UI App โ โ Supabase Auth โ
โ (Vite + TS) โ <โโโโโโโโโโโโโโโโโโโโโโ โ (Identity) โ
โ โ Token โโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโฌโโโโโโโโโโ
โ
โ Bearer Token (HTTPS)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NESTJS MONOLITH โ
โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ User / Auth โ โ Incident API โ โ Health Logs API โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโฌโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โโโโโโโโโผโโโโโโโโ โ
โ โ Pattern Guard โ (Predictive Engine) โ
โ โโโโโโโโโฌโโโโโโโโ โ
โโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโ
โ โ โ
โ AES-256 โ HTTPS โ Mongoose
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
โ โ โ โ โ โ
โ Cloudflare Edge โ โ External APIs โ โ MongoDB Vault โ
โ (Key Rotation) โ โ (NOAA, Meteo...) โ โ (Data Storage) โ
โ โ โ โ โ โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโ
๐งฉ The Core Components
- The Frontend (React + Vite)
The user-facing dashboard where tracking happens. It is built as a Single Page Application (SPA) using React 18, Vite, and Tailwind CSS. It communicates directly with Supabase for authentication, and passes the resulting JWT to our NestJS backend for authorized data fetching.
- Identity Provider (Supabase)
We offload password management and OAuth (Google/GitHub) completely to Supabase. This means our core database never stores user passwords.
- The Backend Monolith (NestJS)
The brain of the operation. This Node.js/TypeScript server handles all business logic, data validation, and houses the Pattern Guardianโour proprietary engine that cross-references user health logs with environmental data to predict pain triggers.
- External Environmental APIs
To feed the Pattern Guardian, the NestJS backend asynchronously pulls localized weather and solar data from APIs like Open-Meteo, NOAA, GFZ, and TEMIS.
- Encryption Edge Worker (Cloudflare)
To keep health data ultra-secure, specific payloads are encrypted at the application layer before saving to the database. The symmetric keys required for this encryption are generated and rotated daily by an isolated Cloudflare Worker running at the edge.
- The Database (MongoDB)
A NoSQL document store that holds the encrypted health logs, incident histories, user configurations, and the predictive rules generated by the Pattern Guardian.