# dannyplusplus12/pbl2 architecture

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

- Interactive diagram: https://gitdiagram.com/dannyplusplus12/pbl2
- Repository: https://github.com/dannyplusplus12/pbl2

## Overview

This is a Qt 6 library-management desktop application. Staff use the dashboard for statistics and overdue borrowers, the borrow/return screen to manage customer loans, and management tabs to maintain books, authors, and genres. The GUI shares a Library business layer, which keeps in-memory records, applies loan and catalog rules, and persists data to text files. The sampled code confirms startup loading and management-page behavior; several screen-to-backend links are documented capabilities but their implementations were not shown, so those links are marked unverified.

Main entry points: [`backend/Library.h`](https://github.com/dannyplusplus12/pbl2/blob/main/backend/Library.h) (Library Rules), [`frontend/MainWindow.cpp`](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/MainWindow.cpp) (Main Window), [`frontend/ManagementPage.cpp`](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/ManagementPage.cpp) (Catalog Management), [`frontend/main.cpp`](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/main.cpp) (Application Startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_startup["Application Startup<br/>[main.cpp]"]
  node_window["Main Window<br/>[MainWindow.cpp]"]
  node_dashboard["Dashboard<br/>[DashboardPage.cpp]"]
  node_loanscreen["Borrow Return"]
  node_cart["Borrow Cart"]
  node_management["Catalog Management<br/>[ManagementPage.cpp]"]
  node_bookdialog["Book Entry"]
  node_namedialog["Name Entry<br/>[NameDialog.cpp]"]
end

subgraph group_business["Library Services"]
  node_library["Library Rules<br/>[Library.h]"]
  node_dateutils["Date Utilities<br/>[DateUtils.h]"]
  node_datautils["Collection Utilities<br/>[utils.h]"]
end

subgraph group_domain["Domain Records"]
  node_book["Book Records<br/>[Book.h]"]
  node_borrow["Loan Records<br/>[Borrow.h]"]
  node_customer["Customer Records<br/>[Customer.h]"]
  node_catalogrecords["Author Genre Records<br/>[Author.h]"]
  node_entity["Shared Entity<br/>[Entity.h]"]
  node_list["Record Collections<br/>[List.h]"]
end

subgraph group_persistence["Local Persistence"]
  node_files[("Data Files")]
end

node_staff(("Library Staff"))

node_staff -->|"uses"| node_window
node_startup -->|"loads data"| node_library
node_startup -->|"locks overdue"| node_library
node_startup -->|"opens"| node_window
node_window -->|"shows"| node_dashboard
node_window -->|"shows"| node_loanscreen
node_window -->|"shows"| node_management
node_loanscreen -->|"opens"| node_cart
node_management -->|"queries and updates"| node_library
node_management -->|"opens"| node_bookdialog
node_management -->|"opens"| node_namedialog
node_dashboard -.->|"reads statistics"| node_library
node_loanscreen -.->|"manages loans"| node_library
node_cart -.->|"submits loan actions"| node_library
node_bookdialog -.->|"updates books"| node_library
node_library -->|"uses dates"| node_dateutils
node_library -->|"manages"| node_book
node_library -->|"manages"| node_borrow
node_library -->|"manages"| node_customer
node_library -->|"manages"| node_catalogrecords
node_library -->|"reads and writes"| node_files
node_book -->|"extends"| node_entity
node_catalogrecords -->|"extends"| node_entity
node_borrow -->|"uses parsing helpers"| node_datautils
node_book -->|"stores genres in"| node_list
node_borrow -->|"loads as collection"| node_list

click node_startup "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/main.cpp"
click node_window "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/MainWindow.cpp"
click node_dashboard "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/DashboardPage.cpp"
click node_loanscreen "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/BorrowReturnPage.cpp"
click node_cart "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/BorrowCartDialog.cpp"
click node_management "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/ManagementPage.cpp"
click node_bookdialog "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/BookEntryDialog.cpp"
click node_namedialog "https://github.com/dannyplusplus12/pbl2/blob/main/frontend/NameDialog.cpp"
click node_library "https://github.com/dannyplusplus12/pbl2/blob/main/backend/Library.h"
click node_dateutils "https://github.com/dannyplusplus12/pbl2/blob/main/backend/DateUtils.h"
click node_datautils "https://github.com/dannyplusplus12/pbl2/blob/main/backend/utils.h"
click node_book "https://github.com/dannyplusplus12/pbl2/blob/main/models/Book.h"
click node_borrow "https://github.com/dannyplusplus12/pbl2/blob/main/models/Borrow.h"
click node_customer "https://github.com/dannyplusplus12/pbl2/blob/main/models/Customer.h"
click node_catalogrecords "https://github.com/dannyplusplus12/pbl2/blob/main/models/Author.h"
click node_entity "https://github.com/dannyplusplus12/pbl2/blob/main/models/Entity.h"
click node_list "https://github.com/dannyplusplus12/pbl2/blob/main/models/List.h"
click node_files "https://github.com/dannyplusplus12/pbl2/tree/main/Data"

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_startup,node_window,node_dashboard,node_loanscreen,node_cart,node_management,node_bookdialog,node_namedialog toneBlue
class node_library,node_dateutils,node_datautils toneAmber
class node_book,node_borrow,node_customer,node_catalogrecords,node_entity,node_list toneMint
class node_files toneRose
class node_staff toneIndigo
```

## Components

### Application UI

- [Application Startup](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/main.cpp): `frontend/main.cpp`
- [Main Window](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/MainWindow.cpp): `frontend/MainWindow.cpp`
- [Dashboard](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/DashboardPage.cpp): `frontend/DashboardPage.cpp`
- [Borrow Return](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/BorrowReturnPage.cpp): `frontend/BorrowReturnPage.cpp`
- [Borrow Cart](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/BorrowCartDialog.cpp): `frontend/BorrowCartDialog.cpp`
- [Catalog Management](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/ManagementPage.cpp): `frontend/ManagementPage.cpp`
- [Book Entry](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/BookEntryDialog.cpp): `frontend/BookEntryDialog.cpp`
- [Name Entry](https://github.com/dannyplusplus12/pbl2/blob/main/frontend/NameDialog.cpp): `frontend/NameDialog.cpp`

### Library Services

- [Library Rules](https://github.com/dannyplusplus12/pbl2/blob/main/backend/Library.h): `backend/Library.h`
- [Date Utilities](https://github.com/dannyplusplus12/pbl2/blob/main/backend/DateUtils.h): `backend/DateUtils.h`
- [Collection Utilities](https://github.com/dannyplusplus12/pbl2/blob/main/backend/utils.h): `backend/utils.h`

### Domain Records

- [Book Records](https://github.com/dannyplusplus12/pbl2/blob/main/models/Book.h): `models/Book.h`
- [Loan Records](https://github.com/dannyplusplus12/pbl2/blob/main/models/Borrow.h): `models/Borrow.h`
- [Customer Records](https://github.com/dannyplusplus12/pbl2/blob/main/models/Customer.h): `models/Customer.h`
- [Author Genre Records](https://github.com/dannyplusplus12/pbl2/blob/main/models/Author.h): `models/Author.h`
- [Shared Entity](https://github.com/dannyplusplus12/pbl2/blob/main/models/Entity.h): `models/Entity.h`
- [Record Collections](https://github.com/dannyplusplus12/pbl2/blob/main/models/List.h): `models/List.h`

### Local Persistence

- [Data Files](https://github.com/dannyplusplus12/pbl2/tree/main/Data): `Data`

### Other components

- **Library Staff**

## Connections

- Library Staff → Main Window: uses (evidence: `README.md`)
- Application Startup → Library Rules: loads data (evidence: `frontend/main.cpp`)
- Application Startup → Library Rules: locks overdue (evidence: `frontend/main.cpp`)
- Application Startup → Main Window: opens (evidence: `frontend/main.cpp`)
- Main Window → Dashboard: shows (evidence: `frontend/MainWindow.cpp`)
- Main Window → Borrow Return: shows (evidence: `frontend/MainWindow.cpp`)
- Main Window → Catalog Management: shows (evidence: `frontend/MainWindow.cpp`)
- Borrow Return → Borrow Cart: opens (evidence: `frontend/BorrowReturnPage.cpp`)
- Catalog Management → Library Rules: queries and updates (evidence: `frontend/ManagementPage.cpp`)
- Catalog Management → Book Entry: opens (evidence: `frontend/ManagementPage.cpp`)
- Catalog Management → Name Entry: opens (evidence: `frontend/ManagementPage.cpp`)
- Dashboard → Library Rules: reads statistics
- Borrow Return → Library Rules: manages loans
- Borrow Cart → Library Rules: submits loan actions
- Book Entry → Library Rules: updates books
- Library Rules → Date Utilities: uses dates (evidence: `backend/Library.h`)
- Library Rules → Book Records: manages (evidence: `backend/Library.h`)
- Library Rules → Loan Records: manages (evidence: `backend/Library.h`)
- Library Rules → Customer Records: manages (evidence: `backend/Library.h`)
- Library Rules → Author Genre Records: manages (evidence: `backend/Library.h`)
- Library Rules → Data Files: reads and writes (evidence: `backend/Library.h`)
- Book Records → Shared Entity: extends (evidence: `models/Book.h`)
- Author Genre Records → Shared Entity: extends (evidence: `models/Author.h`)
- Loan Records → Collection Utilities: uses parsing helpers (evidence: `models/Borrow.h`)
- Book Records → Record Collections: stores genres in (evidence: `models/Book.h`)
- Loan Records → Record Collections: loads as collection (evidence: `models/Borrow.h`)
