# nforfavour/smartbank-queue-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/nforfavour/smartbank-queue-management-system
- Repository: https://github.com/nforfavour/smartbank-queue-management-system

## Overview

SmartBank is a role-based digital bank queue: customers register, choose a service, preview and accept a FIFO ticket or book an appointment, then track status; staff call and serve customers, while admins manage services and review activity and statistics. The backend exposes these workflows through Express routes, with SQLite for durable records and per-service in-memory FIFO queues. The README documents live polling and email verification, but the frontend call wiring and mailer integration are not established by the excerpts, so those links are marked unverified.

Main entry points: [`backend/server.js`](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/server.js) (Express Application), [`backend/db/db.js`](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/db/db.js) (SQLite Records), [`backend/queue/queueManager.js`](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/queue/queueManager.js) (Queue Manager), [`frontend/js/api.js`](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/js/api.js) (API Session Helper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Role Interfaces"]
  node_customer["Customer Portal<br/>[customer.html]"]
  node_staff["Staff Dashboard<br/>[staff.html]"]
  node_adminui["Admin Dashboard<br/>[admin.html]"]
  node_loginui["Login and Registration<br/>[index.html]"]
  node_apihelper["API Session Helper<br/>[api.js]"]
end

subgraph group_api["API Workflows"]
  node_server["Express Application<br/>[server.js]"]
  node_authroute["Account Access<br/>[auth.js]"]
  node_serviceroute["Service Management<br/>[services.js]"]
  node_queueroute["Ticket and Staff Actions<br/>[queue.js]"]
  node_appointments["Appointment Booking<br/>[appointments.js]"]
  node_adminroute["Admin Analytics<br/>[admin.js]"]
  node_mailer["Verification Email<br/>[mailer.js]"]
end

subgraph group_queue["Queue Runtime"]
  node_queue_manager["Queue Manager<br/>[queueManager.js]"]
  node_fifo["FIFO Structure<br/>[FIFOQueue.js]"]
end

subgraph group_core["Identity and Data"]
  node_authmw["JWT Authorization<br/>[auth.js]"]
  node_database[("SQLite Records<br/>[db.js]")]
end

node_customer_actor(("Customer"))
node_staff_actor(("Bank Staff"))
node_admin_actor(("Bank Admin"))

node_customer_actor -->|"uses"| node_customer
node_staff_actor -->|"uses"| node_staff
node_admin_actor -->|"uses"| node_adminui
node_customer_actor -->|"registers"| node_loginui
node_customer -->|"uses"| node_apihelper
node_staff -->|"uses"| node_apihelper
node_adminui -->|"uses"| node_apihelper
node_loginui -->|"uses"| node_apihelper
node_apihelper -.->|"requests API"| node_server
node_server -->|"mounts"| node_authroute
node_server -->|"mounts"| node_serviceroute
node_server -->|"mounts"| node_queueroute
node_server -->|"mounts"| node_appointments
node_server -->|"mounts"| node_adminroute
node_server -->|"rebuilds at startup"| node_queue_manager
node_authroute -->|"reads and writes"| node_database
node_authroute -->|"authenticates profile"| node_authmw
node_serviceroute -->|"reads and writes"| node_database
node_serviceroute -->|"guards admin actions"| node_authmw
node_queueroute -->|"reads and writes"| node_database
node_queueroute -->|"guards actions"| node_authmw
node_queueroute -->|"manages tickets"| node_queue_manager
node_appointments -->|"reads and writes"| node_database
node_appointments -->|"guards customer actions"| node_authmw
node_appointments -->|"creates check-in ticket"| node_queue_manager
node_adminroute -->|"queries records"| node_database
node_adminroute -->|"requires admin"| node_authmw
node_queue_manager -->|"maintains queues"| node_fifo
node_queue_manager -->|"restores waiting tickets"| node_database
node_authroute -.->|"may send verification"| node_mailer

click node_customer "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/customer.html"
click node_staff "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/staff.html"
click node_adminui "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/admin.html"
click node_loginui "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/index.html"
click node_apihelper "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/js/api.js"
click node_server "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/server.js"
click node_authroute "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/auth.js"
click node_serviceroute "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/services.js"
click node_queueroute "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/queue.js"
click node_appointments "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/appointments.js"
click node_adminroute "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/admin.js"
click node_queue_manager "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/queue/queueManager.js"
click node_fifo "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/queue/FIFOQueue.js"
click node_mailer "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/utils/mailer.js"
click node_authmw "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/middleware/auth.js"
click node_database "https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/db/db.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_customer,node_staff,node_adminui,node_loginui,node_apihelper toneBlue
class node_server,node_authroute,node_serviceroute,node_queueroute,node_appointments,node_adminroute,node_mailer toneAmber
class node_queue_manager,node_fifo toneMint
class node_authmw,node_database toneRose
class node_customer_actor,node_staff_actor,node_admin_actor toneIndigo
```

## Components

### Role Interfaces

- [Customer Portal](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/customer.html): `frontend/customer.html`
- [Staff Dashboard](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/staff.html): `frontend/staff.html`
- [Admin Dashboard](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/admin.html): `frontend/admin.html`
- [Login and Registration](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/index.html): `frontend/index.html`
- [API Session Helper](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/frontend/js/api.js): `frontend/js/api.js`

### API Workflows

- [Express Application](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/server.js): `backend/server.js`
- [Account Access](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Service Management](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/services.js): `backend/routes/services.js`
- [Ticket and Staff Actions](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/queue.js): `backend/routes/queue.js`
- [Appointment Booking](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/appointments.js): `backend/routes/appointments.js`
- [Admin Analytics](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/routes/admin.js): `backend/routes/admin.js`
- [Verification Email](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/utils/mailer.js): `backend/utils/mailer.js`

### Queue Runtime

- [Queue Manager](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/queue/queueManager.js): `backend/queue/queueManager.js`
- [FIFO Structure](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/queue/FIFOQueue.js): `backend/queue/FIFOQueue.js`

### Identity and Data

- [JWT Authorization](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [SQLite Records](https://github.com/nforfavour/smartbank-queue-management-system/blob/main/backend/db/db.js): `backend/db/db.js`

### Other components

- **Customer**
- **Bank Staff**
- **Bank Admin**

## Connections

- Customer → Customer Portal: uses (evidence: `README.md`)
- Bank Staff → Staff Dashboard: uses (evidence: `README.md`)
- Bank Admin → Admin Dashboard: uses (evidence: `README.md`)
- Customer → Login and Registration: registers (evidence: `README.md`)
- Customer Portal → API Session Helper: uses (evidence: `README.md`)
- Staff Dashboard → API Session Helper: uses (evidence: `README.md`)
- Admin Dashboard → API Session Helper: uses (evidence: `README.md`)
- Login and Registration → API Session Helper: uses (evidence: `README.md`)
- API Session Helper → Express Application: requests API
- Express Application → Account Access: mounts (evidence: `backend/server.js`)
- Express Application → Service Management: mounts (evidence: `backend/server.js`)
- Express Application → Ticket and Staff Actions: mounts (evidence: `backend/server.js`)
- Express Application → Appointment Booking: mounts (evidence: `backend/server.js`)
- Express Application → Admin Analytics: mounts (evidence: `backend/server.js`)
- Express Application → Queue Manager: rebuilds at startup (evidence: `backend/server.js`)
- Account Access → SQLite Records: reads and writes (evidence: `backend/routes/auth.js`)
- Account Access → JWT Authorization: authenticates profile (evidence: `backend/routes/auth.js`)
- Service Management → SQLite Records: reads and writes (evidence: `backend/routes/services.js`)
- Service Management → JWT Authorization: guards admin actions (evidence: `backend/routes/services.js`)
- Ticket and Staff Actions → SQLite Records: reads and writes (evidence: `backend/routes/queue.js`)
- Ticket and Staff Actions → JWT Authorization: guards actions (evidence: `backend/routes/queue.js`)
- Ticket and Staff Actions → Queue Manager: manages tickets (evidence: `backend/routes/queue.js`)
- Appointment Booking → SQLite Records: reads and writes (evidence: `backend/routes/appointments.js`)
- Appointment Booking → JWT Authorization: guards customer actions (evidence: `backend/routes/appointments.js`)
- Appointment Booking → Queue Manager: creates check-in ticket (evidence: `backend/routes/appointments.js`)
- Admin Analytics → SQLite Records: queries records (evidence: `backend/routes/admin.js`)
- Admin Analytics → JWT Authorization: requires admin (evidence: `backend/routes/admin.js`)
- Queue Manager → FIFO Structure: maintains queues (evidence: `backend/queue/queueManager.js`)
- Queue Manager → SQLite Records: restores waiting tickets (evidence: `backend/queue/queueManager.js`)
- Account Access → Verification Email: may send verification (evidence: `README.md`)
