# cubon23/appointment-system architecture

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

- Interactive diagram: https://gitdiagram.com/cubon23/appointment-system
- Repository: https://github.com/cubon23/appointment-system

## Overview

This is a university faculty attendance and consultation portal for students, faculty, deans, and administrators. Users enter through QR or account login, then use role-specific dashboards for attendance/status, schedules, appointments, announcements, and administration. The Express API handles authentication and these domain operations over MongoDB; a scheduled job also updates faculty status. The route file is only partially excerpted, so dashboard-to-API links are shown as unverified; unsampled implementation details are not inferred.

Main entry points: [`backend/routes/faculty.js`](https://github.com/cubon23/appointment-system/blob/main/backend/routes/faculty.js) (Faculty operations API), [`frontend/src/App.tsx`](https://github.com/cubon23/appointment-system/blob/main/frontend/src/App.tsx) (Role routing), [`frontend/src/components/LandingPage.tsx`](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/LandingPage.tsx) (Login and entry), [`backend/server.js`](https://github.com/cubon23/appointment-system/blob/main/backend/server.js) (Express server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_landing["Login and entry<br/>[LandingPage.tsx]"]
  node_router["Role routing<br/>[App.tsx]"]
  node_guard["Role guard<br/>[ProtectedRoute.tsx]"]
  node_student_view["Student dashboard"]
  node_faculty_view["Faculty dashboard"]
  node_admin_view["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_dean_view["Dean dashboard<br/>[DeanDashboard.tsx]"]
  node_cohorts["Cohort configuration<br/>[cohortConfig.ts]"]
end

subgraph group_api["Backend API"]
  node_auth_api["Account and QR auth<br/>[auth.js]"]
  node_faculty_api["Faculty operations API<br/>[faculty.js]"]
  node_auth_middleware["JWT role checks<br/>[auth.js]"]
  node_server["Express server<br/>[server.js]"]
end

subgraph group_data["Domain data"]
  node_users[("User and status<br/>[User.js]")]
  node_appointments[("Consultation appointments<br/>[Appointment.js]")]
  node_schedules[("Teaching schedules<br/>[Schedule.js]")]
  node_announcements[("Announcements<br/>[Announcement.js]")]
  node_consult_hours[("Consultation hours")]
  node_personal_events[("Personal events<br/>[PersonalEvent.js]")]
  node_status_history[("Status history<br/>[StatusHistory.js]")]
  node_time_math["Time conflict logic<br/>[timeMath.js]"]
end

subgraph group_automation["Status automation"]
  node_updater["Scheduled status updater<br/>[statusUpdater.js]"]
end

node_student(("Student"))
node_faculty_actor(("Faculty"))
node_staff_actor(("Dean / admin"))
node_mongo[("MongoDB")]

node_student -->|"starts login"| node_landing
node_faculty_actor -->|"starts login"| node_landing
node_staff_actor -->|"starts login"| node_landing
node_landing -.->|"enters app"| node_router
node_router -->|"checks role"| node_guard
node_router -->|"routes student"| node_student_view
node_router -->|"routes faculty"| node_faculty_view
node_router -->|"routes admin"| node_admin_view
node_router -->|"routes dean"| node_dean_view
node_admin_view -->|"reads config"| node_cohorts
node_landing -->|"reads config"| node_cohorts
node_landing -.->|"submits login"| node_auth_api
node_student_view -.->|"requests portal data"| node_faculty_api
node_faculty_view -.->|"requests portal data"| node_faculty_api
node_admin_view -.->|"requests administration"| node_faculty_api
node_dean_view -.->|"requests portal data"| node_faculty_api
node_server -->|"mounts routes"| node_faculty_api
node_server -->|"mounts routes"| node_auth_api
node_server -->|"starts job"| node_updater
node_auth_api -->|"finds and updates"| node_users
node_faculty_api -->|"queries users"| node_users
node_faculty_api -->|"manages appointments"| node_appointments
node_faculty_api -->|"manages schedules"| node_schedules
node_faculty_api -->|"manages announcements"| node_announcements
node_faculty_api -->|"manages hours"| node_consult_hours
node_faculty_api -->|"manages events"| node_personal_events
node_faculty_api -->|"records status history"| node_status_history
node_faculty_api -->|"checks time conflicts"| node_time_math
node_auth_middleware -.->|"validates roles"| node_users
node_updater -->|"updates status"| node_users
node_server -->|"connects"| node_mongo

click node_landing "https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/LandingPage.tsx"
click node_router "https://github.com/cubon23/appointment-system/blob/main/frontend/src/App.tsx"
click node_guard "https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/ProtectedRoute.tsx"
click node_student_view "https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/StudentDashboard.tsx"
click node_faculty_view "https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/FacultyDashboard.tsx"
click node_admin_view "https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/AdminDashboard.tsx"
click node_dean_view "https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/DeanDashboard.tsx"
click node_cohorts "https://github.com/cubon23/appointment-system/blob/main/frontend/src/data/cohortConfig.ts"
click node_auth_api "https://github.com/cubon23/appointment-system/blob/main/backend/routes/auth.js"
click node_faculty_api "https://github.com/cubon23/appointment-system/blob/main/backend/routes/faculty.js"
click node_auth_middleware "https://github.com/cubon23/appointment-system/blob/main/backend/middleware/auth.js"
click node_users "https://github.com/cubon23/appointment-system/blob/main/backend/models/User.js"
click node_appointments "https://github.com/cubon23/appointment-system/blob/main/backend/models/Appointment.js"
click node_schedules "https://github.com/cubon23/appointment-system/blob/main/backend/models/Schedule.js"
click node_announcements "https://github.com/cubon23/appointment-system/blob/main/backend/models/Announcement.js"
click node_consult_hours "https://github.com/cubon23/appointment-system/blob/main/backend/models/ConsultationHours.js"
click node_personal_events "https://github.com/cubon23/appointment-system/blob/main/backend/models/PersonalEvent.js"
click node_status_history "https://github.com/cubon23/appointment-system/blob/main/backend/models/StatusHistory.js"
click node_time_math "https://github.com/cubon23/appointment-system/blob/main/backend/utils/timeMath.js"
click node_updater "https://github.com/cubon23/appointment-system/blob/main/backend/jobs/statusUpdater.js"
click node_server "https://github.com/cubon23/appointment-system/blob/main/backend/server.js"

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_landing,node_router,node_guard,node_student_view,node_faculty_view,node_admin_view,node_dean_view,node_cohorts toneBlue
class node_auth_api,node_faculty_api,node_auth_middleware,node_server,node_mongo toneAmber
class node_users,node_appointments,node_schedules,node_announcements,node_consult_hours,node_personal_events,node_status_history,node_time_math toneMint
class node_updater toneRose
class node_student,node_faculty_actor,node_staff_actor toneIndigo
```

## Components

### Web experience

- [Login and entry](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/LandingPage.tsx): `frontend/src/components/LandingPage.tsx`
- [Role routing](https://github.com/cubon23/appointment-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Role guard](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/ProtectedRoute.tsx): `frontend/src/components/ProtectedRoute.tsx`
- [Student dashboard](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/StudentDashboard.tsx): `frontend/src/components/StudentDashboard.tsx`
- [Faculty dashboard](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/FacultyDashboard.tsx): `frontend/src/components/FacultyDashboard.tsx`
- [Admin dashboard](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/AdminDashboard.tsx): `frontend/src/components/AdminDashboard.tsx`
- [Dean dashboard](https://github.com/cubon23/appointment-system/blob/main/frontend/src/components/DeanDashboard.tsx): `frontend/src/components/DeanDashboard.tsx`
- [Cohort configuration](https://github.com/cubon23/appointment-system/blob/main/frontend/src/data/cohortConfig.ts): `frontend/src/data/cohortConfig.ts`

### Backend API

- [Account and QR auth](https://github.com/cubon23/appointment-system/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Faculty operations API](https://github.com/cubon23/appointment-system/blob/main/backend/routes/faculty.js): `backend/routes/faculty.js`
- [JWT role checks](https://github.com/cubon23/appointment-system/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Express server](https://github.com/cubon23/appointment-system/blob/main/backend/server.js): `backend/server.js`

### Domain data

- [User and status](https://github.com/cubon23/appointment-system/blob/main/backend/models/User.js): `backend/models/User.js`
- [Consultation appointments](https://github.com/cubon23/appointment-system/blob/main/backend/models/Appointment.js): `backend/models/Appointment.js`
- [Teaching schedules](https://github.com/cubon23/appointment-system/blob/main/backend/models/Schedule.js): `backend/models/Schedule.js`
- [Announcements](https://github.com/cubon23/appointment-system/blob/main/backend/models/Announcement.js): `backend/models/Announcement.js`
- [Consultation hours](https://github.com/cubon23/appointment-system/blob/main/backend/models/ConsultationHours.js): `backend/models/ConsultationHours.js`
- [Personal events](https://github.com/cubon23/appointment-system/blob/main/backend/models/PersonalEvent.js): `backend/models/PersonalEvent.js`
- [Status history](https://github.com/cubon23/appointment-system/blob/main/backend/models/StatusHistory.js): `backend/models/StatusHistory.js`
- [Time conflict logic](https://github.com/cubon23/appointment-system/blob/main/backend/utils/timeMath.js): `backend/utils/timeMath.js`

### Status automation

- [Scheduled status updater](https://github.com/cubon23/appointment-system/blob/main/backend/jobs/statusUpdater.js): `backend/jobs/statusUpdater.js`

### Other components

- **Student**
- **Faculty**
- **Dean / admin**
- **MongoDB**

## Connections

- Student → Login and entry: starts login
- Faculty → Login and entry: starts login
- Dean / admin → Login and entry: starts login
- Login and entry → Role routing: enters app (evidence: `frontend/src/App.tsx`)
- Role routing → Role guard: checks role (evidence: `frontend/src/App.tsx`)
- Role routing → Student dashboard: routes student (evidence: `frontend/src/App.tsx`)
- Role routing → Faculty dashboard: routes faculty (evidence: `frontend/src/App.tsx`)
- Role routing → Admin dashboard: routes admin (evidence: `frontend/src/App.tsx`)
- Role routing → Dean dashboard: routes dean (evidence: `frontend/src/App.tsx`)
- Admin dashboard → Cohort configuration: reads config (evidence: `frontend/src/components/AdminDashboard.tsx`)
- Login and entry → Cohort configuration: reads config (evidence: `frontend/src/components/LandingPage.tsx`)
- Login and entry → Account and QR auth: submits login
- Student dashboard → Faculty operations API: requests portal data
- Faculty dashboard → Faculty operations API: requests portal data
- Admin dashboard → Faculty operations API: requests administration
- Dean dashboard → Faculty operations API: requests portal data
- Express server → Faculty operations API: mounts routes (evidence: `backend/server.js`)
- Express server → Account and QR auth: mounts routes (evidence: `backend/server.js`)
- Express server → Scheduled status updater: starts job (evidence: `backend/server.js`)
- Account and QR auth → User and status: finds and updates (evidence: `backend/routes/auth.js`)
- Faculty operations API → User and status: queries users (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Consultation appointments: manages appointments (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Teaching schedules: manages schedules (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Announcements: manages announcements (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Consultation hours: manages hours (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Personal events: manages events (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Status history: records status history (evidence: `backend/routes/faculty.js`)
- Faculty operations API → Time conflict logic: checks time conflicts (evidence: `backend/routes/faculty.js`)
- JWT role checks → User and status: validates roles
- Scheduled status updater → User and status: updates status (evidence: `backend/jobs/statusUpdater.js`)
- Express server → MongoDB: connects (evidence: `backend/server.js`)
