# dungngo2612/hk1_2627_cloud architecture

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

- Interactive diagram: https://gitdiagram.com/dungngo2612/hk1_2627_cloud
- Repository: https://github.com/dungngo2612/hk1_2627_cloud

## Overview

EquipmentDesk is a Flask app for shared equipment inventory and multi-item borrowing, operated through Vietnamese web pages or a session-authenticated API. Users sign in, find or maintain equipment, create a loan that marks devices borrowed, then return the full loan to restore availability; loan attachments are stored locally. The graph preserves authentication, inventory, loan, attachment, health, and shared persistence responsibilities. README documents API and health capabilities whose implementation was not fully sampled, so uncertain internal wiring is omitted.

Main entry points: [`equipmentdesk/blueprints/equipment/__init__.py`](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/equipment/__init__.py) (Equipment pages), [`equipmentdesk/blueprints/auth/__init__.py`](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/auth/__init__.py) (Login routes), [`equipmentdesk/blueprints/loans/__init__.py`](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/loans/__init__.py) (Loan pages), [`equipmentdesk/services/loans.py`](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/loans.py) (Loan service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web and API"]
  node_web["Web routes"]
  node_api["API routes"]
  node_auth_routes["Login routes<br/>[__init__.py]"]
  node_equipment_routes["Equipment pages<br/>[__init__.py]"]
  node_loan_routes["Loan pages<br/>[__init__.py]"]
  node_api_loans["Loan API<br/>[loans.py]"]
  node_api_attachments["Attachment API<br/>[attachments.py]"]
  node_main_routes["Home redirect<br/>[__init__.py]"]
  node_health["Health checks<br/>[__init__.py]"]
end

subgraph group_domain["Equipment and loans"]
  node_equipment_service["Inventory service<br/>[equipment.py]"]
  node_loan_service["Loan service<br/>[loans.py]"]
end

subgraph group_files["Loan attachments"]
  node_attachment_service["Attachment service<br/>[attachments.py]"]
  node_storage["Local file storage<br/>[local.py]"]
end

subgraph group_core["Shared application core"]
  node_auth_service["Authentication<br/>[auth.py]"]
  node_forms["Request forms"]
  node_templates["HTML views"]
  node_http["HTTP controls<br/>[http.py]"]
  node_models["Domain records<br/>[records.py]"]
end

node_user(("Operator"))
node_database[("PostgreSQL")]
node_local_files[("Upload directory")]

node_user -->|"signs in"| node_auth_routes
node_auth_routes -->|"validates form"| node_forms
node_auth_routes -->|"authenticates"| node_auth_service
node_auth_service -->|"queries users"| node_database
node_user -->|"browses inventory"| node_equipment_routes
node_equipment_routes -->|"validates input"| node_forms
node_equipment_routes -->|"lists and edits"| node_equipment_service
node_user -->|"manages loans"| node_loan_routes
node_loan_routes -->|"validates input"| node_forms
node_loan_routes -->|"creates and returns"| node_loan_service
node_user -->|"uses API"| node_api
node_api_loans -->|"creates and returns"| node_loan_service
node_api_attachments -->|"manages files"| node_attachment_service
node_loan_service -->|"reads and writes"| node_database
node_equipment_service -->|"reads and writes"| node_database
node_auth_service -->|"uses user records"| node_models
node_equipment_service -->|"uses equipment records"| node_models
node_loan_service -->|"uses loan records"| node_models
node_attachment_service -->|"reads and writes metadata"| node_database
node_attachment_service -->|"saves and reads"| node_storage
node_storage -->|"reads and writes"| node_local_files
node_main_routes -->|"redirects home"| node_equipment_routes
node_health -->|"checks readiness"| node_database
node_health -->|"probes readiness"| node_storage
node_web -->|"uses access controls"| node_http
node_api -->|"uses access controls"| node_http
node_equipment_routes -->|"renders pages"| node_templates
node_loan_routes -->|"renders pages"| node_templates
node_auth_routes -->|"renders pages"| node_templates

click node_web "https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/blueprints"
click node_api "https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/blueprints/api"
click node_auth_routes "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/auth/__init__.py"
click node_equipment_routes "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/equipment/__init__.py"
click node_loan_routes "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/loans/__init__.py"
click node_api_loans "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/api/loans.py"
click node_api_attachments "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/api/attachments.py"
click node_main_routes "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/main/__init__.py"
click node_health "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/health/__init__.py"
click node_auth_service "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/auth.py"
click node_equipment_service "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/equipment.py"
click node_loan_service "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/loans.py"
click node_attachment_service "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/attachments.py"
click node_storage "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/storage/local.py"
click node_forms "https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/forms"
click node_templates "https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/templates"
click node_http "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/http.py"
click node_models "https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/models/records.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_web,node_api,node_auth_routes,node_equipment_routes,node_loan_routes,node_api_loans,node_api_attachments,node_main_routes,node_health toneBlue
class node_equipment_service,node_loan_service,node_database,node_local_files toneAmber
class node_attachment_service,node_storage toneMint
class node_auth_service,node_forms,node_templates,node_http,node_models toneRose
class node_user toneIndigo
```

## Components

### Web and API

- [Web routes](https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/blueprints): `equipmentdesk/blueprints`
- [API routes](https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/blueprints/api): `equipmentdesk/blueprints/api`
- [Login routes](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/auth/__init__.py): `equipmentdesk/blueprints/auth/__init__.py`
- [Equipment pages](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/equipment/__init__.py): `equipmentdesk/blueprints/equipment/__init__.py`
- [Loan pages](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/loans/__init__.py): `equipmentdesk/blueprints/loans/__init__.py`
- [Loan API](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/api/loans.py): `equipmentdesk/blueprints/api/loans.py`
- [Attachment API](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/api/attachments.py): `equipmentdesk/blueprints/api/attachments.py`
- [Home redirect](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/main/__init__.py): `equipmentdesk/blueprints/main/__init__.py`
- [Health checks](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/blueprints/health/__init__.py): `equipmentdesk/blueprints/health/__init__.py`

### Equipment and loans

- [Inventory service](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/equipment.py): `equipmentdesk/services/equipment.py`
- [Loan service](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/loans.py): `equipmentdesk/services/loans.py`

### Loan attachments

- [Attachment service](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/attachments.py): `equipmentdesk/services/attachments.py`
- [Local file storage](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/storage/local.py): `equipmentdesk/storage/local.py`

### Shared application core

- [Authentication](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/services/auth.py): `equipmentdesk/services/auth.py`
- [Request forms](https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/forms): `equipmentdesk/forms`
- [HTML views](https://github.com/dungngo2612/hk1_2627_cloud/tree/main/equipmentdesk/templates): `equipmentdesk/templates`
- [HTTP controls](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/http.py): `equipmentdesk/http.py`
- [Domain records](https://github.com/dungngo2612/hk1_2627_cloud/blob/main/equipmentdesk/models/records.py): `equipmentdesk/models/records.py`

### Other components

- **Operator**
- **PostgreSQL**
- **Upload directory**

## Connections

- Operator → Login routes: signs in
- Login routes → Request forms: validates form
- Login routes → Authentication: authenticates
- Authentication → PostgreSQL: queries users
- Operator → Equipment pages: browses inventory
- Equipment pages → Request forms: validates input
- Equipment pages → Inventory service: lists and edits
- Operator → Loan pages: manages loans
- Loan pages → Request forms: validates input
- Loan pages → Loan service: creates and returns
- Operator → API routes: uses API
- Loan API → Loan service: creates and returns
- Attachment API → Attachment service: manages files
- Loan service → PostgreSQL: reads and writes
- Inventory service → PostgreSQL: reads and writes
- Authentication → Domain records: uses user records
- Inventory service → Domain records: uses equipment records
- Loan service → Domain records: uses loan records
- Attachment service → PostgreSQL: reads and writes metadata
- Attachment service → Local file storage: saves and reads
- Local file storage → Upload directory: reads and writes
- Home redirect → Equipment pages: redirects home
- Health checks → PostgreSQL: checks readiness
- Health checks → Local file storage: probes readiness
- Web routes → HTTP controls: uses access controls
- API routes → HTTP controls: uses access controls
- Equipment pages → HTML views: renders pages
- Loan pages → HTML views: renders pages
- Login routes → HTML views: renders pages
