# betolix/blix-health-tracker architecture

> Architecture diagram of the GitHub repository betolix/blix-health-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/betolix/blix-health-tracker
- Repository: https://github.com/betolix/blix-health-tracker

## Overview

Blix is a health-tracking dashboard with an MCP interface for authenticated health-data access. The user-facing workflow displays and edits food, weight, blood-pressure, and target data; the React app reads and writes Amplify models, while the documented v2 also describes browser-local persistence and preloaded history. Separately, MCP requests pass through OAuth scope and identity checks before tool dispatch to health-data readers or writers. The excerpts show the schema, client calls, and key dispatches; some runtime wiring and dashboard details are unsampled.

Main entry points: [`amplify/functions/blix-mcp/identity-probe-server.ts`](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/identity-probe-server.ts) (Health tool server), [`amplify/functions/blix-mcp/cognito-owner.ts`](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/cognito-owner.ts) (Owner resolution), [`amplify/functions/blix-mcp/identity-probe-handler.ts`](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/identity-probe-handler.ts) (MCP request handler), [`src/main.tsx`](https://github.com/betolix/blix-health-tracker/blob/main/src/main.tsx) (Health dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Health dashboard<br/>[main.tsx]"]
  node_authui["Sign-in UI<br/>[main.tsx]"]
end

subgraph group_data["Health Data"]
  node_models["Health models<br/>[resource.ts]"]
  node_cloudstore[("Amplify data store<br/>[backend.ts]")]
  node_foodread["Food entry reads"]
  node_foodwrite["Food entry writes"]
  node_vitalread["Vital reads<br/>[vital-reader.ts]"]
  node_vitalwrite["Vital writes<br/>[vital-writer.ts]"]
  node_targetread["Target reads"]
  node_targetwrite["Target writes"]
end

subgraph group_mcp["MCP Access"]
  node_requesthandler["MCP request handler"]
  node_toolserver["Health tool server"]
end

subgraph group_identity["Identity"]
  node_scope["OAuth scopes<br/>[oauth-scope.ts]"]
  node_tokenverify["Auth0 token checks<br/>[auth0-probe.ts]"]
  node_owner["Owner resolution<br/>[cognito-owner.ts]"]
end

node_user(("Dashboard user"))
node_mcpclient(("MCP client"))

node_user -->|"signs in"| node_authui
node_authui -->|"renders"| node_app
node_user -->|"tracks health"| node_app
node_app -->|"uses schema"| node_models
node_app -->|"reads and writes"| node_cloudstore
node_models -->|"defines models"| node_cloudstore
node_mcpclient -.->|"sends requests"| node_requesthandler
node_requesthandler -->|"verifies tokens"| node_tokenverify
node_requesthandler -->|"checks scopes"| node_scope
node_requesthandler -->|"dispatches tools"| node_toolserver
node_toolserver -->|"reads entries"| node_foodread
node_toolserver -->|"writes entries"| node_foodwrite
node_toolserver -->|"reads vitals"| node_vitalread
node_toolserver -->|"writes vitals"| node_vitalwrite
node_toolserver -->|"reads targets"| node_targetread
node_toolserver -->|"writes targets"| node_targetwrite
node_foodread -->|"resolves owner"| node_owner
node_foodwrite -->|"resolves owner"| node_owner
node_vitalread -->|"resolves owner"| node_owner
node_vitalwrite -->|"resolves owner"| node_owner
node_targetread -->|"resolves owner"| node_owner
node_targetwrite -->|"resolves owner"| node_owner

click node_app "https://github.com/betolix/blix-health-tracker/blob/main/src/main.tsx"
click node_authui "https://github.com/betolix/blix-health-tracker/blob/main/src/main.tsx"
click node_models "https://github.com/betolix/blix-health-tracker/blob/main/amplify/data/resource.ts"
click node_cloudstore "https://github.com/betolix/blix-health-tracker/blob/main/amplify/backend.ts"
click node_requesthandler "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/identity-probe-handler.ts"
click node_toolserver "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/identity-probe-server.ts"
click node_scope "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/oauth-scope.ts"
click node_tokenverify "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/auth0-probe.ts"
click node_owner "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/cognito-owner.ts"
click node_foodread "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/food-entry-reader.ts"
click node_foodwrite "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/food-entry-writer.ts"
click node_vitalread "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/vital-reader.ts"
click node_vitalwrite "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/vital-writer.ts"
click node_targetread "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/daily-target-reader.ts"
click node_targetwrite "https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/daily-target-writer.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_authui,node_user,node_mcpclient toneBlue
class node_models,node_cloudstore,node_foodread,node_foodwrite,node_vitalread,node_vitalwrite,node_targetread,node_targetwrite toneAmber
class node_requesthandler,node_toolserver toneMint
class node_scope,node_tokenverify,node_owner toneRose
```

## Components

### Dashboard

- [Health dashboard](https://github.com/betolix/blix-health-tracker/blob/main/src/main.tsx): `src/main.tsx`
- [Sign-in UI](https://github.com/betolix/blix-health-tracker/blob/main/src/main.tsx): `src/main.tsx`

### Health Data

- [Health models](https://github.com/betolix/blix-health-tracker/blob/main/amplify/data/resource.ts): `amplify/data/resource.ts`
- [Amplify data store](https://github.com/betolix/blix-health-tracker/blob/main/amplify/backend.ts): `amplify/backend.ts`
- [Food entry reads](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/food-entry-reader.ts): `amplify/functions/blix-mcp/food-entry-reader.ts`
- [Food entry writes](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/food-entry-writer.ts): `amplify/functions/blix-mcp/food-entry-writer.ts`
- [Vital reads](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/vital-reader.ts): `amplify/functions/blix-mcp/vital-reader.ts`
- [Vital writes](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/vital-writer.ts): `amplify/functions/blix-mcp/vital-writer.ts`
- [Target reads](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/daily-target-reader.ts): `amplify/functions/blix-mcp/daily-target-reader.ts`
- [Target writes](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/daily-target-writer.ts): `amplify/functions/blix-mcp/daily-target-writer.ts`

### MCP Access

- [MCP request handler](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/identity-probe-handler.ts): `amplify/functions/blix-mcp/identity-probe-handler.ts`
- [Health tool server](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/identity-probe-server.ts): `amplify/functions/blix-mcp/identity-probe-server.ts`

### Identity

- [OAuth scopes](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/oauth-scope.ts): `amplify/functions/blix-mcp/oauth-scope.ts`
- [Auth0 token checks](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/auth0-probe.ts): `amplify/functions/blix-mcp/auth0-probe.ts`
- [Owner resolution](https://github.com/betolix/blix-health-tracker/blob/main/amplify/functions/blix-mcp/cognito-owner.ts): `amplify/functions/blix-mcp/cognito-owner.ts`

### Other components

- **Dashboard user**
- **MCP client**

## Connections

- Dashboard user → Sign-in UI: signs in (evidence: `src/main.tsx`)
- Sign-in UI → Health dashboard: renders (evidence: `src/main.tsx`)
- Dashboard user → Health dashboard: tracks health (evidence: `README.md`)
- Health dashboard → Health models: uses schema (evidence: `src/main.tsx`)
- Health dashboard → Amplify data store: reads and writes (evidence: `src/main.tsx`)
- Health models → Amplify data store: defines models (evidence: `amplify/backend.ts`)
- MCP client → MCP request handler: sends requests
- MCP request handler → Auth0 token checks: verifies tokens (evidence: `amplify/functions/blix-mcp/identity-probe-handler.ts`)
- MCP request handler → OAuth scopes: checks scopes (evidence: `amplify/functions/blix-mcp/identity-probe-handler.ts`)
- MCP request handler → Health tool server: dispatches tools (evidence: `amplify/functions/blix-mcp/identity-probe-handler.ts`)
- Health tool server → Food entry reads: reads entries (evidence: `amplify/functions/blix-mcp/identity-probe-server.ts`)
- Health tool server → Food entry writes: writes entries (evidence: `amplify/functions/blix-mcp/identity-probe-server.ts`)
- Health tool server → Vital reads: reads vitals (evidence: `amplify/functions/blix-mcp/identity-probe-server.ts`)
- Health tool server → Vital writes: writes vitals (evidence: `amplify/functions/blix-mcp/identity-probe-server.ts`)
- Health tool server → Target reads: reads targets (evidence: `amplify/functions/blix-mcp/identity-probe-handler.ts`)
- Health tool server → Target writes: writes targets (evidence: `amplify/functions/blix-mcp/identity-probe-handler.ts`)
- Food entry reads → Owner resolution: resolves owner (evidence: `amplify/functions/blix-mcp/food-entry-reader.ts`)
- Food entry writes → Owner resolution: resolves owner (evidence: `amplify/functions/blix-mcp/food-entry-writer.ts`)
- Vital reads → Owner resolution: resolves owner (evidence: `amplify/functions/blix-mcp/vital-reader.ts`)
- Vital writes → Owner resolution: resolves owner (evidence: `amplify/functions/blix-mcp/vital-writer.ts`)
- Target reads → Owner resolution: resolves owner (evidence: `amplify/functions/blix-mcp/daily-target-reader.ts`)
- Target writes → Owner resolution: resolves owner (evidence: `amplify/functions/blix-mcp/daily-target-writer.ts`)
