# thanhtuanfptse05/lms-library_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/thanhtuanfptse05/lms-library_management_system
- Repository: https://github.com/thanhtuanfptse05/lms-library_management_system

## Overview

LMS is a Java Servlet/JDBC monolith for university library operations. The primary workflow runs from a browser request through authentication and a servlet to business logic and persistent data, with a rendered response. Distinct domain stages include catalog and inventory, circulation and reservations, fines and payments, and administration/reporting; AI and email are supporting capabilities. Relationships follow the README’s MVC description and the cited source-index references; several controller and integration details are documented but their implementation was not sampled.

Main entry points: [`src/java/dao`](https://github.com/thanhtuanfptse05/lms-library_management_system/tree/main/src/java/dao) (Library data access), [`src/java/controllers/LoginServlet.java`](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/LoginServlet.java) (Login and SSO), [`src/java/controllers/SePayWebhookServlet.java`](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/SePayWebhookServlet.java) (Fines and payments), [`src/java/filter/AuthFilter.java`](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/filter/AuthFilter.java) (Authentication filter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry and identity"]
  node_filter["Authentication filter<br/>[AuthFilter.java]"]
  node_auth["Authentication service<br/>[AuthService.java]"]
  node_authctl["Login and SSO<br/>[LoginServlet.java]"]
end

subgraph group_library["Library operations"]
  node_catalog["Catalog and discovery"]
  node_booksvc["Book management<br/>[BookService.java]"]
  node_inventory["Copy inventory"]
  node_circulation["Circulation and reservations"]
  node_desk["Desk circulation"]
  node_finance["Fines and payments"]
  node_ai["AI recommendations and chat"]
end

subgraph group_admin["Administration and insight"]
  node_adminctl["Admin and reports"]
  node_audit["Audit logging<br/>[AuditLogDAO.java]"]
end

subgraph group_platform["Persistence and messaging"]
  node_data["Library data access"]
  node_dbconn["JDBC connection"]
  node_email["Email delivery<br/>[EmailService.java]"]
end

subgraph group_integrations["External integrations"]
  node_postgres[("Supabase PostgreSQL")]
  node_sepay["SePay webhook service"]
  node_gemini["Gemini API"]
  node_mailhost["SendGrid or SMTP"]
  node_google["Google OAuth"]
end

node_browser(("Browser users"))

node_browser -->|"sends request"| node_filter
node_filter -->|"authorizes routes"| node_authctl
node_filter -->|"checks identity"| node_auth
node_authctl -->|"authenticates"| node_auth
node_authctl -.->|"uses OAuth"| node_google
node_authctl -->|"returns view"| node_browser
node_browser -->|"requests discovery"| node_catalog
node_catalog -->|"requests book operations"| node_booksvc
node_booksvc -->|"accesses catalog"| node_data
node_browser -->|"requests reconciliation"| node_inventory
node_inventory -->|"reads and updates stock"| node_data
node_browser -->|"requests online circulation"| node_circulation
node_browser -->|"requests desk service"| node_desk
node_desk -->|"updates circulation records"| node_data
node_circulation -->|"updates circulation records"| node_data
node_browser -->|"initiates payment"| node_finance
node_sepay -->|"posts payment event"| node_finance
node_finance -->|"records payment"| node_data
node_browser -.->|"requests AI assistance"| node_ai
node_ai -.->|"calls model"| node_gemini
node_browser -->|"requests management"| node_adminctl
node_adminctl -.->|"records administrative activity"| node_audit
node_data -->|"obtains JDBC connections"| node_dbconn
node_dbconn -->|"connects via JDBC"| node_postgres
node_desk -->|"queues notices"| node_email
node_finance -->|"queues payment notice"| node_email
node_email -->|"sends email"| node_mailhost

click node_filter "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/filter/AuthFilter.java"
click node_auth "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/AuthService.java"
click node_authctl "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/LoginServlet.java"
click node_catalog "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/BookSearchServlet.java"
click node_booksvc "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/BookService.java"
click node_inventory "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/InventoryReconciliationService.java"
click node_circulation "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/OnlineCirculationService.java"
click node_desk "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/DeskCirculationService.java"
click node_finance "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/SePayWebhookServlet.java"
click node_ai "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/AiChatbotService.java"
click node_adminctl "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/AdminDashboardServlet.java"
click node_audit "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/dao/AuditLogDAO.java"
click node_data "https://github.com/thanhtuanfptse05/lms-library_management_system/tree/main/src/java/dao"
click node_dbconn "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/util/DatabaseConnection.java"
click node_email "https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/EmailService.java"

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_filter,node_auth,node_authctl,node_browser toneBlue
class node_catalog,node_booksvc,node_inventory,node_circulation,node_desk,node_finance,node_ai toneAmber
class node_adminctl,node_audit toneMint
class node_data,node_dbconn,node_email toneRose
class node_postgres,node_sepay,node_gemini,node_mailhost,node_google toneIndigo
```

## Components

### Web entry and identity

- [Authentication filter](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/filter/AuthFilter.java): `src/java/filter/AuthFilter.java`
- [Authentication service](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/AuthService.java): `src/java/service/AuthService.java`
- [Login and SSO](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/LoginServlet.java): `src/java/controllers/LoginServlet.java`

### Library operations

- [Catalog and discovery](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/BookSearchServlet.java): `src/java/controllers/BookSearchServlet.java`
- [Book management](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/BookService.java): `src/java/service/BookService.java`
- [Copy inventory](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/InventoryReconciliationService.java): `src/java/service/InventoryReconciliationService.java`
- [Circulation and reservations](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/OnlineCirculationService.java): `src/java/service/OnlineCirculationService.java`
- [Desk circulation](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/DeskCirculationService.java): `src/java/service/DeskCirculationService.java`
- [Fines and payments](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/SePayWebhookServlet.java): `src/java/controllers/SePayWebhookServlet.java`
- [AI recommendations and chat](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/AiChatbotService.java): `src/java/service/AiChatbotService.java`

### Administration and insight

- [Admin and reports](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/controllers/AdminDashboardServlet.java): `src/java/controllers/AdminDashboardServlet.java`
- [Audit logging](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/dao/AuditLogDAO.java): `src/java/dao/AuditLogDAO.java`

### Persistence and messaging

- [Library data access](https://github.com/thanhtuanfptse05/lms-library_management_system/tree/main/src/java/dao): `src/java/dao`
- [JDBC connection](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/util/DatabaseConnection.java): `src/java/util/DatabaseConnection.java`
- [Email delivery](https://github.com/thanhtuanfptse05/lms-library_management_system/blob/main/src/java/service/EmailService.java): `src/java/service/EmailService.java`

### External integrations

- **Supabase PostgreSQL**
- **SePay webhook service**
- **Gemini API**
- **SendGrid or SMTP**
- **Google OAuth**

### Other components

- **Browser users**

## Connections

- Browser users → Authentication filter: sends request
- Authentication filter → Login and SSO: authorizes routes
- Authentication filter → Authentication service: checks identity (evidence: `src/java/filter/AuthFilter.java`)
- Login and SSO → Authentication service: authenticates
- Login and SSO → Google OAuth: uses OAuth
- Login and SSO → Browser users: returns view
- Browser users → Catalog and discovery: requests discovery
- Catalog and discovery → Book management: requests book operations
- Book management → Library data access: accesses catalog
- Browser users → Copy inventory: requests reconciliation
- Copy inventory → Library data access: reads and updates stock (evidence: `src/java/service/InventoryReconciliationService.java`)
- Browser users → Circulation and reservations: requests online circulation
- Browser users → Desk circulation: requests desk service
- Desk circulation → Library data access: updates circulation records (evidence: `src/java/service/DeskCirculationService.java`)
- Circulation and reservations → Library data access: updates circulation records (evidence: `src/java/service/OnlineCirculationService.java`)
- Browser users → Fines and payments: initiates payment
- SePay webhook service → Fines and payments: posts payment event
- Fines and payments → Library data access: records payment (evidence: `src/java/controllers/SePayWebhookServlet.java`)
- Browser users → AI recommendations and chat: requests AI assistance
- AI recommendations and chat → Gemini API: calls model
- Browser users → Admin and reports: requests management
- Admin and reports → Audit logging: records administrative activity
- Library data access → JDBC connection: obtains JDBC connections (evidence: `src/java/dao/UserDAO.java`)
- JDBC connection → Supabase PostgreSQL: connects via JDBC
- Desk circulation → Email delivery: queues notices (evidence: `src/java/service/DeskCirculationService.java`)
- Fines and payments → Email delivery: queues payment notice (evidence: `src/java/controllers/SePayWebhookServlet.java`)
- Email delivery → SendGrid or SMTP: sends email (evidence: `src/java/service/EmailService.java`)
