# hemantgith/neurowell-ai architecture

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

- Interactive diagram: https://gitdiagram.com/hemantgith/neurowell-ai
- Repository: https://github.com/hemantgith/neurowell-ai

## Overview

NeuroWell AI is a multimodal mental-wellness assessment and counselling platform. The user registers or signs in, completes behavioural, chat, face, and voice assessments, receives a fused severity report, and views personalized dashboard support. The graph includes the web app, API stages, model/NLP/AI services, and persistence. Some subsystem links rely on SOURCE INDEX references or README statements because their full implementations were not excerpted; unsupported details are omitted.

Main entry points: [`frontend/src/App.jsx`](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/App.jsx) (Routes and guards), [`backend/main.py`](https://github.com/hemantgith/neurowell-ai/blob/main/backend/main.py) (FastAPI entry), [`frontend/src/api.js`](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/api.js) (HTTP client), [`backend/models.py`](https://github.com/hemantgith/neurowell-ai/blob/main/backend/models.py) (Domain records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Routes and guards<br/>[App.jsx]"]
  node_authui["Auth state<br/>[AuthContext.jsx]"]
  node_signup["Register and login<br/>[Register.jsx]"]
  node_behaviourui["Behaviour test<br/>[BehaviourTest.jsx]"]
  node_chatui["Chat counselling"]
  node_faceui["Face assessment<br/>[FaceEmotion.jsx]"]
  node_voiceui["Voice assessment<br/>[VoiceAnalysis.jsx]"]
  node_severityui["Severity report<br/>[FinalSeverity.jsx]"]
  node_dashboardui["Wellness dashboard<br/>[Dashboard.jsx]"]
  node_api["HTTP client<br/>[api.js]"]
end

subgraph group_assessment["Assessment API"]
  node_backend["FastAPI entry<br/>[main.py]"]
  node_authapi["Auth routes<br/>[auth.py]"]
  node_behaviourapi["Behaviour routes<br/>[behaviour.py]"]
  node_chatapi["Chat routes<br/>[chat.py]"]
  node_faceapi["Face routes<br/>[face.py]"]
  node_voiceapi["Voice routes<br/>[voice.py]"]
  node_severityapi["Severity fusion<br/>[severity.py]"]
  node_dashboardapi["Dashboard services<br/>[dashboard.py]"]
end

subgraph group_services["Inference and counselling"]
  node_ml["Model inference<br/>[ml_loader.py]"]
  node_nlp["Chat analysis<br/>[nlp_service.py]"]
  node_ai["Therapist AI<br/>[ai_service.py]"]
end

subgraph group_data["Identity and persistence"]
  node_jwt["JWT handling<br/>[jwt_handler.py]"]
  node_models["Domain records<br/>[models.py]"]
  node_database[("Database access<br/>[database.py]")]
end

node_user(("User"))
node_google(("Google OAuth"))
node_openrouter(("OpenRouter"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_behaviourui
node_app -->|"routes to"| node_chatui
node_app -->|"routes to"| node_faceui
node_app -->|"routes to"| node_voiceui
node_app -->|"routes to"| node_severityui
node_app -->|"routes to"| node_dashboardui
node_signup -->|"calls"| node_api
node_behaviourui -->|"calls"| node_api
node_chatui -->|"calls"| node_api
node_faceui -->|"calls"| node_api
node_voiceui -->|"calls"| node_api
node_severityui -->|"calls"| node_api
node_dashboardui -->|"calls"| node_api
node_api -->|"HTTP requests"| node_backend
node_backend -->|"registers"| node_authapi
node_backend -->|"registers"| node_behaviourapi
node_backend -->|"registers"| node_chatapi
node_backend -->|"registers"| node_faceapi
node_backend -->|"registers"| node_voiceapi
node_backend -->|"registers"| node_severityapi
node_backend -->|"registers"| node_dashboardapi
node_backend -->|"loads models"| node_ml
node_authapi -->|"issues tokens"| node_jwt
node_authapi -->|"verifies OAuth"| node_google
node_authapi -->|"queries users"| node_database
node_authapi -->|"uses records"| node_models
node_behaviourapi -->|"predicts"| node_ml
node_behaviourapi -->|"stores results"| node_database
node_behaviourapi -->|"uses records"| node_models
node_chatapi -->|"analyzes text"| node_nlp
node_chatapi -->|"gets reply"| node_ai
node_chatapi -->|"stores history"| node_database
node_chatapi -->|"uses records"| node_models
node_faceapi -->|"predicts emotion"| node_ml
node_faceapi -->|"stores results"| node_database
node_faceapi -->|"uses records"| node_models
node_voiceapi -->|"predicts emotion"| node_ml
node_voiceapi -->|"stores results"| node_database
node_voiceapi -->|"uses records"| node_models
node_severityapi -->|"reads assessments"| node_database
node_severityapi -->|"uses records"| node_models
node_dashboardapi -->|"reads profile"| node_database
node_dashboardapi -->|"uses records"| node_models
node_dashboardapi -->|"requests guidance"| node_ai
node_ai -->|"calls model API"| node_openrouter

click node_app "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/contexts/AuthContext.jsx"
click node_signup "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/Register.jsx"
click node_behaviourui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/BehaviourTest.jsx"
click node_chatui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/ChatCounselling.jsx"
click node_faceui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/FaceEmotion.jsx"
click node_voiceui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/VoiceAnalysis.jsx"
click node_severityui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/FinalSeverity.jsx"
click node_dashboardui "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/Dashboard.jsx"
click node_api "https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/api.js"
click node_backend "https://github.com/hemantgith/neurowell-ai/blob/main/backend/main.py"
click node_authapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/auth.py"
click node_behaviourapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/behaviour.py"
click node_chatapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/chat.py"
click node_faceapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/face.py"
click node_voiceapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/voice.py"
click node_severityapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/severity.py"
click node_dashboardapi "https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/dashboard.py"
click node_ml "https://github.com/hemantgith/neurowell-ai/blob/main/backend/ml_loader.py"
click node_nlp "https://github.com/hemantgith/neurowell-ai/blob/main/backend/nlp_service.py"
click node_ai "https://github.com/hemantgith/neurowell-ai/blob/main/backend/ai_service.py"
click node_jwt "https://github.com/hemantgith/neurowell-ai/blob/main/backend/jwt_handler.py"
click node_models "https://github.com/hemantgith/neurowell-ai/blob/main/backend/models.py"
click node_database "https://github.com/hemantgith/neurowell-ai/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,node_signup,node_behaviourui,node_chatui,node_faceui,node_voiceui,node_severityui,node_dashboardui,node_api,node_user toneBlue
class node_backend,node_authapi,node_behaviourapi,node_chatapi,node_faceapi,node_voiceapi,node_severityapi,node_dashboardapi toneAmber
class node_ml,node_nlp,node_ai,node_openrouter toneMint
class node_jwt,node_models,node_database toneRose
class node_google toneIndigo
```

## Components

### Web experience

- [Routes and guards](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/contexts/AuthContext.jsx): `frontend/src/contexts/AuthContext.jsx`
- [Register and login](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/Register.jsx): `frontend/src/pages/Register.jsx`
- [Behaviour test](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/BehaviourTest.jsx): `frontend/src/pages/BehaviourTest.jsx`
- [Chat counselling](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/ChatCounselling.jsx): `frontend/src/pages/ChatCounselling.jsx`
- [Face assessment](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/FaceEmotion.jsx): `frontend/src/pages/FaceEmotion.jsx`
- [Voice assessment](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/VoiceAnalysis.jsx): `frontend/src/pages/VoiceAnalysis.jsx`
- [Severity report](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/FinalSeverity.jsx): `frontend/src/pages/FinalSeverity.jsx`
- [Wellness dashboard](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [HTTP client](https://github.com/hemantgith/neurowell-ai/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Assessment API

- [FastAPI entry](https://github.com/hemantgith/neurowell-ai/blob/main/backend/main.py): `backend/main.py`
- [Auth routes](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/auth.py): `backend/routers/auth.py`
- [Behaviour routes](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/behaviour.py): `backend/routers/behaviour.py`
- [Chat routes](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/chat.py): `backend/routers/chat.py`
- [Face routes](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/face.py): `backend/routers/face.py`
- [Voice routes](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/voice.py): `backend/routers/voice.py`
- [Severity fusion](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/severity.py): `backend/routers/severity.py`
- [Dashboard services](https://github.com/hemantgith/neurowell-ai/blob/main/backend/routers/dashboard.py): `backend/routers/dashboard.py`

### Inference and counselling

- [Model inference](https://github.com/hemantgith/neurowell-ai/blob/main/backend/ml_loader.py): `backend/ml_loader.py`
- [Chat analysis](https://github.com/hemantgith/neurowell-ai/blob/main/backend/nlp_service.py): `backend/nlp_service.py`
- [Therapist AI](https://github.com/hemantgith/neurowell-ai/blob/main/backend/ai_service.py): `backend/ai_service.py`

### Identity and persistence

- [JWT handling](https://github.com/hemantgith/neurowell-ai/blob/main/backend/jwt_handler.py): `backend/jwt_handler.py`
- [Domain records](https://github.com/hemantgith/neurowell-ai/blob/main/backend/models.py): `backend/models.py`
- [Database access](https://github.com/hemantgith/neurowell-ai/blob/main/backend/database.py): `backend/database.py`

### Other components

- **User**
- **Google OAuth**
- **OpenRouter**

## Connections

- User → Routes and guards: uses (evidence: `frontend/src/App.jsx`)
- Routes and guards → Auth state: provides auth (evidence: `frontend/src/App.jsx`)
- Routes and guards → Register and login: routes to (evidence: `frontend/src/App.jsx`)
- Routes and guards → Behaviour test: routes to (evidence: `frontend/src/App.jsx`)
- Routes and guards → Chat counselling: routes to (evidence: `frontend/src/App.jsx`)
- Routes and guards → Face assessment: routes to (evidence: `frontend/src/App.jsx`)
- Routes and guards → Voice assessment: routes to (evidence: `frontend/src/App.jsx`)
- Routes and guards → Severity report: routes to (evidence: `frontend/src/App.jsx`)
- Routes and guards → Wellness dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Register and login → HTTP client: calls (evidence: `frontend/src/pages/Register.jsx`)
- Behaviour test → HTTP client: calls (evidence: `frontend/src/pages/BehaviourTest.jsx`)
- Chat counselling → HTTP client: calls (evidence: `frontend/src/pages/ChatCounselling.jsx`)
- Face assessment → HTTP client: calls (evidence: `frontend/src/pages/FaceEmotion.jsx`)
- Voice assessment → HTTP client: calls
- Severity report → HTTP client: calls (evidence: `frontend/src/pages/FinalSeverity.jsx`)
- Wellness dashboard → HTTP client: calls (evidence: `frontend/src/pages/Dashboard.jsx`)
- HTTP client → FastAPI entry: HTTP requests (evidence: `README.md`)
- FastAPI entry → Auth routes: registers (evidence: `backend/main.py`)
- FastAPI entry → Behaviour routes: registers (evidence: `backend/main.py`)
- FastAPI entry → Chat routes: registers (evidence: `backend/main.py`)
- FastAPI entry → Face routes: registers (evidence: `backend/main.py`)
- FastAPI entry → Voice routes: registers (evidence: `backend/main.py`)
- FastAPI entry → Severity fusion: registers (evidence: `backend/main.py`)
- FastAPI entry → Dashboard services: registers (evidence: `backend/main.py`)
- FastAPI entry → Model inference: loads models (evidence: `backend/main.py`)
- Auth routes → JWT handling: issues tokens (evidence: `backend/routers/auth.py`)
- Auth routes → Google OAuth: verifies OAuth (evidence: `backend/routers/auth.py`)
- Auth routes → Database access: queries users (evidence: `backend/routers/auth.py`)
- Auth routes → Domain records: uses records (evidence: `backend/routers/auth.py`)
- Behaviour routes → Model inference: predicts (evidence: `backend/routers/behaviour.py`)
- Behaviour routes → Database access: stores results (evidence: `backend/routers/behaviour.py`)
- Behaviour routes → Domain records: uses records (evidence: `backend/routers/behaviour.py`)
- Chat routes → Chat analysis: analyzes text (evidence: `backend/routers/chat.py`)
- Chat routes → Therapist AI: gets reply (evidence: `backend/routers/chat.py`)
- Chat routes → Database access: stores history (evidence: `backend/routers/chat.py`)
- Chat routes → Domain records: uses records (evidence: `backend/routers/chat.py`)
- Face routes → Model inference: predicts emotion (evidence: `backend/routers/face.py`)
- Face routes → Database access: stores results (evidence: `backend/routers/face.py`)
- Face routes → Domain records: uses records (evidence: `backend/routers/face.py`)
- Voice routes → Model inference: predicts emotion (evidence: `backend/routers/voice.py`)
- Voice routes → Database access: stores results (evidence: `backend/routers/voice.py`)
- Voice routes → Domain records: uses records (evidence: `backend/routers/voice.py`)
- Severity fusion → Database access: reads assessments (evidence: `backend/routers/severity.py`)
- Severity fusion → Domain records: uses records (evidence: `backend/routers/severity.py`)
- Dashboard services → Database access: reads profile (evidence: `backend/routers/dashboard.py`)
- Dashboard services → Domain records: uses records (evidence: `backend/routers/dashboard.py`)
- Dashboard services → Therapist AI: requests guidance (evidence: `backend/routers/dashboard.py`)
- Therapist AI → OpenRouter: calls model API (evidence: `backend/ai_service.py`)
