# thiennguyen62/project1-hust architecture

> Architecture diagram of the GitHub repository thiennguyen62/project1-hust, 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/thiennguyen62/project1-hust
- Repository: https://github.com/thiennguyen62/project1-hust

## Overview

Project I is a Vietnamese high-school management web app. Users enter through the landing page or sign in, then use the dashboard to manage academic years and related school records; the frontend calls an Express API backed by MySQL. The README documents academic-year creation, editing, filtering, deletion, semester creation, and safeguards for related classes. The graph reflects those documented capabilities and sampled wiring; where source excerpts do not show a specific cross-component call, links are omitted or marked unverified.

Main entry points: [`backend/src/app.js`](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/app.js) (Express app), [`frontend/src/App.jsx`](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/App.jsx) (Page routing), [`frontend/src/Dashboard.jsx`](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/Dashboard.jsx) (Dashboard), [`backend/src/controllers/auth.controller.js`](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/controllers/auth.controller.js) (Authentication controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_landing["Landing pages"]
  node_app["Page routing<br/>[App.jsx]"]
  node_login["Login page<br/>[LoginPage.jsx]"]
  node_authapi["Auth API client<br/>[auth.js]"]
  node_protected["Protected dashboard"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_nav["Dashboard navigation<br/>[Sidebar.jsx]"]
  node_dashpages["Dashboard pages<br/>[DashboardPages.jsx]"]
  node_academicui["Academic-year management"]
  node_semesterui["Semester view<br/>[Semesters.jsx]"]
  node_classui["Classroom management<br/>[ClassroomsPage.jsx]"]
  node_recordsui["School-record interface<br/>[SchoolRecords.jsx]"]
  node_academicapi["Academic-year API client<br/>[academic-years.js]"]
  node_recordsapi["School-record API client<br/>[school-records.js]"]
  node_icon["Shared icons<br/>[Icon.jsx]"]
end

subgraph group_api["Backend API"]
  node_backend["Express app<br/>[app.js]"]
  node_health["Health route<br/>[health.routes.js]"]
  node_authroutes["Authentication routes<br/>[auth.routes.js]"]
  node_authcontroller["Authentication controller<br/>[auth.controller.js]"]
  node_ayroutes["Academic-year routes"]
  node_aycontroller["Academic-year controller"]
  node_recordroutes["School-record routes"]
end

subgraph group_domain["Domain services"]
  node_authservice["Credential verification<br/>[auth.service.js]"]
  node_sessions["Session handling<br/>[session.service.js]"]
  node_ayservice["Academic-year rules"]
  node_semesterservice["Semester rules"]
  node_classservice["Classroom rules"]
end

subgraph group_storage["Persistence"]
  node_ayrepo["Academic-year repository"]
  node_semesterrepo["Semester repository"]
  node_classrepo["Classroom repository"]
  node_accountrepo["Account repository"]
  node_dbconfig["MySQL connection pool<br/>[database.js]"]
end

node_user(("School staff"))
node_browser(("Web browser"))

node_user -->|"uses"| node_browser
node_browser -->|"opens"| node_app
node_app -->|"renders"| node_landing
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_protected
node_protected -->|"checks session"| node_authapi
node_protected -->|"renders"| node_dashboard
node_dashboard -.->|"renders"| node_nav
node_dashboard -.->|"renders"| node_dashpages
node_login -->|"submits credentials"| node_authapi
node_authapi -.->|"HTTP requests"| node_authroutes
node_dashboard -.->|"offers management"| node_academicui
node_academicui -->|"requests records"| node_academicapi
node_academicui -->|"renders"| node_semesterui
node_classui -->|"uses"| node_recordsui
node_classui -->|"loads year context"| node_academicapi
node_semesterui -->|"uses"| node_recordsui
node_recordsui -->|"loads and saves"| node_recordsapi
node_recordsui -.->|"uses icons"| node_icon
node_academicapi -.->|"HTTP requests"| node_ayroutes
node_recordsapi -.->|"HTTP requests"| node_recordroutes
node_backend -->|"mounts"| node_health
node_backend -->|"mounts"| node_authroutes
node_backend -->|"mounts"| node_ayroutes
node_backend -->|"mounts"| node_recordroutes
node_ayroutes -->|"dispatches"| node_aycontroller
node_aycontroller -->|"calls"| node_ayservice
node_ayservice -.->|"delegates"| node_ayrepo
node_recordroutes -->|"dispatches"| node_semesterservice
node_recordroutes -->|"dispatches"| node_classservice
node_semesterservice -.->|"uses"| node_semesterrepo
node_classservice -.->|"uses"| node_classrepo
node_authroutes -.->|"dispatches"| node_authcontroller
node_authcontroller -->|"verifies credentials"| node_authservice
node_authcontroller -->|"manages sessions"| node_sessions
node_authcontroller -->|"checks account"| node_accountrepo
node_authservice -->|"looks up account"| node_accountrepo
node_ayrepo -.->|"queries MySQL"| node_dbconfig
node_semesterrepo -.->|"queries MySQL"| node_dbconfig
node_classrepo -.->|"queries MySQL"| node_dbconfig
node_accountrepo -.->|"queries MySQL"| node_dbconfig

click node_landing "https://github.com/thiennguyen62/project1-hust/tree/main/frontend/src/components/landing"
click node_app "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/login/LoginPage.jsx"
click node_authapi "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/api/auth.js"
click node_protected "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/dashboard/ProtectedDashboard.jsx"
click node_dashboard "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/Dashboard.jsx"
click node_nav "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/dashboard/Sidebar.jsx"
click node_dashpages "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/dashboard/DashboardPages.jsx"
click node_academicui "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/academic-years/AcademicYearsPage.jsx"
click node_semesterui "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/academic-years/Semesters.jsx"
click node_classui "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/classrooms/ClassroomsPage.jsx"
click node_recordsui "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/shared/SchoolRecords.jsx"
click node_academicapi "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/api/academic-years.js"
click node_recordsapi "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/api/school-records.js"
click node_icon "https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/shared/Icon.jsx"
click node_backend "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/app.js"
click node_health "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/health.routes.js"
click node_authroutes "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/auth.routes.js"
click node_authcontroller "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/controllers/auth.controller.js"
click node_ayroutes "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/academic-year.routes.js"
click node_aycontroller "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/controllers/academic-year.controller.js"
click node_recordroutes "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/school-record.routes.js"
click node_authservice "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/auth.service.js"
click node_sessions "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/session.service.js"
click node_ayservice "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/academic-year.service.js"
click node_semesterservice "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/semester.service.js"
click node_classservice "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/classroom.service.js"
click node_ayrepo "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/academic-year.repository.js"
click node_semesterrepo "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/semester.repository.js"
click node_classrepo "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/classroom.repository.js"
click node_accountrepo "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/account.repository.js"
click node_dbconfig "https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/config/database.js"

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_landing,node_app,node_login,node_authapi,node_protected,node_dashboard,node_nav,node_dashpages,node_academicui,node_semesterui,node_classui,node_recordsui,node_academicapi,node_recordsapi,node_icon,node_browser toneBlue
class node_backend,node_health,node_authroutes,node_authcontroller,node_ayroutes,node_aycontroller,node_recordroutes toneAmber
class node_authservice,node_sessions,node_ayservice,node_semesterservice,node_classservice toneMint
class node_ayrepo,node_semesterrepo,node_classrepo,node_accountrepo,node_dbconfig toneRose
class node_user toneIndigo
```

## Components

### Frontend

- [Landing pages](https://github.com/thiennguyen62/project1-hust/tree/main/frontend/src/components/landing): `frontend/src/components/landing`
- [Page routing](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Login page](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/login/LoginPage.jsx): `frontend/src/components/login/LoginPage.jsx`
- [Auth API client](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`
- [Protected dashboard](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/dashboard/ProtectedDashboard.jsx): `frontend/src/components/dashboard/ProtectedDashboard.jsx`
- [Dashboard](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/Dashboard.jsx): `frontend/src/Dashboard.jsx`
- [Dashboard navigation](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/dashboard/Sidebar.jsx): `frontend/src/components/dashboard/Sidebar.jsx`
- [Dashboard pages](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/dashboard/DashboardPages.jsx): `frontend/src/components/dashboard/DashboardPages.jsx`
- [Academic-year management](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/academic-years/AcademicYearsPage.jsx): `frontend/src/components/academic-years/AcademicYearsPage.jsx`
- [Semester view](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/academic-years/Semesters.jsx): `frontend/src/components/academic-years/Semesters.jsx`
- [Classroom management](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/classrooms/ClassroomsPage.jsx): `frontend/src/components/classrooms/ClassroomsPage.jsx`
- [School-record interface](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/shared/SchoolRecords.jsx): `frontend/src/components/shared/SchoolRecords.jsx`
- [Academic-year API client](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/api/academic-years.js): `frontend/src/api/academic-years.js`
- [School-record API client](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/api/school-records.js): `frontend/src/api/school-records.js`
- [Shared icons](https://github.com/thiennguyen62/project1-hust/blob/main/frontend/src/components/shared/Icon.jsx): `frontend/src/components/shared/Icon.jsx`

### Backend API

- [Express app](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/app.js): `backend/src/app.js`
- [Health route](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/health.routes.js): `backend/src/routes/health.routes.js`
- [Authentication routes](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/auth.routes.js): `backend/src/routes/auth.routes.js`
- [Authentication controller](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/controllers/auth.controller.js): `backend/src/controllers/auth.controller.js`
- [Academic-year routes](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/academic-year.routes.js): `backend/src/routes/academic-year.routes.js`
- [Academic-year controller](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/controllers/academic-year.controller.js): `backend/src/controllers/academic-year.controller.js`
- [School-record routes](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/routes/school-record.routes.js): `backend/src/routes/school-record.routes.js`

### Domain services

- [Credential verification](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/auth.service.js): `backend/src/services/auth.service.js`
- [Session handling](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/session.service.js): `backend/src/services/session.service.js`
- [Academic-year rules](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/academic-year.service.js): `backend/src/services/academic-year.service.js`
- [Semester rules](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/semester.service.js): `backend/src/services/semester.service.js`
- [Classroom rules](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/services/classroom.service.js): `backend/src/services/classroom.service.js`

### Persistence

- [Academic-year repository](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/academic-year.repository.js): `backend/src/repositories/academic-year.repository.js`
- [Semester repository](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/semester.repository.js): `backend/src/repositories/semester.repository.js`
- [Classroom repository](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/classroom.repository.js): `backend/src/repositories/classroom.repository.js`
- [Account repository](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/repositories/account.repository.js): `backend/src/repositories/account.repository.js`
- [MySQL connection pool](https://github.com/thiennguyen62/project1-hust/blob/main/backend/src/config/database.js): `backend/src/config/database.js`

### Other components

- **School staff**
- **Web browser**

## Connections

- School staff → Web browser: uses
- Web browser → Page routing: opens
- Page routing → Landing pages: renders (evidence: `frontend/src/App.jsx`)
- Page routing → Login page: routes to (evidence: `frontend/src/App.jsx`)
- Page routing → Protected dashboard: routes to (evidence: `frontend/src/App.jsx`)
- Protected dashboard → Auth API client: checks session (evidence: `frontend/src/components/dashboard/ProtectedDashboard.jsx`)
- Protected dashboard → Dashboard: renders (evidence: `frontend/src/components/dashboard/ProtectedDashboard.jsx`)
- Dashboard → Dashboard navigation: renders
- Dashboard → Dashboard pages: renders
- Login page → Auth API client: submits credentials (evidence: `frontend/src/components/login/LoginPage.jsx`)
- Auth API client → Authentication routes: HTTP requests
- Dashboard → Academic-year management: offers management
- Academic-year management → Academic-year API client: requests records (evidence: `frontend/src/components/academic-years/AcademicYearsPage.jsx`)
- Academic-year management → Semester view: renders (evidence: `frontend/src/components/academic-years/AcademicYearsPage.jsx`)
- Classroom management → School-record interface: uses (evidence: `frontend/src/components/classrooms/ClassroomsPage.jsx`)
- Classroom management → Academic-year API client: loads year context (evidence: `frontend/src/components/classrooms/ClassroomsPage.jsx`)
- Semester view → School-record interface: uses (evidence: `frontend/src/components/academic-years/Semesters.jsx`)
- School-record interface → School-record API client: loads and saves (evidence: `frontend/src/components/shared/SchoolRecords.jsx`)
- School-record interface → Shared icons: uses icons
- Academic-year API client → Academic-year routes: HTTP requests
- School-record API client → School-record routes: HTTP requests
- Express app → Health route: mounts (evidence: `backend/src/app.js`)
- Express app → Authentication routes: mounts (evidence: `backend/src/app.js`)
- Express app → Academic-year routes: mounts (evidence: `backend/src/app.js`)
- Express app → School-record routes: mounts (evidence: `backend/src/app.js`)
- Academic-year routes → Academic-year controller: dispatches (evidence: `backend/src/routes/academic-year.routes.js`)
- Academic-year controller → Academic-year rules: calls (evidence: `backend/src/controllers/academic-year.controller.js`)
- Academic-year rules → Academic-year repository: delegates
- School-record routes → Semester rules: dispatches (evidence: `backend/src/app.js`)
- School-record routes → Classroom rules: dispatches (evidence: `backend/src/app.js`)
- Semester rules → Semester repository: uses
- Classroom rules → Classroom repository: uses
- Authentication routes → Authentication controller: dispatches
- Authentication controller → Credential verification: verifies credentials (evidence: `backend/src/controllers/auth.controller.js`)
- Authentication controller → Session handling: manages sessions (evidence: `backend/src/controllers/auth.controller.js`)
- Authentication controller → Account repository: checks account (evidence: `backend/src/controllers/auth.controller.js`)
- Credential verification → Account repository: looks up account (evidence: `backend/src/services/auth.service.js`)
- Academic-year repository → MySQL connection pool: queries MySQL
- Semester repository → MySQL connection pool: queries MySQL
- Classroom repository → MySQL connection pool: queries MySQL
- Account repository → MySQL connection pool: queries MySQL
