# jshmlnd/ust-legazpi-mhss architecture

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

- Interactive diagram: https://gitdiagram.com/jshmlnd/ust-legazpi-mhss
- Repository: https://github.com/jshmlnd/ust-legazpi-mhss

## Overview

This is a semi-anonymous university counseling and wellbeing application for students, counselors, and administrators. Users authenticate and enter role-specific experiences; students can find resources, use self-care and diary features, request counseling, and communicate with counselors through messaging and voice sessions. Counselors manage appointments, availability, and announcements, while administrators register users. The graph combines documented capabilities with sampled routing, API, persistence, and socket evidence; several feature-to-backend connections are dashed because their implementation was not sampled.

Main entry points: [`frontend/src/App.jsx`](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/App.jsx) (Role-based app), [`backend/src/socket/socket.js`](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/socket/socket.js) (Realtime sessions), [`backend/src/controllers/appointment.controller.js`](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/appointment.controller.js) (Appointment handling), [`frontend/src/store/useChatStore.js`](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/store/useChatStore.js) (Chat state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_webapp["Role-based app<br/>[App.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_authui["Authentication UI<br/>[LoginPage.jsx]"]
  node_authstate["Auth state<br/>[useAuthStore.js]"]
  node_authapi["Authentication API<br/>[auth.controller.js]"]
  node_accountstore[("User and counselor records<br/>[user.model.js]")]
end

subgraph group_counseling["Counseling services"]
  node_sessionsui["Session booking<br/>[SessionsPage.jsx]"]
  node_appointments["Appointment handling"]
  node_appointmentstore[("Appointment records")]
  node_chatui["Chat experience<br/>[ChatPage.jsx]"]
  node_chatstate["Chat state<br/>[useChatStore.js]"]
  node_messages["Message handling"]
  node_messagestore[("Messages<br/>[message.model.js]")]
  node_realtime["Realtime sessions<br/>[socket.js]"]
  node_voice["Voice calls<br/>[VoiceCallModal.jsx]"]
end

subgraph group_wellbeing["Wellbeing and resources"]
  node_diary["Mood diary<br/>[YourDiary.jsx]"]
  node_selfcare["Self-care library<br/>[SelfCarePage.jsx]"]
  node_resources["Resource mapping<br/>[ResourcePage.jsx]"]
  node_resourceapi["Resource handling"]
  node_resourcestore[("Resource records<br/>[resource.model.js]")]
end

subgraph group_operations["Campus operations"]
  node_announcements["Announcements"]
  node_announcementapi["Announcement handling"]
  node_announcementstore[("Announcement records")]
  node_availability["Counselor availability"]
  node_reminders["Session reminders<br/>[reminders.js]"]
  node_suggestions["Help desk"]
  node_adminui["Administration<br/>[Administrator.jsx]"]
end

node_student(("Student"))
node_counselor(("Counselor"))
node_administrator(("Administrator"))

node_student -->|"uses"| node_webapp
node_counselor -->|"uses"| node_webapp
node_administrator -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_authui
node_authui -.->|"submits credentials"| node_authstate
node_authstate -->|"posts login"| node_authapi
node_authapi -->|"checks accounts"| node_accountstore
node_webapp -->|"routes to"| node_sessionsui
node_sessionsui -.->|"requests sessions"| node_appointments
node_appointments -->|"reads and writes"| node_appointmentstore
node_appointments -->|"emits updates"| node_realtime
node_webapp -->|"routes to"| node_chatui
node_chatui -.->|"uses state"| node_chatstate
node_chatstate -->|"posts messages"| node_messages
node_messages -->|"reads and writes"| node_messagestore
node_chatstate -->|"emits events"| node_realtime
node_webapp -.->|"connects socket"| node_realtime
node_webapp -->|"shows call UI"| node_voice
node_voice -.->|"coordinates calls"| node_realtime
node_webapp -->|"routes to"| node_diary
node_webapp -->|"routes to"| node_selfcare
node_webapp -->|"routes to"| node_resources
node_resources -.->|"manages resources"| node_resourceapi
node_resourceapi -->|"reads and writes"| node_resourcestore
node_counselor -.->|"manages updates"| node_announcements
node_announcements -->|"sends requests"| node_announcementapi
node_announcementapi -->|"reads and writes"| node_announcementstore
node_counselor -.->|"sets availability"| node_availability
node_reminders -.->|"checks sessions"| node_appointmentstore
node_webapp -->|"routes to"| node_suggestions
node_administrator -->|"registers users"| node_adminui

click node_webapp "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/App.jsx"
click node_authui "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/LoginPage.jsx"
click node_authstate "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/store/useAuthStore.js"
click node_authapi "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/auth.controller.js"
click node_accountstore "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/user.model.js"
click node_sessionsui "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/SessionsPage.jsx"
click node_appointments "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/appointment.controller.js"
click node_appointmentstore "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/appointment.model.js"
click node_chatui "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/ChatPage.jsx"
click node_chatstate "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/store/useChatStore.js"
click node_messages "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/message.controller.js"
click node_messagestore "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/message.model.js"
click node_realtime "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/socket/socket.js"
click node_voice "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/components/VoiceCallModal.jsx"
click node_diary "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/YourDiary.jsx"
click node_selfcare "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/SelfCarePage.jsx"
click node_resources "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/ResourcePage.jsx"
click node_resourceapi "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/resource.controller.js"
click node_resourcestore "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/resource.model.js"
click node_announcements "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/CounselorAnnouncementManagerPage.jsx"
click node_announcementapi "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/announcement.controller.js"
click node_announcementstore "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/announcement.model.js"
click node_availability "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/availability.controller.js"
click node_reminders "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/lib/reminders.js"
click node_suggestions "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/SuggestionsPage.jsx"
click node_adminui "https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/Administrator.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 toneBlue
class node_authui,node_authstate,node_authapi,node_accountstore toneAmber
class node_sessionsui,node_appointments,node_appointmentstore,node_chatui,node_chatstate,node_messages,node_messagestore,node_realtime,node_voice toneMint
class node_diary,node_selfcare,node_resources,node_resourceapi,node_resourcestore toneRose
class node_announcements,node_announcementapi,node_announcementstore,node_availability,node_reminders,node_suggestions,node_adminui,node_student,node_counselor,node_administrator toneIndigo
```

## Components

### Application entry

- [Role-based app](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/App.jsx): `frontend/src/App.jsx`

### Identity and access

- [Authentication UI](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/LoginPage.jsx): `frontend/src/pages/LoginPage.jsx`
- [Auth state](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/store/useAuthStore.js): `frontend/src/store/useAuthStore.js`
- [Authentication API](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [User and counselor records](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/user.model.js): `backend/src/models/user.model.js`

### Counseling services

- [Session booking](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/SessionsPage.jsx): `frontend/src/pages/SessionsPage.jsx`
- [Appointment handling](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/appointment.controller.js): `backend/src/controllers/appointment.controller.js`
- [Appointment records](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/appointment.model.js): `backend/src/models/appointment.model.js`
- [Chat experience](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/ChatPage.jsx): `frontend/src/pages/ChatPage.jsx`
- [Chat state](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/store/useChatStore.js): `frontend/src/store/useChatStore.js`
- [Message handling](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/message.controller.js): `backend/src/controllers/message.controller.js`
- [Messages](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/message.model.js): `backend/src/models/message.model.js`
- [Realtime sessions](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/socket/socket.js): `backend/src/socket/socket.js`
- [Voice calls](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/components/VoiceCallModal.jsx): `frontend/src/components/VoiceCallModal.jsx`

### Wellbeing and resources

- [Mood diary](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/YourDiary.jsx): `frontend/src/pages/YourDiary.jsx`
- [Self-care library](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/SelfCarePage.jsx): `frontend/src/pages/SelfCarePage.jsx`
- [Resource mapping](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/ResourcePage.jsx): `frontend/src/pages/ResourcePage.jsx`
- [Resource handling](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/resource.controller.js): `backend/src/controllers/resource.controller.js`
- [Resource records](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/resource.model.js): `backend/src/models/resource.model.js`

### Campus operations

- [Announcements](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/CounselorAnnouncementManagerPage.jsx): `frontend/src/pages/CounselorAnnouncementManagerPage.jsx`
- [Announcement handling](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/announcement.controller.js): `backend/src/controllers/announcement.controller.js`
- [Announcement records](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/models/announcement.model.js): `backend/src/models/announcement.model.js`
- [Counselor availability](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/controllers/availability.controller.js): `backend/src/controllers/availability.controller.js`
- [Session reminders](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/backend/src/lib/reminders.js): `backend/src/lib/reminders.js`
- [Help desk](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/SuggestionsPage.jsx): `frontend/src/pages/SuggestionsPage.jsx`
- [Administration](https://github.com/jshmlnd/ust-legazpi-mhss/blob/ponytail/frontend/src/pages/Administrator.jsx): `frontend/src/pages/Administrator.jsx`

### Other components

- **Student**
- **Counselor**
- **Administrator**

## Connections

- Student → Role-based app: uses (evidence: `frontend/src/App.jsx`)
- Counselor → Role-based app: uses (evidence: `frontend/src/App.jsx`)
- Administrator → Role-based app: uses (evidence: `frontend/src/App.jsx`)
- Role-based app → Authentication UI: routes to (evidence: `frontend/src/App.jsx`)
- Authentication UI → Auth state: submits credentials
- Auth state → Authentication API: posts login (evidence: `frontend/src/store/useAuthStore.js`)
- Authentication API → User and counselor records: checks accounts (evidence: `backend/src/controllers/auth.controller.js`)
- Role-based app → Session booking: routes to (evidence: `frontend/src/App.jsx`)
- Session booking → Appointment handling: requests sessions
- Appointment handling → Appointment records: reads and writes (evidence: `backend/src/controllers/appointment.controller.js`)
- Appointment handling → Realtime sessions: emits updates (evidence: `backend/src/controllers/appointment.controller.js`)
- Role-based app → Chat experience: routes to (evidence: `frontend/src/App.jsx`)
- Chat experience → Chat state: uses state
- Chat state → Message handling: posts messages (evidence: `frontend/src/store/useChatStore.js`)
- Message handling → Messages: reads and writes (evidence: `backend/src/controllers/message.controller.js`)
- Chat state → Realtime sessions: emits events (evidence: `frontend/src/store/useChatStore.js`)
- Role-based app → Realtime sessions: connects socket
- Role-based app → Voice calls: shows call UI (evidence: `frontend/src/App.jsx`)
- Voice calls → Realtime sessions: coordinates calls
- Role-based app → Mood diary: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Self-care library: routes to (evidence: `frontend/src/App.jsx`)
- Role-based app → Resource mapping: routes to (evidence: `frontend/src/App.jsx`)
- Resource mapping → Resource handling: manages resources
- Resource handling → Resource records: reads and writes (evidence: `backend/src/controllers/resource.controller.js`)
- Counselor → Announcements: manages updates
- Announcements → Announcement handling: sends requests (evidence: `frontend/src/pages/CounselorAnnouncementManagerPage.jsx`)
- Announcement handling → Announcement records: reads and writes (evidence: `backend/src/controllers/announcement.controller.js`)
- Counselor → Counselor availability: sets availability
- Session reminders → Appointment records: checks sessions
- Role-based app → Help desk: routes to (evidence: `frontend/src/App.jsx`)
- Administrator → Administration: registers users
