# shiza176/smart-queue-prediction-system architecture

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

- Interactive diagram: https://gitdiagram.com/shiza176/smart-queue-prediction-system
- Repository: https://github.com/shiza176/smart-queue-prediction-system

## Overview

Smart Queue is a hospital queue-management web app: patients register or log in, select a doctor, book a token, and check queue position and estimated wait; doctors advance or reset queues, while admins manage doctors and patients and view statistics. The Vue client calls an Express API backed by MongoDB, with JWT authentication and role checks protecting operations. The main patient, doctor, and admin workflows are documented; detailed wiring for unsampled views and several backend modules is therefore shown only where supported by the tree and documented capabilities.

Main entry points: [`Queue-management/smart-queue/src/router/index.js`](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/router/index.js) (Role-aware routes), [`Queue-management/smart-queue/src/api/axios.js`](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/api/axios.js) (HTTP client), [`Queue-management/backend-folder/server.js`](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/server.js) (API server), [`Queue-management/backend-folder/routes/adminRoutes.js`](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/adminRoutes.js) (Admin API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Vue client"]
  node_app["App shell<br/>[App.vue]"]
  node_router["Role-aware routes<br/>[index.js]"]
  node_auth_views["Registration and login<br/>[Register.vue]"]
  node_doctor_list["Doctor selection<br/>[DoctorList.vue]"]
  node_booking["Token booking<br/>[BookToken.vue]"]
  node_status["Queue status and wait<br/>[QueueStatus.vue]"]
  node_doctor_dash["Doctor queue controls"]
  node_admin_dash["Admin management<br/>[AdminDashboard.vue]"]
  node_api_client["HTTP client<br/>[axios.js]"]
end

subgraph group_api["Express API"]
  node_server["API server<br/>[server.js]"]
  node_auth_routes["Registration and login API<br/>[authRoutes.js]"]
  node_doctor_routes["Doctor and queue API<br/>[doctorRoutes.js]"]
  node_token_routes["Token booking and status API<br/>[tokenRoutes.js]"]
  node_admin_routes["Admin API<br/>[adminRoutes.js]"]
end

subgraph group_security["Identity and access"]
  node_auth_middleware["JWT verification<br/>[auth.js]"]
  node_role_middleware["Role authorization<br/>[role.js]"]
  node_jwt_generator["JWT creation<br/>[generateToken.js]"]
end

subgraph group_data["MongoDB data"]
  node_db_connect["Database connection<br/>[db.js]"]
  node_patient_model["Patient records<br/>[Patient.js]"]
  node_doctor_model["Doctor records<br/>[Doctor.js]"]
  node_admin_model["Admin records<br/>[Admin.js]"]
  node_token_model["Queue tokens<br/>[Token.js]"]
end

node_patient(("Patient"))
node_doctor_user(("Doctor"))
node_admin_user(("Administrator"))
node_mongo[("MongoDB")]

node_patient -->|"registers or logs in"| node_auth_views
node_patient -->|"browses"| node_doctor_list
node_patient -->|"books token"| node_booking
node_patient -->|"checks queue"| node_status
node_doctor_user -->|"manages queue"| node_doctor_dash
node_admin_user -->|"manages system"| node_admin_dash
node_app -->|"displays routes"| node_router
node_router -->|"selects view"| node_auth_views
node_router -->|"selects view"| node_doctor_list
node_router -->|"selects view"| node_booking
node_router -->|"selects view"| node_status
node_router -->|"selects view"| node_doctor_dash
node_router -->|"selects view"| node_admin_dash
node_auth_views -->|"sends auth requests"| node_api_client
node_doctor_list -->|"requests doctors"| node_api_client
node_booking -->|"books token"| node_api_client
node_status -->|"requests status"| node_api_client
node_doctor_dash -->|"manages queue"| node_api_client
node_admin_dash -->|"manages records"| node_api_client
node_api_client -->|"sends API requests"| node_server
node_server -->|"dispatches"| node_auth_routes
node_server -->|"dispatches"| node_doctor_routes
node_server -->|"dispatches"| node_token_routes
node_server -->|"dispatches"| node_admin_routes
node_auth_routes -->|"reads and writes"| node_patient_model
node_auth_routes -->|"reads"| node_doctor_model
node_auth_routes -->|"reads"| node_admin_model
node_auth_routes -->|"creates token"| node_jwt_generator
node_doctor_routes -->|"verifies requests"| node_auth_middleware
node_doctor_routes -->|"checks role"| node_role_middleware
node_doctor_routes -->|"reads and updates"| node_doctor_model
node_token_routes -->|"verifies requests"| node_auth_middleware
node_token_routes -->|"checks role"| node_role_middleware
node_token_routes -->|"reads doctor queue"| node_doctor_model
node_token_routes -->|"creates and reads"| node_token_model
node_admin_routes -->|"verifies requests"| node_auth_middleware
node_admin_routes -->|"checks role"| node_role_middleware
node_admin_routes -->|"reads and deletes"| node_patient_model
node_admin_routes -->|"reads statistics"| node_doctor_model
node_admin_routes -->|"counts bookings"| node_token_model
node_auth_middleware -->|"verifies issued tokens"| node_jwt_generator
node_db_connect -->|"connects"| node_mongo
node_patient_model -->|"persists records"| node_mongo
node_doctor_model -->|"persists records"| node_mongo
node_admin_model -->|"persists records"| node_mongo
node_token_model -->|"persists tokens"| node_mongo
node_server -->|"connects database"| node_db_connect

click node_app "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/App.vue"
click node_router "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/router/index.js"
click node_auth_views "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/Register.vue"
click node_doctor_list "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/DoctorList.vue"
click node_booking "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/BookToken.vue"
click node_status "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/QueueStatus.vue"
click node_doctor_dash "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/DoctorDashboard.vue"
click node_admin_dash "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/AdminDashboard.vue"
click node_api_client "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/api/axios.js"
click node_server "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/server.js"
click node_auth_routes "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/authRoutes.js"
click node_doctor_routes "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/doctorRoutes.js"
click node_token_routes "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/tokenRoutes.js"
click node_admin_routes "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/adminRoutes.js"
click node_auth_middleware "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/middleware/auth.js"
click node_role_middleware "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/middleware/role.js"
click node_jwt_generator "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/utils/generateToken.js"
click node_db_connect "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/config/db.js"
click node_patient_model "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Patient.js"
click node_doctor_model "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Doctor.js"
click node_admin_model "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Admin.js"
click node_token_model "https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Token.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_app,node_router,node_auth_views,node_doctor_list,node_booking,node_status,node_doctor_dash,node_admin_dash,node_api_client toneBlue
class node_server,node_auth_routes,node_doctor_routes,node_token_routes,node_admin_routes,node_mongo toneAmber
class node_auth_middleware,node_role_middleware,node_jwt_generator toneMint
class node_db_connect,node_patient_model,node_doctor_model,node_admin_model,node_token_model toneRose
class node_patient,node_doctor_user,node_admin_user toneIndigo
```

## Components

### Vue client

- [App shell](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/App.vue): `Queue-management/smart-queue/src/App.vue`
- [Role-aware routes](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/router/index.js): `Queue-management/smart-queue/src/router/index.js`
- [Registration and login](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/Register.vue): `Queue-management/smart-queue/src/views/Register.vue`
- [Doctor selection](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/DoctorList.vue): `Queue-management/smart-queue/src/views/DoctorList.vue`
- [Token booking](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/BookToken.vue): `Queue-management/smart-queue/src/views/BookToken.vue`
- [Queue status and wait](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/QueueStatus.vue): `Queue-management/smart-queue/src/views/QueueStatus.vue`
- [Doctor queue controls](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/DoctorDashboard.vue): `Queue-management/smart-queue/src/views/DoctorDashboard.vue`
- [Admin management](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/views/AdminDashboard.vue): `Queue-management/smart-queue/src/views/AdminDashboard.vue`
- [HTTP client](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/smart-queue/src/api/axios.js): `Queue-management/smart-queue/src/api/axios.js`

### Express API

- [API server](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/server.js): `Queue-management/backend-folder/server.js`
- [Registration and login API](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/authRoutes.js): `Queue-management/backend-folder/routes/authRoutes.js`
- [Doctor and queue API](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/doctorRoutes.js): `Queue-management/backend-folder/routes/doctorRoutes.js`
- [Token booking and status API](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/tokenRoutes.js): `Queue-management/backend-folder/routes/tokenRoutes.js`
- [Admin API](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/routes/adminRoutes.js): `Queue-management/backend-folder/routes/adminRoutes.js`

### Identity and access

- [JWT verification](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/middleware/auth.js): `Queue-management/backend-folder/middleware/auth.js`
- [Role authorization](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/middleware/role.js): `Queue-management/backend-folder/middleware/role.js`
- [JWT creation](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/utils/generateToken.js): `Queue-management/backend-folder/utils/generateToken.js`

### MongoDB data

- [Database connection](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/config/db.js): `Queue-management/backend-folder/config/db.js`
- [Patient records](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Patient.js): `Queue-management/backend-folder/models/Patient.js`
- [Doctor records](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Doctor.js): `Queue-management/backend-folder/models/Doctor.js`
- [Admin records](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Admin.js): `Queue-management/backend-folder/models/Admin.js`
- [Queue tokens](https://github.com/shiza176/smart-queue-prediction-system/blob/main/Queue-management/backend-folder/models/Token.js): `Queue-management/backend-folder/models/Token.js`

### Other components

- **Patient**
- **Doctor**
- **Administrator**
- **MongoDB**

## Connections

- Patient → Registration and login: registers or logs in
- Patient → Doctor selection: browses
- Patient → Token booking: books token
- Patient → Queue status and wait: checks queue
- Doctor → Doctor queue controls: manages queue
- Administrator → Admin management: manages system
- App shell → Role-aware routes: displays routes
- Role-aware routes → Registration and login: selects view
- Role-aware routes → Doctor selection: selects view
- Role-aware routes → Token booking: selects view
- Role-aware routes → Queue status and wait: selects view
- Role-aware routes → Doctor queue controls: selects view
- Role-aware routes → Admin management: selects view
- Registration and login → HTTP client: sends auth requests
- Doctor selection → HTTP client: requests doctors
- Token booking → HTTP client: books token
- Queue status and wait → HTTP client: requests status
- Doctor queue controls → HTTP client: manages queue
- Admin management → HTTP client: manages records
- HTTP client → API server: sends API requests
- API server → Registration and login API: dispatches
- API server → Doctor and queue API: dispatches
- API server → Token booking and status API: dispatches
- API server → Admin API: dispatches
- Registration and login API → Patient records: reads and writes
- Registration and login API → Doctor records: reads
- Registration and login API → Admin records: reads
- Registration and login API → JWT creation: creates token
- Doctor and queue API → JWT verification: verifies requests
- Doctor and queue API → Role authorization: checks role
- Doctor and queue API → Doctor records: reads and updates
- Token booking and status API → JWT verification: verifies requests
- Token booking and status API → Role authorization: checks role
- Token booking and status API → Doctor records: reads doctor queue
- Token booking and status API → Queue tokens: creates and reads
- Admin API → JWT verification: verifies requests
- Admin API → Role authorization: checks role
- Admin API → Patient records: reads and deletes
- Admin API → Doctor records: reads statistics
- Admin API → Queue tokens: counts bookings
- JWT verification → JWT creation: verifies issued tokens
- Database connection → MongoDB: connects
- Patient records → MongoDB: persists records
- Doctor records → MongoDB: persists records
- Admin records → MongoDB: persists records
- Queue tokens → MongoDB: persists tokens
- API server → Database connection: connects database
