# nurdauletqwe/endterm architecture

> Architecture diagram of the GitHub repository nurdauletqwe/endterm, 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/nurdauletqwe/endterm
- Repository: https://github.com/nurdauletqwe/endterm

## Overview

DocRequest is a Flask/PostgreSQL university document-request service. Students register or sign in, submit requests, track status, and may cancel new requests; staff review and filter requests, update statuses and pickup details, and view statistics. Ready requests trigger email notification, while a separate cabinet simulator reports IoT events to the application. The sampled `main.py` combines routing, business logic, and database access, so these are logical responsibilities within one source file, not separate implementation modules. Unsampled capabilities are included where the README documents them.

Main entry points: [`main.py`](https://github.com/nurdauletqwe/endterm/blob/main/main.py) (Flask application), [`schema.sql`](https://github.com/nurdauletqwe/endterm/blob/main/schema.sql) (PostgreSQL data), [`mailer.py`](https://github.com/nurdauletqwe/endterm/blob/main/mailer.py) (Email delivery), [`simulate_lockers.py`](https://github.com/nurdauletqwe/endterm/blob/main/simulate_lockers.py) (Cabinet simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_accounts["Accounts and requests"]
  node_account_access["Registration and login<br/>[main.py]"]
  node_request_intake["Request submission<br/>[main.py]"]
  node_student_tracking["Status and cancellation<br/>[main.py]"]
end

subgraph group_staff["Staff operations"]
  node_staff_queue["Request list and filters<br/>[main.py]"]
  node_status_handling["Status and pickup updates<br/>[main.py]"]
  node_staff_insights["Request statistics<br/>[main.py]"]
end

subgraph group_platform["Application and storage"]
  node_web_app["Flask application<br/>[main.py]"]
  node_request_store[("PostgreSQL data<br/>[schema.sql]")]
end

subgraph group_pickup["Notifications and pickup"]
  node_mail_delivery["Email delivery<br/>[mailer.py]"]
  node_locker_simulator["Cabinet simulator"]
  node_cabinet_api["Cabinet event API<br/>[main.py]"]
  node_locker_state["Cabinet state and events<br/>[main.py]"]
end

node_student(("Student"))
node_staff_user(("Dean's office staff"))
node_mail_provider["Brevo or SMTP"]
node_iot_device(("Smart cabinet device"))

node_student -->|"uses"| node_web_app
node_staff_user -->|"uses"| node_web_app
node_web_app -->|"routes"| node_account_access
node_web_app -->|"routes"| node_request_intake
node_web_app -->|"routes"| node_student_tracking
node_web_app -->|"routes"| node_staff_queue
node_web_app -->|"routes"| node_status_handling
node_web_app -->|"routes"| node_staff_insights
node_account_access -->|"reads and writes"| node_request_store
node_request_intake -->|"creates requests"| node_request_store
node_student_tracking -->|"reads and updates"| node_request_store
node_staff_queue -->|"reads requests"| node_request_store
node_status_handling -->|"updates requests"| node_request_store
node_staff_insights -->|"queries statistics"| node_request_store
node_status_handling -->|"notifies when ready"| node_mail_delivery
node_mail_delivery -->|"sends email"| node_mail_provider
node_locker_simulator -->|"posts events"| node_cabinet_api
node_iot_device -->|"reports events"| node_cabinet_api
node_cabinet_api -->|"records events"| node_request_store
node_locker_state -->|"reads event state"| node_request_store
node_staff_user -->|"views cabinets"| node_locker_state

click node_account_access "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_request_intake "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_student_tracking "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_staff_queue "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_status_handling "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_staff_insights "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_web_app "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_request_store "https://github.com/nurdauletqwe/endterm/blob/main/schema.sql"
click node_mail_delivery "https://github.com/nurdauletqwe/endterm/blob/main/mailer.py"
click node_locker_simulator "https://github.com/nurdauletqwe/endterm/blob/main/simulate_lockers.py"
click node_cabinet_api "https://github.com/nurdauletqwe/endterm/blob/main/main.py"
click node_locker_state "https://github.com/nurdauletqwe/endterm/blob/main/main.py"

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_account_access,node_request_intake,node_student_tracking toneBlue
class node_staff_queue,node_status_handling,node_staff_insights toneAmber
class node_web_app,node_request_store toneMint
class node_mail_delivery,node_locker_simulator,node_cabinet_api,node_locker_state toneRose
class node_student,node_staff_user,node_mail_provider,node_iot_device toneIndigo
```

## Components

### Accounts and requests

- [Registration and login](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`
- [Request submission](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`
- [Status and cancellation](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`

### Staff operations

- [Request list and filters](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`
- [Status and pickup updates](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`
- [Request statistics](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`

### Application and storage

- [Flask application](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`
- [PostgreSQL data](https://github.com/nurdauletqwe/endterm/blob/main/schema.sql): `schema.sql`

### Notifications and pickup

- [Email delivery](https://github.com/nurdauletqwe/endterm/blob/main/mailer.py): `mailer.py`
- [Cabinet simulator](https://github.com/nurdauletqwe/endterm/blob/main/simulate_lockers.py): `simulate_lockers.py`
- [Cabinet event API](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`
- [Cabinet state and events](https://github.com/nurdauletqwe/endterm/blob/main/main.py): `main.py`

### Other components

- **Student**
- **Dean's office staff**
- **Brevo or SMTP**
- **Smart cabinet device**

## Connections

- Student → Flask application: uses (evidence: `README.md`)
- Dean's office staff → Flask application: uses (evidence: `README.md`)
- Flask application → Registration and login: routes (evidence: `main.py`)
- Flask application → Request submission: routes (evidence: `main.py`)
- Flask application → Status and cancellation: routes (evidence: `README.md`)
- Flask application → Request list and filters: routes (evidence: `main.py`)
- Flask application → Status and pickup updates: routes (evidence: `main.py`)
- Flask application → Request statistics: routes (evidence: `README.md`)
- Registration and login → PostgreSQL data: reads and writes (evidence: `main.py`)
- Request submission → PostgreSQL data: creates requests (evidence: `main.py`)
- Status and cancellation → PostgreSQL data: reads and updates (evidence: `main.py`)
- Request list and filters → PostgreSQL data: reads requests (evidence: `main.py`)
- Status and pickup updates → PostgreSQL data: updates requests (evidence: `main.py`)
- Request statistics → PostgreSQL data: queries statistics (evidence: `README.md`)
- Status and pickup updates → Email delivery: notifies when ready (evidence: `README.md`)
- Email delivery → Brevo or SMTP: sends email (evidence: `README.md`)
- Cabinet simulator → Cabinet event API: posts events (evidence: `simulate_lockers.py`)
- Smart cabinet device → Cabinet event API: reports events (evidence: `README.md`)
- Cabinet event API → PostgreSQL data: records events (evidence: `main.py`)
- Cabinet state and events → PostgreSQL data: reads event state (evidence: `main.py`)
- Dean's office staff → Cabinet state and events: views cabinets (evidence: `README.md`)
