# nguyenvantai2006/kypm architecture

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

- Interactive diagram: https://gitdiagram.com/nguyenvantai2006/kypm
- Repository: https://github.com/nguyenvantai2006/kypm

## Overview

This is a Vietnamese Swing application for managing a shoe shop. Staff sign in, then use permission-filtered navigation to manage catalog and customers, process sales and purchasing, handle returns and warranty, and review reports. The visible architecture separates Swing screens, business services, and JDBC data access over SQL Server. The tree documents additional operational areas, but their internal calls are not sampled; those branches are shown at the screen level without guessed service or DAO wiring.

Main entry points: [`src/main/java/com/qlgiay/gui/frame/MainFrame.java`](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/frame/MainFrame.java) (Main navigation), [`src/main/java/com/qlgiay/bus/AuthBUS.java`](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/bus/AuthBUS.java) (Authentication), [`src/main/java/com/qlgiay/gui/frame/LoginFrame.java`](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/frame/LoginFrame.java) (Login screen), [`src/main/java/com/qlgiay/util/DBConnect.java`](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/util/DBConnect.java) (JDBC connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_app["Application startup<br/>[App.java]"]
  node_session["Authenticated session<br/>[AuthSession.java]"]
end

subgraph group_ui["Shop interface"]
  node_login["Login screen<br/>[LoginFrame.java]"]
  node_mainframe["Main navigation<br/>[MainFrame.java]"]
  node_sales["Point of sale<br/>[BanHangPanel.java]"]
  node_catalog["Catalog management<br/>[SanPhamPanel.java]"]
  node_purchase["Purchasing and supplier returns<br/>[NhapHangPanel.java]"]
  node_customers["Customer management"]
  node_returns["Returns and exchanges<br/>[DoiTraPanel.java]"]
  node_warranty["Warranty management<br/>[BaoHanhPanel.java]"]
  node_reports["Reports<br/>[ThongKePanel.java]"]
end

subgraph group_business["Business services"]
  node_auth["Authentication<br/>[AuthBUS.java]"]
  node_products["Product service<br/>[SanPhamBUS.java]"]
end

subgraph group_persistence["Data access"]
  node_employees["Employee data<br/>[NhanVienDAO.java]"]
  node_permissions["Permission data<br/>[QuyenDAO.java]"]
  node_productdao["Product records<br/>[SanPhamDAO.java]"]
  node_database[("SQL Server database")]
  node_dbconnect["JDBC connection<br/>[DBConnect.java]"]
  node_statisticsdao["Statistics queries<br/>[ThongKeDAO.java]"]
end

node_staff(("Shop staff"))

node_staff -->|"enters credentials"| node_login
node_app -->|"opens"| node_login
node_login -->|"requests login"| node_auth
node_auth -->|"looks up account"| node_employees
node_auth -->|"loads role"| node_permissions
node_auth -->|"creates session"| node_session
node_login -->|"opens on success"| node_mainframe
node_session -->|"supplies role"| node_mainframe
node_mainframe -->|"navigates"| node_sales
node_mainframe -->|"navigates"| node_catalog
node_mainframe -->|"navigates"| node_purchase
node_mainframe -->|"navigates"| node_customers
node_mainframe -->|"navigates"| node_returns
node_mainframe -->|"navigates"| node_warranty
node_mainframe -->|"navigates"| node_reports
node_catalog -->|"manages products"| node_products
node_products -->|"queries records"| node_productdao
node_productdao -->|"opens connection"| node_dbconnect
node_statisticsdao -->|"opens connection"| node_dbconnect
node_dbconnect -->|"connects"| node_database
node_reports -->|"requests report data"| node_statisticsdao

click node_app "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/main/App.java"
click node_login "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/frame/LoginFrame.java"
click node_auth "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/bus/AuthBUS.java"
click node_employees "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/NhanVienDAO.java"
click node_permissions "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/QuyenDAO.java"
click node_session "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dto/AuthSession.java"
click node_mainframe "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/frame/MainFrame.java"
click node_sales "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/BanHangPanel.java"
click node_catalog "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/SanPhamPanel.java"
click node_products "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/bus/SanPhamBUS.java"
click node_productdao "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/SanPhamDAO.java"
click node_purchase "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/NhapHangPanel.java"
click node_customers "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/KhachHangPanel.java"
click node_returns "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/DoiTraPanel.java"
click node_warranty "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/BaoHanhPanel.java"
click node_reports "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/ThongKePanel.java"
click node_dbconnect "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/util/DBConnect.java"
click node_statisticsdao "https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/ThongKeDAO.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_app,node_session toneBlue
class node_login,node_mainframe,node_sales,node_catalog,node_purchase,node_customers,node_returns,node_warranty,node_reports toneAmber
class node_auth,node_products toneMint
class node_employees,node_permissions,node_productdao,node_database,node_dbconnect,node_statisticsdao toneRose
class node_staff toneIndigo
```

## Components

### Entry and access

- [Application startup](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/main/App.java): `src/main/java/com/qlgiay/main/App.java`
- [Authenticated session](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dto/AuthSession.java): `src/main/java/com/qlgiay/dto/AuthSession.java`

### Shop interface

- [Login screen](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/frame/LoginFrame.java): `src/main/java/com/qlgiay/gui/frame/LoginFrame.java`
- [Main navigation](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/frame/MainFrame.java): `src/main/java/com/qlgiay/gui/frame/MainFrame.java`
- [Point of sale](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/BanHangPanel.java): `src/main/java/com/qlgiay/gui/panel/BanHangPanel.java`
- [Catalog management](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/SanPhamPanel.java): `src/main/java/com/qlgiay/gui/panel/SanPhamPanel.java`
- [Purchasing and supplier returns](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/NhapHangPanel.java): `src/main/java/com/qlgiay/gui/panel/NhapHangPanel.java`
- [Customer management](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/KhachHangPanel.java): `src/main/java/com/qlgiay/gui/panel/KhachHangPanel.java`
- [Returns and exchanges](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/DoiTraPanel.java): `src/main/java/com/qlgiay/gui/panel/DoiTraPanel.java`
- [Warranty management](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/BaoHanhPanel.java): `src/main/java/com/qlgiay/gui/panel/BaoHanhPanel.java`
- [Reports](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/gui/panel/ThongKePanel.java): `src/main/java/com/qlgiay/gui/panel/ThongKePanel.java`

### Business services

- [Authentication](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/bus/AuthBUS.java): `src/main/java/com/qlgiay/bus/AuthBUS.java`
- [Product service](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/bus/SanPhamBUS.java): `src/main/java/com/qlgiay/bus/SanPhamBUS.java`

### Data access

- [Employee data](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/NhanVienDAO.java): `src/main/java/com/qlgiay/dao/NhanVienDAO.java`
- [Permission data](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/QuyenDAO.java): `src/main/java/com/qlgiay/dao/QuyenDAO.java`
- [Product records](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/SanPhamDAO.java): `src/main/java/com/qlgiay/dao/SanPhamDAO.java`
- **SQL Server database**
- [JDBC connection](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/util/DBConnect.java): `src/main/java/com/qlgiay/util/DBConnect.java`
- [Statistics queries](https://github.com/nguyenvantai2006/kypm/blob/main/src/main/java/com/qlgiay/dao/ThongKeDAO.java): `src/main/java/com/qlgiay/dao/ThongKeDAO.java`

### Other components

- **Shop staff**

## Connections

- Shop staff → Login screen: enters credentials
- Application startup → Login screen: opens
- Login screen → Authentication: requests login
- Authentication → Employee data: looks up account
- Authentication → Permission data: loads role
- Authentication → Authenticated session: creates session
- Login screen → Main navigation: opens on success
- Authenticated session → Main navigation: supplies role
- Main navigation → Point of sale: navigates
- Main navigation → Catalog management: navigates
- Main navigation → Purchasing and supplier returns: navigates
- Main navigation → Customer management: navigates
- Main navigation → Returns and exchanges: navigates
- Main navigation → Warranty management: navigates
- Main navigation → Reports: navigates
- Catalog management → Product service: manages products
- Product service → Product records: queries records
- Product records → JDBC connection: opens connection
- Statistics queries → JDBC connection: opens connection
- JDBC connection → SQL Server database: connects
- Reports → Statistics queries: requests report data
