# s1a2t00/ai_fitness-agent-by-satyam architecture

> Architecture diagram of the GitHub repository s1a2t00/ai_fitness-agent-by-satyam, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/s1a2t00/ai_fitness-agent-by-satyam
- Repository: https://github.com/s1a2t00/ai_fitness-agent-by-satyam

## Overview

Vitalis AI is a health and fitness web app for AI-assisted posture, medical-report, and medication analysis, plus health coaching. Users enter through the React app, select an analysis or send a coaching message, and receive Gemini-generated results through the Node API. Analysis results are held in app state and persisted in browser local storage for dashboard, medication, and history views. The README documents the API boundary and Gemini integration; unsampled view and server code is represented only where that documentation supports the relationship.

Main entry points: [`App.tsx`](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/App.tsx) (App routing and state), [`views/AnalysisHub.tsx`](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/AnalysisHub.tsx) (Health analysis), [`types.ts`](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/types.ts) (Health data types), [`views/AICoach.tsx`](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/AICoach.tsx) (AI Coach)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_entry["React entry<br/>[index.tsx]"]
  node_router["App routing and state<br/>[App.tsx]"]
  node_layout["Navigation layout<br/>[Layout.tsx]"]
end

subgraph group_health["Health insights"]
  node_dashboard["Health dashboard<br/>[Dashboard.tsx]"]
  node_analysis["Health analysis<br/>[AnalysisHub.tsx]"]
  node_medicine["Medication view<br/>[App.tsx]"]
  node_history["Analysis history<br/>[HealthHistory.tsx]"]
  node_coach["AI Coach<br/>[AICoach.tsx]"]
end

subgraph group_ai["AI services"]
  node_api_client["API client<br/>[geminiService.ts]"]
  node_backend["Node API and frontend server<br/>[index.mjs]"]
end

subgraph group_runtime["Runtime contracts"]
  node_contracts["Health data types<br/>[types.ts]"]
  node_prompts["Model and health guidance<br/>[constants.ts]"]
end

node_user(("User"))
node_gemini{{"Gemini API"}}
node_history_store[("Browser local storage")]

node_user -->|"opens app"| node_entry
node_entry -->|"mounts"| node_router
node_router -->|"wraps routes"| node_layout
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_analysis
node_router -->|"renders route"| node_medicine
node_router -->|"routes to"| node_history
node_router -->|"routes to"| node_coach
node_router -->|"reads and writes"| node_history_store
node_router -->|"passes history"| node_dashboard
node_router -->|"handles results"| node_analysis
node_router -->|"handles deletion"| node_history
node_router -->|"passes history"| node_coach
node_analysis -->|"requests analysis"| node_api_client
node_analysis -->|"returns result"| node_router
node_coach -->|"sends chat"| node_api_client
node_api_client -->|"posts API requests"| node_backend
node_backend -->|"generates content"| node_gemini
node_backend -->|"uses model config"| node_prompts
node_router -->|"uses result types"| node_contracts
node_analysis -->|"uses result types"| node_contracts
node_coach -->|"uses message types"| node_contracts
node_dashboard -->|"uses result types"| node_contracts
node_history -->|"uses result types"| node_contracts

click node_entry "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/index.tsx"
click node_router "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/App.tsx"
click node_layout "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/components/Layout.tsx"
click node_dashboard "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/Dashboard.tsx"
click node_analysis "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/AnalysisHub.tsx"
click node_medicine "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/App.tsx"
click node_history "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/HealthHistory.tsx"
click node_coach "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/AICoach.tsx"
click node_api_client "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/services/geminiService.ts"
click node_backend "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/server/index.mjs"
click node_contracts "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/types.ts"
click node_prompts "https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/constants.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_entry,node_router,node_layout,node_user toneBlue
class node_dashboard,node_analysis,node_medicine,node_history,node_coach,node_history_store toneAmber
class node_api_client,node_backend,node_gemini toneMint
class node_contracts,node_prompts toneRose
```

## Components

### Application shell

- [React entry](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/index.tsx): `index.tsx`
- [App routing and state](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/App.tsx): `App.tsx`
- [Navigation layout](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/components/Layout.tsx): `components/Layout.tsx`

### Health insights

- [Health dashboard](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/Dashboard.tsx): `views/Dashboard.tsx`
- [Health analysis](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/AnalysisHub.tsx): `views/AnalysisHub.tsx`
- [Medication view](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/App.tsx): `App.tsx`
- [Analysis history](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/HealthHistory.tsx): `views/HealthHistory.tsx`
- [AI Coach](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/views/AICoach.tsx): `views/AICoach.tsx`

### AI services

- [API client](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/services/geminiService.ts): `services/geminiService.ts`
- [Node API and frontend server](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/server/index.mjs): `server/index.mjs`

### Runtime contracts

- [Health data types](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/types.ts): `types.ts`
- [Model and health guidance](https://github.com/s1a2t00/ai_fitness-agent-by-satyam/blob/master/constants.ts): `constants.ts`

### Other components

- **User**
- **Gemini API**
- **Browser local storage**

## Connections

- User → React entry: opens app (evidence: `README.md`)
- React entry → App routing and state: mounts (evidence: `index.tsx`)
- App routing and state → Navigation layout: wraps routes (evidence: `App.tsx`)
- App routing and state → Health dashboard: routes to (evidence: `App.tsx`)
- App routing and state → Health analysis: routes to (evidence: `App.tsx`)
- App routing and state → Medication view: renders route (evidence: `App.tsx`)
- App routing and state → Analysis history: routes to (evidence: `App.tsx`)
- App routing and state → AI Coach: routes to (evidence: `App.tsx`)
- App routing and state → Browser local storage: reads and writes (evidence: `App.tsx`)
- App routing and state → Health dashboard: passes history (evidence: `App.tsx`)
- App routing and state → Health analysis: handles results (evidence: `App.tsx`)
- App routing and state → Analysis history: handles deletion (evidence: `App.tsx`)
- App routing and state → AI Coach: passes history (evidence: `App.tsx`)
- Health analysis → API client: requests analysis (evidence: `views/AnalysisHub.tsx`)
- Health analysis → App routing and state: returns result (evidence: `views/AnalysisHub.tsx`)
- AI Coach → API client: sends chat (evidence: `views/AICoach.tsx`)
- API client → Node API and frontend server: posts API requests (evidence: `README.md`)
- Node API and frontend server → Gemini API: generates content (evidence: `server/index.mjs`)
- Node API and frontend server → Model and health guidance: uses model config (evidence: `server/index.mjs`)
- App routing and state → Health data types: uses result types (evidence: `App.tsx`)
- Health analysis → Health data types: uses result types (evidence: `views/AnalysisHub.tsx`)
- AI Coach → Health data types: uses message types (evidence: `views/AICoach.tsx`)
- Health dashboard → Health data types: uses result types (evidence: `views/Dashboard.tsx`)
- Analysis history → Health data types: uses result types (evidence: `views/HealthHistory.tsx`)
