# pocketlib-devs/pocketlib architecture

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

- Interactive diagram: https://gitdiagram.com/pocketlib-devs/pocketlib
- Repository: https://github.com/pocketlib-devs/pocketlib

## Overview

PocketLib is a Qt Widgets library-management application. The user-facing workflow starts in the main window, where users can authenticate and interact with library features; the app uses Firebase-backed authentication and Firestore data operations. The UI also exposes book discovery, personal saved books, administration, checkout, and fine handling. The excerpts show the app startup, manager initialization, a fine lookup, and portions of the network clients. Other feature links are not drawn where the sampled code does not establish the caller relationship.

Main entry points: [`mainwindow.cpp`](https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp) (Main window), [`auth/AuthManager.cpp`](https://github.com/pocketlib-devs/pocketlib/blob/main/auth/AuthManager.cpp) (Authentication client), [`firestore/FirestoreClient.cpp`](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp) (Fine operations), [`main.cpp`](https://github.com/pocketlib-devs/pocketlib/blob/main/main.cpp) (App startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application UI"]
  node_entry["App startup<br/>[main.cpp]"]
  node_window["Main window<br/>[mainwindow.cpp]"]
  node_discovery["Book discovery<br/>[mainwindow.cpp]"]
  node_saved["Saved books<br/>[mainwindow.cpp]"]
  node_admin["Admin workflows<br/>[mainwindow.cpp]"]
  node_fines["Fine handling<br/>[mainwindow.cpp]"]
end

subgraph group_identity["Identity"]
  node_auth["Authentication client<br/>[AuthManager.cpp]"]
  node_identity_service{{"Firebase Identity"}}
end

subgraph group_library["Library Services"]
  node_catalog["Catalog operations"]
  node_user_records["User records"]
  node_circulation["Checkout operations"]
  node_saved_service["Saved-book operations"]
  node_fine_service["Fine operations"]
  node_image_upload["Cover image upload"]
  node_firestore[("Firestore service")]
  node_cloudinary{{"Cloudinary"}}
end

subgraph group_models["Domain Models"]
  node_book_model["Book model<br/>[Book.h]"]
  node_user_model["User model<br/>[UserInfo.h]"]
end

node_reader(("Library user"))

node_reader -->|"uses"| node_window
node_entry -->|"creates"| node_window
node_window -->|"initializes"| node_auth
node_window -->|"initializes"| node_catalog
node_window -->|"requests fine"| node_fine_service
node_auth -->|"authenticates"| node_identity_service
node_fine_service -->|"reads fine"| node_firestore
node_image_upload -->|"uploads image"| node_cloudinary

click node_entry "https://github.com/pocketlib-devs/pocketlib/blob/main/main.cpp"
click node_window "https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp"
click node_discovery "https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp"
click node_saved "https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp"
click node_admin "https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp"
click node_fines "https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp"
click node_auth "https://github.com/pocketlib-devs/pocketlib/blob/main/auth/AuthManager.cpp"
click node_catalog "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp"
click node_user_records "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp"
click node_circulation "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp"
click node_saved_service "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp"
click node_fine_service "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp"
click node_image_upload "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp"
click node_book_model "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/Book.h"
click node_user_model "https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/UserInfo.h"

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_entry,node_window,node_discovery,node_saved,node_admin,node_fines,node_reader toneBlue
class node_auth,node_identity_service toneAmber
class node_catalog,node_user_records,node_circulation,node_saved_service,node_fine_service,node_image_upload,node_firestore,node_cloudinary toneMint
class node_book_model,node_user_model toneRose
```

## Components

### Application UI

- [App startup](https://github.com/pocketlib-devs/pocketlib/blob/main/main.cpp): `main.cpp`
- [Main window](https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp): `mainwindow.cpp`
- [Book discovery](https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp): `mainwindow.cpp`
- [Saved books](https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp): `mainwindow.cpp`
- [Admin workflows](https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp): `mainwindow.cpp`
- [Fine handling](https://github.com/pocketlib-devs/pocketlib/blob/main/mainwindow.cpp): `mainwindow.cpp`

### Identity

- [Authentication client](https://github.com/pocketlib-devs/pocketlib/blob/main/auth/AuthManager.cpp): `auth/AuthManager.cpp`
- **Firebase Identity**

### Library Services

- [Catalog operations](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp): `firestore/FirestoreClient.cpp`
- [User records](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp): `firestore/FirestoreClient.cpp`
- [Checkout operations](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp): `firestore/FirestoreClient.cpp`
- [Saved-book operations](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp): `firestore/FirestoreClient.cpp`
- [Fine operations](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp): `firestore/FirestoreClient.cpp`
- [Cover image upload](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/FirestoreClient.cpp): `firestore/FirestoreClient.cpp`
- **Firestore service**
- **Cloudinary**

### Domain Models

- [Book model](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/Book.h): `firestore/Book.h`
- [User model](https://github.com/pocketlib-devs/pocketlib/blob/main/firestore/UserInfo.h): `firestore/UserInfo.h`

### Other components

- **Library user**

## Connections

- Library user → Main window: uses
- App startup → Main window: creates (evidence: `main.cpp`)
- Main window → Authentication client: initializes (evidence: `mainwindow.cpp`)
- Main window → Catalog operations: initializes (evidence: `mainwindow.cpp`)
- Main window → Fine operations: requests fine (evidence: `mainwindow.cpp`)
- Authentication client → Firebase Identity: authenticates (evidence: `auth/AuthManager.cpp`)
- Fine operations → Firestore service: reads fine (evidence: `firestore/FirestoreClient.cpp`)
- Cover image upload → Cloudinary: uploads image (evidence: `firestore/FirestoreClient.cpp`)
