# tejaswikg08dev/health-tracker architecture

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

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

## Overview

This is a personal health and habit tracker: users authenticate, create habits, record check-ins, and review analytics, with AI coaching, document-grounded answers, reports, notifications, and exports as supporting capabilities. The React app routes users to feature pages and services call the FastAPI API; backend modules handle domain work against shared PostgreSQL/Redis infrastructure. README documents several integrations and API capabilities not represented in sampled implementations, so those are included at module level; only source-supported wiring is drawn. The frontend-to-API and many module internals are inferred from documented structure where excerpts are partial.

Main entry points: [`backend/app/main.py`](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/main.py) (FastAPI Application), [`backend/app/database.py`](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/database.py) (PostgreSQL), [`backend/app/modules/ai/service.py`](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/ai/service.py) (AI Service), [`frontend/src/App.tsx`](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/App.tsx) (React App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web Client"]
  node_frontend["React App<br/>[App.tsx]"]
  node_authui["Auth Screens<br/>[LoginPage.tsx]"]
  node_habitui["Habit Check-ins<br/>[CheckInPage.tsx]"]
  node_analyticsui["Analytics Views<br/>[AnalyticsPage.tsx]"]
  node_chatui["AI Chat UI<br/>[ChatPage.tsx]"]
  node_webapi["API Services<br/>[api.ts]"]
end

subgraph group_core["Health Tracking"]
  node_auth["Authentication"]
  node_habits["Habit Management"]
  node_logs["Daily Logs"]
  node_analytics["Analytics"]
end

subgraph group_insights["AI Insights"]
  node_ai["AI Service<br/>[service.py]"]
  node_agent["ReAct Coach<br/>[health_coach.py]"]
  node_rag["Document RAG"]
  node_workflow["Weekly Report Flow"]
  node_llm["LLM Providers"]
end

subgraph group_delivery["User Delivery"]
  node_notifications["Notifications"]
  node_export["Data Export"]
  node_storage["S3-Compatible Storage<br/>[storage.py]"]
  node_lambda["Scheduled / Async Tasks"]
end

subgraph group_runtime["Backend Runtime"]
  node_database[("PostgreSQL<br/>[database.py]")]
  node_redis[("Redis Services<br/>[redis_client.py]")]
  node_api["FastAPI Application<br/>[main.py]"]
end

node_user(("Health Tracker User"))
node_email["Email Service"]

node_user -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_authui
node_frontend -->|"routes to"| node_habitui
node_frontend -->|"routes to"| node_analyticsui
node_frontend -->|"routes to"| node_chatui
node_authui -->|"requests"| node_webapi
node_habitui -->|"requests"| node_webapi
node_analyticsui -->|"requests"| node_webapi
node_chatui -->|"requests"| node_webapi
node_webapi -->|"calls"| node_api
node_api -->|"dispatches"| node_auth
node_api -->|"dispatches"| node_habits
node_api -->|"dispatches"| node_logs
node_api -->|"dispatches"| node_analytics
node_api -->|"dispatches"| node_ai
node_api -->|"dispatches"| node_notifications
node_api -->|"dispatches"| node_export
node_auth -->|"reads/writes"| node_database
node_habits -->|"reads/writes"| node_database
node_logs -->|"reads/writes"| node_database
node_analytics -->|"queries"| node_database
node_analytics -->|"caches"| node_redis
node_ai -->|"requests completions"| node_llm
node_ai -->|"invokes"| node_agent
node_ai -->|"processes documents"| node_rag
node_ai -->|"runs report"| node_workflow
node_ai -->|"reads/writes"| node_database
node_ai -->|"tracks usage"| node_redis
node_agent -->|"queries logs"| node_logs
node_workflow -->|"analyzes and writes"| node_llm
node_workflow -->|"collects data"| node_database
node_rag -->|"stores vectors"| node_database
node_export -->|"uploads files"| node_storage
node_export -->|"reads data"| node_database
node_notifications -->|"sends messages"| node_email
node_lambda -->|"reads/writes"| node_database
node_lambda -->|"sends messages"| node_email
node_lambda -->|"uploads exports"| node_storage
node_lambda -.->|"generates reports"| node_llm

click node_frontend "https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/LoginPage.tsx"
click node_habitui "https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/CheckInPage.tsx"
click node_analyticsui "https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/AnalyticsPage.tsx"
click node_chatui "https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/ChatPage.tsx"
click node_webapi "https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/services/api.ts"
click node_auth "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/auth"
click node_habits "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/habits"
click node_analytics "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/analytics"
click node_database "https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/database.py"
click node_redis "https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/redis_client.py"
click node_api "https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/main.py"
click node_ai "https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/ai/service.py"
click node_agent "https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/ai/agents/health_coach.py"
click node_rag "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/ai/rag"
click node_workflow "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/ai/workflows/weekly_report"
click node_llm "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/ai/llm"
click node_notifications "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/notifications"
click node_export "https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/export"
click node_storage "https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/export/storage.py"
click node_lambda "https://github.com/tejaswikg08dev/health-tracker/tree/main/lambda_functions"

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_frontend,node_authui,node_habitui,node_analyticsui,node_chatui,node_webapi,node_user toneBlue
class node_auth,node_habits,node_logs,node_analytics toneAmber
class node_ai,node_agent,node_rag,node_workflow,node_llm toneMint
class node_notifications,node_export,node_storage,node_lambda toneRose
class node_database,node_redis,node_api,node_email toneIndigo
```

## Components

### Web Client

- [React App](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth Screens](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Habit Check-ins](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/CheckInPage.tsx): `frontend/src/pages/CheckInPage.tsx`
- [Analytics Views](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/AnalyticsPage.tsx): `frontend/src/pages/AnalyticsPage.tsx`
- [AI Chat UI](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/pages/ChatPage.tsx): `frontend/src/pages/ChatPage.tsx`
- [API Services](https://github.com/tejaswikg08dev/health-tracker/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Health Tracking

- [Authentication](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/auth): `backend/app/modules/auth`
- [Habit Management](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/habits): `backend/app/modules/habits`
- **Daily Logs**
- [Analytics](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/analytics): `backend/app/modules/analytics`

### AI Insights

- [AI Service](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/ai/service.py): `backend/app/modules/ai/service.py`
- [ReAct Coach](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/ai/agents/health_coach.py): `backend/app/modules/ai/agents/health_coach.py`
- [Document RAG](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/ai/rag): `backend/app/modules/ai/rag`
- [Weekly Report Flow](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/ai/workflows/weekly_report): `backend/app/modules/ai/workflows/weekly_report`
- [LLM Providers](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/ai/llm): `backend/app/modules/ai/llm`

### User Delivery

- [Notifications](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/notifications): `backend/app/modules/notifications`
- [Data Export](https://github.com/tejaswikg08dev/health-tracker/tree/main/backend/app/modules/export): `backend/app/modules/export`
- [S3-Compatible Storage](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/modules/export/storage.py): `backend/app/modules/export/storage.py`
- [Scheduled / Async Tasks](https://github.com/tejaswikg08dev/health-tracker/tree/main/lambda_functions): `lambda_functions`

### Backend Runtime

- [PostgreSQL](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/database.py): `backend/app/database.py`
- [Redis Services](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/redis_client.py): `backend/app/redis_client.py`
- [FastAPI Application](https://github.com/tejaswikg08dev/health-tracker/blob/main/backend/app/main.py): `backend/app/main.py`

### Other components

- **Health Tracker User**
- **Email Service**

## Connections

- Health Tracker User → React App: uses
- React App → Auth Screens: routes to
- React App → Habit Check-ins: routes to
- React App → Analytics Views: routes to
- React App → AI Chat UI: routes to
- Auth Screens → API Services: requests
- Habit Check-ins → API Services: requests
- Analytics Views → API Services: requests
- AI Chat UI → API Services: requests
- API Services → FastAPI Application: calls
- FastAPI Application → Authentication: dispatches
- FastAPI Application → Habit Management: dispatches
- FastAPI Application → Daily Logs: dispatches
- FastAPI Application → Analytics: dispatches
- FastAPI Application → AI Service: dispatches
- FastAPI Application → Notifications: dispatches
- FastAPI Application → Data Export: dispatches
- Authentication → PostgreSQL: reads/writes
- Habit Management → PostgreSQL: reads/writes
- Daily Logs → PostgreSQL: reads/writes
- Analytics → PostgreSQL: queries
- Analytics → Redis Services: caches
- AI Service → LLM Providers: requests completions
- AI Service → ReAct Coach: invokes
- AI Service → Document RAG: processes documents
- AI Service → Weekly Report Flow: runs report
- AI Service → PostgreSQL: reads/writes
- AI Service → Redis Services: tracks usage
- ReAct Coach → Daily Logs: queries logs
- Weekly Report Flow → LLM Providers: analyzes and writes
- Weekly Report Flow → PostgreSQL: collects data
- Document RAG → PostgreSQL: stores vectors
- Data Export → S3-Compatible Storage: uploads files
- Data Export → PostgreSQL: reads data
- Notifications → Email Service: sends messages
- Scheduled / Async Tasks → PostgreSQL: reads/writes
- Scheduled / Async Tasks → Email Service: sends messages
- Scheduled / Async Tasks → S3-Compatible Storage: uploads exports
- Scheduled / Async Tasks → LLM Providers: generates reports
