# aaryankumar70/mindpulseai architecture

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

- Interactive diagram: https://gitdiagram.com/aaryankumar70/mindpulseai
- Repository: https://github.com/aaryankumar70/mindpulseai

## Overview

MindPulse is a student well-being assessment app: users authenticate, submit habit and lifestyle data, receive a model-estimated score with interpretation, then review history and use personalized activities and plans. The frontend calls a FastAPI service; MongoDB-backed records support accounts, predictions, and tasks. README also documents Supabase history and an AI companion, but the Supabase client is absent from the supplied tree and the sampled backend excerpt does not show the companion’s dispatch, so those links are limited to documented or directly visible evidence.

Main entry points: [`frontend/src/App.tsx`](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/App.tsx) (App shell), [`backend/main.py`](https://github.com/aaryankumar70/mindpulseai/blob/main/backend/main.py) (FastAPI service), [`frontend/src/components/TasksSection.tsx`](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/TasksSection.tsx) (Personalized tasks), [`frontend/src/tasks.ts`](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/tasks.ts) (Task API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_authui["Sign-in UI<br/>[AuthPage.tsx]"]
end

subgraph group_assessment["Assessment workflow"]
  node_predictionform["Assessment form<br/>[PredictionForm.tsx]"]
  node_predictionclient["Prediction client<br/>[prediction.ts]"]
  node_result["Score and insights<br/>[ResultCard.tsx]"]
  node_history["Prediction history<br/>[HistorySection.tsx]"]
end

subgraph group_wellbeing["Well-being follow-up"]
  node_tasksui["Personalized tasks<br/>[TasksSection.tsx]"]
  node_taskclient["Task API client<br/>[tasks.ts]"]
  node_activity["Guided activities<br/>[ActivityPage.tsx]"]
  node_breathing["Breathing session"]
  node_plan["Mobile plan<br/>[MobilePlanPage.tsx]"]
  node_chatui["AI companion UI<br/>[Chatbot.tsx]"]
end

subgraph group_backend["Backend services"]
  node_authapi["Auth endpoints<br/>[main.py]"]
  node_authlogic["Token and passwords<br/>[auth.py]"]
  node_api["FastAPI service<br/>[main.py]"]
  node_model["Trained model"]
  node_supabase[("Supabase history")]
  node_dbmodule["Database access<br/>[database.py]"]
  node_mongodb[("MongoDB")]
end

node_student(("Student"))
node_groq(("Groq service"))

node_student -->|"opens"| node_app
node_app -->|"shows"| node_authui
node_authui -->|"registers or logs in"| node_authapi
node_authapi -->|"uses"| node_authlogic
node_authapi -->|"reads and writes users"| node_dbmodule
node_dbmodule -->|"connects"| node_mongodb
node_app -->|"shows"| node_predictionform
node_predictionform -->|"submits inputs"| node_predictionclient
node_predictionclient -->|"requests prediction"| node_api
node_api -->|"predicts with"| node_model
node_api -->|"stores prediction"| node_dbmodule
node_predictionclient -->|"formats response for"| node_result
node_app -->|"shows"| node_history
node_history -.->|"reads history"| node_supabase
node_app -->|"shows"| node_tasksui
node_tasksui -->|"loads tasks and plan"| node_taskclient
node_taskclient -->|"calls task endpoints"| node_api
node_api -->|"reads and updates tasks"| node_dbmodule
node_tasksui -->|"starts selected task"| node_activity
node_activity -->|"loads and completes task"| node_taskclient
node_activity -->|"renders breathing session"| node_breathing
node_tasksui -->|"opens tokenized plan"| node_plan
node_app -->|"shows"| node_chatui
node_chatui -->|"sends chat request"| node_taskclient
node_api -.->|"imports client for"| node_groq

click node_app "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/AuthPage.tsx"
click node_authapi "https://github.com/aaryankumar70/mindpulseai/blob/main/backend/main.py"
click node_authlogic "https://github.com/aaryankumar70/mindpulseai/blob/main/backend/auth.py"
click node_predictionform "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/PredictionForm.tsx"
click node_predictionclient "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/prediction.ts"
click node_api "https://github.com/aaryankumar70/mindpulseai/blob/main/backend/main.py"
click node_model "https://github.com/aaryankumar70/mindpulseai/blob/main/backend/Mental_Health_Model.pkl"
click node_result "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/ResultCard.tsx"
click node_history "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/HistorySection.tsx"
click node_tasksui "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/TasksSection.tsx"
click node_taskclient "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/tasks.ts"
click node_activity "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/ActivityPage.tsx"
click node_breathing "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/activities/BreathingActivity.tsx"
click node_plan "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/MobilePlanPage.tsx"
click node_chatui "https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/Chatbot.tsx"
click node_dbmodule "https://github.com/aaryankumar70/mindpulseai/blob/main/backend/database.py"

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 toneBlue
class node_predictionform,node_predictionclient,node_result,node_history toneAmber
class node_tasksui,node_taskclient,node_activity,node_breathing,node_plan,node_chatui toneMint
class node_authapi,node_authlogic,node_api,node_model,node_supabase,node_dbmodule,node_mongodb toneRose
class node_student,node_groq toneIndigo
```

## Components

### Frontend experience

- [App shell](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in UI](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/AuthPage.tsx): `frontend/src/components/AuthPage.tsx`

### Assessment workflow

- [Assessment form](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/PredictionForm.tsx): `frontend/src/components/PredictionForm.tsx`
- [Prediction client](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/prediction.ts): `frontend/src/prediction.ts`
- [Score and insights](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/ResultCard.tsx): `frontend/src/components/ResultCard.tsx`
- [Prediction history](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/HistorySection.tsx): `frontend/src/components/HistorySection.tsx`

### Well-being follow-up

- [Personalized tasks](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/TasksSection.tsx): `frontend/src/components/TasksSection.tsx`
- [Task API client](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/tasks.ts): `frontend/src/tasks.ts`
- [Guided activities](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/ActivityPage.tsx): `frontend/src/components/ActivityPage.tsx`
- [Breathing session](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/activities/BreathingActivity.tsx): `frontend/src/components/activities/BreathingActivity.tsx`
- [Mobile plan](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/MobilePlanPage.tsx): `frontend/src/components/MobilePlanPage.tsx`
- [AI companion UI](https://github.com/aaryankumar70/mindpulseai/blob/main/frontend/src/components/Chatbot.tsx): `frontend/src/components/Chatbot.tsx`

### Backend services

- [Auth endpoints](https://github.com/aaryankumar70/mindpulseai/blob/main/backend/main.py): `backend/main.py`
- [Token and passwords](https://github.com/aaryankumar70/mindpulseai/blob/main/backend/auth.py): `backend/auth.py`
- [FastAPI service](https://github.com/aaryankumar70/mindpulseai/blob/main/backend/main.py): `backend/main.py`
- [Trained model](https://github.com/aaryankumar70/mindpulseai/blob/main/backend/Mental_Health_Model.pkl): `backend/Mental_Health_Model.pkl`
- **Supabase history**
- [Database access](https://github.com/aaryankumar70/mindpulseai/blob/main/backend/database.py): `backend/database.py`
- **MongoDB**

### Other components

- **Student**
- **Groq service**

## Connections

- Student → App shell: opens
- App shell → Sign-in UI: shows
- Sign-in UI → Auth endpoints: registers or logs in
- Auth endpoints → Token and passwords: uses
- Auth endpoints → Database access: reads and writes users
- Database access → MongoDB: connects
- App shell → Assessment form: shows
- Assessment form → Prediction client: submits inputs
- Prediction client → FastAPI service: requests prediction
- FastAPI service → Trained model: predicts with
- FastAPI service → Database access: stores prediction
- Prediction client → Score and insights: formats response for
- App shell → Prediction history: shows
- Prediction history → Supabase history: reads history
- App shell → Personalized tasks: shows
- Personalized tasks → Task API client: loads tasks and plan
- Task API client → FastAPI service: calls task endpoints
- FastAPI service → Database access: reads and updates tasks
- Personalized tasks → Guided activities: starts selected task
- Guided activities → Task API client: loads and completes task
- Guided activities → Breathing session: renders breathing session
- Personalized tasks → Mobile plan: opens tokenized plan
- App shell → AI companion UI: shows
- AI companion UI → Task API client: sends chat request
- FastAPI service → Groq service: imports client for
