# aayushshirode2060/mindwell architecture

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

- Interactive diagram: https://gitdiagram.com/aayushshirode2060/mindwell
- Repository: https://github.com/aayushshirode2060/mindwell

## Overview

MindWell is a role-based mental wellness platform for college students, with student self-service, counsellor and volunteer workflows, and administrative oversight. The main student journey is to enter a protected portal, record mood or screening information, use AI chat for support, and receive recommendations or a crisis referral; appointments and community support are additional paths. The backend exposes domain APIs backed by MongoDB, and the chat controller calls a separate Flask mood classifier. The README documents real-time chat and analytics; source excerpts are partial, so uncertain wiring is omitted.

Main entry points: [`client/src/App.jsx`](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/App.jsx) (Role-based portal), [`client/src/api/axios.js`](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/api/axios.js) (HTTP API client), [`server/controllers/chatController.js`](https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/chatController.js) (AI chat and triage), [`server/models`](https://github.com/aayushshirode2060/mindwell/tree/main/server/models) (MongoDB records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_webapp["Role-based portal<br/>[App.jsx]"]
  node_auth["Session and roles<br/>[AuthContext.jsx]"]
  node_api["HTTP API client<br/>[axios.js]"]
end

subgraph group_support["Student support"]
  node_studentcare["Student care tools"]
  node_chatui["AI chat<br/>[ChatBot.jsx]"]
  node_games["Wellness games<br/>[GamesPage.jsx]"]
  node_socketclient["Chat room UI<br/>[ChatRoom.jsx]"]
end

subgraph group_operations["Care operations"]
  node_counsellorui["Counsellor workspace"]
  node_volunteerui["Volunteer workspace"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
end

subgraph group_backend["Backend services"]
  node_http["Express API<br/>[server.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_chatroutes["Chat routes<br/>[chat.js]"]
  node_domainroutes["Domain routes"]
  node_authcontroller["Authentication logic<br/>[authController.js]"]
  node_chatcontroller["AI chat and triage<br/>[chatController.js]"]
  node_appointmentlogic["Appointment management"]
  node_resourcelogic["Resource recommendations"]
  node_adminlogic["Administration and analytics<br/>[adminController.js]"]
  node_store[("MongoDB records")]
  node_socket["Realtime chat<br/>[chatSocket.js]"]
end

subgraph group_integrations["External systems"]
  node_ml["Mood classifier API<br/>[app.py]"]
  node_genai["Generative AI"]
  node_email["Email delivery<br/>[emailService.js]"]
  node_whatsapp["WhatsApp alerts<br/>[whatsappService.js]"]
end

node_student(("Student"))
node_counsellor(("Counsellor"))
node_volunteer(("Volunteer"))
node_admin(("Administrator"))

node_student -->|"opens portal"| node_webapp
node_counsellor -->|"opens portal"| node_webapp
node_volunteer -->|"opens portal"| node_webapp
node_admin -->|"opens portal"| node_webapp
node_webapp -->|"checks identity"| node_auth
node_webapp -->|"routes students"| node_studentcare
node_webapp -->|"routes counsellors"| node_counsellorui
node_webapp -->|"routes volunteers"| node_volunteerui
node_webapp -->|"routes admins"| node_adminui
node_studentcare -->|"requests services"| node_api
node_chatui -->|"sends chat"| node_api
node_games -.->|"requests game data"| node_api
node_counsellorui -->|"requests services"| node_api
node_volunteerui -->|"requests services"| node_api
node_adminui -->|"requests services"| node_api
node_api -->|"sends API requests"| node_http
node_http -->|"mounts routes"| node_authroutes
node_http -->|"mounts routes"| node_chatroutes
node_http -->|"mounts routes"| node_domainroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_chatroutes -->|"dispatches"| node_chatcontroller
node_chatcontroller -->|"classifies text"| node_ml
node_chatcontroller -->|"generates reply"| node_genai
node_chatcontroller -->|"reads and writes"| node_store
node_chatcontroller -->|"sends crisis alert"| node_email
node_chatcontroller -->|"sends crisis alert"| node_whatsapp
node_authcontroller -->|"reads and writes"| node_store
node_authcontroller -->|"sends verification"| node_email
node_domainroutes -->|"dispatches appointments"| node_appointmentlogic
node_domainroutes -->|"dispatches resources"| node_resourcelogic
node_domainroutes -->|"dispatches administration"| node_adminlogic
node_appointmentlogic -->|"reads and writes"| node_store
node_appointmentlogic -->|"sends confirmations"| node_email
node_resourcelogic -->|"reads and writes"| node_store
node_adminlogic -->|"queries records"| node_store
node_socketclient -.->|"exchanges messages"| node_socket

click node_webapp "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/App.jsx"
click node_auth "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/context/AuthContext.jsx"
click node_api "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/api/axios.js"
click node_studentcare "https://github.com/aayushshirode2060/mindwell/tree/main/client/src/pages/student"
click node_chatui "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/pages/student/ChatBot.jsx"
click node_games "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/pages/student/GamesPage.jsx"
click node_counsellorui "https://github.com/aayushshirode2060/mindwell/tree/main/client/src/pages/counsellor"
click node_volunteerui "https://github.com/aayushshirode2060/mindwell/tree/main/client/src/pages/volunteer"
click node_adminui "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/pages/admin/AdminDashboard.jsx"
click node_http "https://github.com/aayushshirode2060/mindwell/blob/main/server/server.js"
click node_authroutes "https://github.com/aayushshirode2060/mindwell/blob/main/server/routes/auth.js"
click node_chatroutes "https://github.com/aayushshirode2060/mindwell/blob/main/server/routes/chat.js"
click node_domainroutes "https://github.com/aayushshirode2060/mindwell/tree/main/server/routes"
click node_authcontroller "https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/authController.js"
click node_chatcontroller "https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/chatController.js"
click node_appointmentlogic "https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/appointmentController.js"
click node_resourcelogic "https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/resourceController.js"
click node_adminlogic "https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/adminController.js"
click node_store "https://github.com/aayushshirode2060/mindwell/tree/main/server/models"
click node_ml "https://github.com/aayushshirode2060/mindwell/blob/main/ml-service/app.py"
click node_email "https://github.com/aayushshirode2060/mindwell/blob/main/server/services/emailService.js"
click node_whatsapp "https://github.com/aayushshirode2060/mindwell/blob/main/server/services/whatsappService.js"
click node_socket "https://github.com/aayushshirode2060/mindwell/blob/main/server/socket/chatSocket.js"
click node_socketclient "https://github.com/aayushshirode2060/mindwell/blob/main/client/src/components/chat/ChatRoom.jsx"

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_webapp,node_auth,node_api toneBlue
class node_studentcare,node_chatui,node_games,node_socketclient toneAmber
class node_counsellorui,node_volunteerui,node_adminui toneMint
class node_http,node_authroutes,node_chatroutes,node_domainroutes,node_authcontroller,node_chatcontroller,node_appointmentlogic,node_resourcelogic,node_adminlogic,node_store,node_socket toneRose
class node_ml,node_genai,node_email,node_whatsapp,node_student,node_counsellor,node_volunteer,node_admin toneIndigo
```

## Components

### Web experience

- [Role-based portal](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session and roles](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [HTTP API client](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/api/axios.js): `client/src/api/axios.js`

### Student support

- [Student care tools](https://github.com/aayushshirode2060/mindwell/tree/main/client/src/pages/student): `client/src/pages/student`
- [AI chat](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/pages/student/ChatBot.jsx): `client/src/pages/student/ChatBot.jsx`
- [Wellness games](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/pages/student/GamesPage.jsx): `client/src/pages/student/GamesPage.jsx`
- [Chat room UI](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/components/chat/ChatRoom.jsx): `client/src/components/chat/ChatRoom.jsx`

### Care operations

- [Counsellor workspace](https://github.com/aayushshirode2060/mindwell/tree/main/client/src/pages/counsellor): `client/src/pages/counsellor`
- [Volunteer workspace](https://github.com/aayushshirode2060/mindwell/tree/main/client/src/pages/volunteer): `client/src/pages/volunteer`
- [Admin dashboard](https://github.com/aayushshirode2060/mindwell/blob/main/client/src/pages/admin/AdminDashboard.jsx): `client/src/pages/admin/AdminDashboard.jsx`

### Backend services

- [Express API](https://github.com/aayushshirode2060/mindwell/blob/main/server/server.js): `server/server.js`
- [Authentication routes](https://github.com/aayushshirode2060/mindwell/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [Chat routes](https://github.com/aayushshirode2060/mindwell/blob/main/server/routes/chat.js): `server/routes/chat.js`
- [Domain routes](https://github.com/aayushshirode2060/mindwell/tree/main/server/routes): `server/routes`
- [Authentication logic](https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [AI chat and triage](https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/chatController.js): `server/controllers/chatController.js`
- [Appointment management](https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/appointmentController.js): `server/controllers/appointmentController.js`
- [Resource recommendations](https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/resourceController.js): `server/controllers/resourceController.js`
- [Administration and analytics](https://github.com/aayushshirode2060/mindwell/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`
- [MongoDB records](https://github.com/aayushshirode2060/mindwell/tree/main/server/models): `server/models`
- [Realtime chat](https://github.com/aayushshirode2060/mindwell/blob/main/server/socket/chatSocket.js): `server/socket/chatSocket.js`

### External systems

- [Mood classifier API](https://github.com/aayushshirode2060/mindwell/blob/main/ml-service/app.py): `ml-service/app.py`
- **Generative AI**
- [Email delivery](https://github.com/aayushshirode2060/mindwell/blob/main/server/services/emailService.js): `server/services/emailService.js`
- [WhatsApp alerts](https://github.com/aayushshirode2060/mindwell/blob/main/server/services/whatsappService.js): `server/services/whatsappService.js`

### Other components

- **Student**
- **Counsellor**
- **Volunteer**
- **Administrator**

## Connections

- Student → Role-based portal: opens portal
- Counsellor → Role-based portal: opens portal
- Volunteer → Role-based portal: opens portal
- Administrator → Role-based portal: opens portal
- Role-based portal → Session and roles: checks identity
- Role-based portal → Student care tools: routes students
- Role-based portal → Counsellor workspace: routes counsellors
- Role-based portal → Volunteer workspace: routes volunteers
- Role-based portal → Admin dashboard: routes admins
- Student care tools → HTTP API client: requests services
- AI chat → HTTP API client: sends chat
- Wellness games → HTTP API client: requests game data
- Counsellor workspace → HTTP API client: requests services
- Volunteer workspace → HTTP API client: requests services
- Admin dashboard → HTTP API client: requests services
- HTTP API client → Express API: sends API requests
- Express API → Authentication routes: mounts routes
- Express API → Chat routes: mounts routes
- Express API → Domain routes: mounts routes
- Authentication routes → Authentication logic: dispatches
- Chat routes → AI chat and triage: dispatches
- AI chat and triage → Mood classifier API: classifies text
- AI chat and triage → Generative AI: generates reply
- AI chat and triage → MongoDB records: reads and writes
- AI chat and triage → Email delivery: sends crisis alert
- AI chat and triage → WhatsApp alerts: sends crisis alert
- Authentication logic → MongoDB records: reads and writes
- Authentication logic → Email delivery: sends verification
- Domain routes → Appointment management: dispatches appointments
- Domain routes → Resource recommendations: dispatches resources
- Domain routes → Administration and analytics: dispatches administration
- Appointment management → MongoDB records: reads and writes
- Appointment management → Email delivery: sends confirmations
- Resource recommendations → MongoDB records: reads and writes
- Administration and analytics → MongoDB records: queries records
- Chat room UI → Realtime chat: exchanges messages
