# abdelali-01/printmanagement architecture

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

- Interactive diagram: https://gitdiagram.com/abdelali-01/printmanagement
- Repository: https://github.com/abdelali-01/printmanagement

## Overview

Print Management System coordinates institutional print requests across teachers, departments, printers, and administrators. Users register or accept invitations, verify email, and authenticate; teachers submit requests that move through department approval and printer handling to completion or refusal, while administrators manage users, departments, invitations, costs, and system-wide statistics. The graph combines documented product stages with the sampled Express/Mongoose backend and Redux request path. Several frontend pages and backend controllers were not sampled, so their documented capabilities are included without asserting unverified calls.

Main entry points: [`backend/controllers/authController.js`](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/authController.js) (Registration and sessions), [`frontend/src/app/(dashboard)`](https://github.com/abdelali-01/printmanagement/tree/main/frontend/src/app/(dashboard)) (Role dashboards), [`backend/controllers/invController.js`](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/invController.js) (Invitation management), [`backend/utils/email/emailSender.js`](https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/email/emailSender.js) (Email sender)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_web_roles["Role dashboards"]
  node_web_auth["Login and signup"]
  node_request_state["Request state handlers<br/>[requestHandler.js]"]
  node_invitation_state["Invitation handler"]
  node_statistics_ui["Statistics views<br/>[page.jsx]"]
end

subgraph group_api["API and workflows"]
  node_api_server["Express API<br/>[index.js]"]
  node_department_flow["Department management"]
  node_request_routes["Print request routes<br/>[printRequest.js]"]
  node_request_flow["Request lifecycle"]
  node_statistics_flow["Statistics aggregation"]
  node_user_flow["User management<br/>[userController.js]"]
end

subgraph group_identity["Identity and invitations"]
  node_auth_routes["Authentication routes<br/>[auth.js]"]
  node_auth_flow["Registration and sessions<br/>[authController.js]"]
  node_access_control["Role and verification checks<br/>[auth.js]"]
  node_invitation_flow["Invitation management<br/>[invController.js]"]
end

subgraph group_data["Domain records"]
  node_user_records[("User records<br/>[User.js]")]
  node_department_records[("Department records<br/>[Department.js]")]
  node_faculty_records[("Faculty records<br/>[Faculty.js]")]
  node_invitation_records[("Invitation records<br/>[Invitations.js]")]
  node_request_records[("Print request records<br/>[PrintRequest.js]")]
  node_cost_records[("Cost settings<br/>[CostSettings.js]")]
end

subgraph group_messaging["Email delivery"]
  node_email_templates["Email templates<br/>[emailTemplates.js]"]
  node_email_sender["Email sender<br/>[emailSender.js]"]
end

node_teacher(("Teacher"))
node_department_user(("Department staff"))
node_printer_user(("Printer"))
node_admin_user(("Administrator"))
node_mail_service["Mail service"]

node_teacher -.->|"uses dashboard"| node_web_roles
node_department_user -.->|"uses dashboard"| node_web_roles
node_printer_user -.->|"uses dashboard"| node_web_roles
node_admin_user -.->|"uses dashboard"| node_web_roles
node_web_auth -.->|"authenticates via"| node_auth_routes
node_web_roles -.->|"manages requests"| node_request_state
node_web_roles -.->|"manages invitations"| node_invitation_state
node_web_roles -.->|"views statistics"| node_statistics_ui
node_invitation_state -->|"calls invitation API"| node_invitation_flow
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_request_routes
node_api_server -->|"mounts routes"| node_department_flow
node_api_server -->|"mounts routes"| node_statistics_flow
node_auth_routes -->|"dispatches to"| node_auth_flow
node_auth_routes -->|"checks verification"| node_access_control
node_request_routes -->|"dispatches to"| node_request_flow
node_auth_flow -->|"reads and writes"| node_user_records
node_auth_flow -->|"uses department"| node_department_records
node_auth_flow -->|"uses faculty"| node_faculty_records
node_auth_flow -->|"checks invitations"| node_invitation_records
node_access_control -->|"looks up user"| node_user_records
node_invitation_flow -->|"manages records"| node_invitation_records
node_invitation_flow -->|"looks up department"| node_department_records
node_invitation_flow -->|"looks up faculty"| node_faculty_records
node_invitation_flow -->|"checks existing users"| node_user_records
node_department_flow -->|"manages records"| node_department_records
node_department_flow -->|"manages members"| node_user_records
node_department_flow -->|"uses invitations"| node_invitation_records
node_request_flow -->|"manages requests"| node_request_records
node_request_flow -->|"loads department"| node_department_records
node_request_flow -->|"sends status mail"| node_email_sender
node_auth_flow -->|"sends verification mail"| node_email_sender
node_access_control -->|"sends verification mail"| node_email_sender
node_invitation_flow -->|"sends invitations"| node_email_sender
node_department_flow -->|"sends invitations"| node_email_sender
node_request_flow -->|"renders mail"| node_email_templates
node_auth_flow -->|"renders mail"| node_email_templates
node_email_sender -->|"delivers email"| node_mail_service
node_statistics_flow -->|"aggregates requests"| node_request_records
node_statistics_flow -->|"aggregates departments"| node_department_records
node_statistics_flow -->|"reads cost settings"| node_cost_records
node_user_flow -->|"manages records"| node_user_records

click node_web_roles "https://github.com/abdelali-01/printmanagement/tree/main/frontend/src/app/(dashboard)"
click node_web_auth "https://github.com/abdelali-01/printmanagement/tree/main/frontend/src/app/(auth)"
click node_request_state "https://github.com/abdelali-01/printmanagement/blob/main/frontend/src/store/request/requestHandler.js"
click node_invitation_state "https://github.com/abdelali-01/printmanagement/blob/main/frontend/src/store/invitation/invitationHandler.js"
click node_statistics_ui "https://github.com/abdelali-01/printmanagement/blob/main/frontend/src/app/(dashboard)/admin/(pages)/statistics/page.jsx"
click node_api_server "https://github.com/abdelali-01/printmanagement/blob/main/backend/index.js"
click node_auth_routes "https://github.com/abdelali-01/printmanagement/blob/main/backend/routes/auth.js"
click node_auth_flow "https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/authController.js"
click node_access_control "https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/middelwares/auth.js"
click node_invitation_flow "https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/invController.js"
click node_department_flow "https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/departmentController.js"
click node_request_routes "https://github.com/abdelali-01/printmanagement/blob/main/backend/routes/printRequest.js"
click node_request_flow "https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/printRequestController.js"
click node_statistics_flow "https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/statisticsController.js"
click node_user_flow "https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/userController.js"
click node_user_records "https://github.com/abdelali-01/printmanagement/blob/main/backend/models/User.js"
click node_department_records "https://github.com/abdelali-01/printmanagement/blob/main/backend/models/Department.js"
click node_faculty_records "https://github.com/abdelali-01/printmanagement/blob/main/backend/models/Faculty.js"
click node_invitation_records "https://github.com/abdelali-01/printmanagement/blob/main/backend/models/Invitations.js"
click node_request_records "https://github.com/abdelali-01/printmanagement/blob/main/backend/models/PrintRequest.js"
click node_cost_records "https://github.com/abdelali-01/printmanagement/blob/main/backend/models/CostSettings.js"
click node_email_templates "https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/email/emailTemplates.js"
click node_email_sender "https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/email/emailSender.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_web_roles,node_web_auth,node_request_state,node_invitation_state,node_statistics_ui toneBlue
class node_api_server,node_department_flow,node_request_routes,node_request_flow,node_statistics_flow,node_user_flow toneAmber
class node_auth_routes,node_auth_flow,node_access_control,node_invitation_flow toneMint
class node_user_records,node_department_records,node_faculty_records,node_invitation_records,node_request_records,node_cost_records toneRose
class node_email_templates,node_email_sender,node_teacher,node_department_user,node_printer_user,node_admin_user,node_mail_service toneIndigo
```

## Components

### Web application

- [Role dashboards](https://github.com/abdelali-01/printmanagement/tree/main/frontend/src/app/(dashboard)): `frontend/src/app/(dashboard)`
- [Login and signup](https://github.com/abdelali-01/printmanagement/tree/main/frontend/src/app/(auth)): `frontend/src/app/(auth)`
- [Request state handlers](https://github.com/abdelali-01/printmanagement/blob/main/frontend/src/store/request/requestHandler.js): `frontend/src/store/request/requestHandler.js`
- [Invitation handler](https://github.com/abdelali-01/printmanagement/blob/main/frontend/src/store/invitation/invitationHandler.js): `frontend/src/store/invitation/invitationHandler.js`
- [Statistics views](https://github.com/abdelali-01/printmanagement/blob/main/frontend/src/app/(dashboard)/admin/(pages)/statistics/page.jsx): `frontend/src/app/(dashboard)/admin/(pages)/statistics/page.jsx`

### API and workflows

- [Express API](https://github.com/abdelali-01/printmanagement/blob/main/backend/index.js): `backend/index.js`
- [Department management](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/departmentController.js): `backend/controllers/departmentController.js`
- [Print request routes](https://github.com/abdelali-01/printmanagement/blob/main/backend/routes/printRequest.js): `backend/routes/printRequest.js`
- [Request lifecycle](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/printRequestController.js): `backend/controllers/printRequestController.js`
- [Statistics aggregation](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/statisticsController.js): `backend/controllers/statisticsController.js`
- [User management](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`

### Identity and invitations

- [Authentication routes](https://github.com/abdelali-01/printmanagement/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [Registration and sessions](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Role and verification checks](https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/middelwares/auth.js): `backend/utils/middelwares/auth.js`
- [Invitation management](https://github.com/abdelali-01/printmanagement/blob/main/backend/controllers/invController.js): `backend/controllers/invController.js`

### Domain records

- [User records](https://github.com/abdelali-01/printmanagement/blob/main/backend/models/User.js): `backend/models/User.js`
- [Department records](https://github.com/abdelali-01/printmanagement/blob/main/backend/models/Department.js): `backend/models/Department.js`
- [Faculty records](https://github.com/abdelali-01/printmanagement/blob/main/backend/models/Faculty.js): `backend/models/Faculty.js`
- [Invitation records](https://github.com/abdelali-01/printmanagement/blob/main/backend/models/Invitations.js): `backend/models/Invitations.js`
- [Print request records](https://github.com/abdelali-01/printmanagement/blob/main/backend/models/PrintRequest.js): `backend/models/PrintRequest.js`
- [Cost settings](https://github.com/abdelali-01/printmanagement/blob/main/backend/models/CostSettings.js): `backend/models/CostSettings.js`

### Email delivery

- [Email templates](https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/email/emailTemplates.js): `backend/utils/email/emailTemplates.js`
- [Email sender](https://github.com/abdelali-01/printmanagement/blob/main/backend/utils/email/emailSender.js): `backend/utils/email/emailSender.js`

### Other components

- **Teacher**
- **Department staff**
- **Printer**
- **Administrator**
- **Mail service**

## Connections

- Teacher → Role dashboards: uses dashboard (evidence: `README.md`)
- Department staff → Role dashboards: uses dashboard (evidence: `README.md`)
- Printer → Role dashboards: uses dashboard (evidence: `README.md`)
- Administrator → Role dashboards: uses dashboard (evidence: `README.md`)
- Login and signup → Authentication routes: authenticates via
- Role dashboards → Request state handlers: manages requests (evidence: `README.md`)
- Role dashboards → Invitation handler: manages invitations (evidence: `README.md`)
- Role dashboards → Statistics views: views statistics (evidence: `README.md`)
- Invitation handler → Invitation management: calls invitation API (evidence: `frontend/src/store/invitation/invitationHandler.js`)
- Express API → Authentication routes: mounts routes (evidence: `backend/index.js`)
- Express API → Print request routes: mounts routes (evidence: `backend/index.js`)
- Express API → Department management: mounts routes (evidence: `backend/index.js`)
- Express API → Statistics aggregation: mounts routes (evidence: `backend/index.js`)
- Authentication routes → Registration and sessions: dispatches to (evidence: `backend/routes/auth.js`)
- Authentication routes → Role and verification checks: checks verification (evidence: `backend/routes/auth.js`)
- Print request routes → Request lifecycle: dispatches to (evidence: `backend/routes/printRequest.js`)
- Registration and sessions → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Registration and sessions → Department records: uses department (evidence: `backend/controllers/authController.js`)
- Registration and sessions → Faculty records: uses faculty (evidence: `backend/controllers/authController.js`)
- Registration and sessions → Invitation records: checks invitations (evidence: `backend/controllers/authController.js`)
- Role and verification checks → User records: looks up user (evidence: `backend/utils/middelwares/auth.js`)
- Invitation management → Invitation records: manages records (evidence: `backend/controllers/invController.js`)
- Invitation management → Department records: looks up department (evidence: `backend/controllers/invController.js`)
- Invitation management → Faculty records: looks up faculty (evidence: `backend/controllers/invController.js`)
- Invitation management → User records: checks existing users (evidence: `backend/controllers/invController.js`)
- Department management → Department records: manages records (evidence: `backend/controllers/departmentController.js`)
- Department management → User records: manages members (evidence: `backend/controllers/departmentController.js`)
- Department management → Invitation records: uses invitations (evidence: `backend/controllers/departmentController.js`)
- Request lifecycle → Print request records: manages requests (evidence: `backend/controllers/printRequestController.js`)
- Request lifecycle → Department records: loads department (evidence: `backend/controllers/printRequestController.js`)
- Request lifecycle → Email sender: sends status mail (evidence: `backend/controllers/printRequestController.js`)
- Registration and sessions → Email sender: sends verification mail (evidence: `backend/controllers/authController.js`)
- Role and verification checks → Email sender: sends verification mail (evidence: `backend/utils/middelwares/auth.js`)
- Invitation management → Email sender: sends invitations (evidence: `backend/controllers/invController.js`)
- Department management → Email sender: sends invitations (evidence: `backend/controllers/departmentController.js`)
- Request lifecycle → Email templates: renders mail (evidence: `backend/controllers/printRequestController.js`)
- Registration and sessions → Email templates: renders mail (evidence: `backend/controllers/authController.js`)
- Email sender → Mail service: delivers email (evidence: `backend/utils/email/emailSender.js`)
- Statistics aggregation → Print request records: aggregates requests (evidence: `backend/controllers/statisticsController.js`)
- Statistics aggregation → Department records: aggregates departments (evidence: `backend/controllers/statisticsController.js`)
- Statistics aggregation → Cost settings: reads cost settings (evidence: `backend/controllers/statisticsController.js`)
- User management → User records: manages records (evidence: `backend/controllers/userController.js`)
