# hpuno/nha-tro-sinh-vien architecture

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

- Interactive diagram: https://gitdiagram.com/hpuno/nha-tro-sinh-vien
- Repository: https://github.com/hpuno/nha-tro-sinh-vien

## Overview

This is a Vietnamese room-rental management web application with separate public and admin entry points. The verified request flow is Express startup → route → controller → Pug page; startup also initializes relational table definitions. The README contains no capability detail, and the sampled controllers implement only page rendering, so the graph does not imply unverified management operations. Domain nodes reflect the model filenames in the tree; wiring among those domains is omitted where source was not sampled.

Main entry points: [`models/initData.model.js`](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/models/initData.model.js) (Table initialization), [`index.js`](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/index.js) (Express startup), [`router/client/home.router.js`](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/client/home.router.js) (Home route), [`router/admin/dashboard.router.js`](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/admin/dashboard.router.js) (Dashboard route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Express startup<br/>[index.js]"]
  node_client_routes["Client routes<br/>[index.router.js]"]
  node_home_route["Home route<br/>[home.router.js]"]
  node_home_controller["Home controller<br/>[home.controller.js]"]
  node_home_view["Home page<br/>[index.pug]"]
  node_admin_routes["Admin routes<br/>[index.router.js]"]
  node_dashboard_route["Dashboard route"]
  node_dashboard_controller["Dashboard controller"]
  node_dashboard_view["Dashboard page<br/>[index.pug]"]
end

subgraph group_rental["Rental domain"]
  node_rental_models["Rental entities"]
  node_tenant_staff["Tenants and staff"]
  node_services_billing["Services and billing"]
end

subgraph group_storage["Persistence"]
  node_init_data["Table initialization<br/>[initData.model.js]"]
  node_database_config[("MySQL pool<br/>[database.js]")]
end

node_visitor(("Visitor"))
node_admin_user(("Admin user"))

node_app -->|"mounts routes"| node_client_routes
node_app -->|"mounts routes"| node_admin_routes
node_visitor -->|"requests home"| node_home_route
node_client_routes -->|"mounts route"| node_home_route
node_home_route -->|"dispatches"| node_home_controller
node_home_controller -->|"renders"| node_home_view
node_admin_user -->|"requests dashboard"| node_dashboard_route
node_admin_routes -->|"mounts route"| node_dashboard_route
node_dashboard_route -->|"dispatches"| node_dashboard_controller
node_dashboard_controller -->|"renders"| node_dashboard_view
node_app -->|"initializes tables"| node_init_data
node_init_data -->|"invokes definitions"| node_rental_models
node_init_data -->|"invokes definitions"| node_tenant_staff
node_init_data -->|"invokes definitions"| node_services_billing
node_rental_models -->|"executes SQL"| node_database_config

click node_app "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/index.js"
click node_client_routes "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/client/index.router.js"
click node_home_route "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/client/home.router.js"
click node_home_controller "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/controller/client/home.controller.js"
click node_home_view "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/view/client/page/home/index.pug"
click node_admin_routes "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/admin/index.router.js"
click node_dashboard_route "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/admin/dashboard.router.js"
click node_dashboard_controller "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/controller/admin/dashboard.controller.js"
click node_dashboard_view "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/view/admin/page/dashboard/index.pug"
click node_init_data "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/models/initData.model.js"
click node_rental_models "https://github.com/hpuno/nha-tro-sinh-vien/tree/main/models"
click node_tenant_staff "https://github.com/hpuno/nha-tro-sinh-vien/tree/main/models"
click node_services_billing "https://github.com/hpuno/nha-tro-sinh-vien/tree/main/models"
click node_database_config "https://github.com/hpuno/nha-tro-sinh-vien/blob/main/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_app,node_client_routes,node_home_route,node_home_controller,node_home_view,node_admin_routes,node_dashboard_route,node_dashboard_controller,node_dashboard_view,node_admin_user toneBlue
class node_rental_models,node_tenant_staff,node_services_billing toneAmber
class node_init_data,node_database_config toneMint
class node_visitor toneIndigo
```

## Components

### Web application

- [Express startup](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/index.js): `index.js`
- [Client routes](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/client/index.router.js): `router/client/index.router.js`
- [Home route](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/client/home.router.js): `router/client/home.router.js`
- [Home controller](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/controller/client/home.controller.js): `controller/client/home.controller.js`
- [Home page](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/view/client/page/home/index.pug): `view/client/page/home/index.pug`
- [Admin routes](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/admin/index.router.js): `router/admin/index.router.js`
- [Dashboard route](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/router/admin/dashboard.router.js): `router/admin/dashboard.router.js`
- [Dashboard controller](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/controller/admin/dashboard.controller.js): `controller/admin/dashboard.controller.js`
- [Dashboard page](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/view/admin/page/dashboard/index.pug): `view/admin/page/dashboard/index.pug`

### Rental domain

- [Rental entities](https://github.com/hpuno/nha-tro-sinh-vien/tree/main/models): `models`
- [Tenants and staff](https://github.com/hpuno/nha-tro-sinh-vien/tree/main/models): `models`
- [Services and billing](https://github.com/hpuno/nha-tro-sinh-vien/tree/main/models): `models`

### Persistence

- [Table initialization](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/models/initData.model.js): `models/initData.model.js`
- [MySQL pool](https://github.com/hpuno/nha-tro-sinh-vien/blob/main/config/database.js): `config/database.js`

### Other components

- **Visitor**
- **Admin user**

## Connections

- Express startup → Client routes: mounts routes
- Express startup → Admin routes: mounts routes
- Visitor → Home route: requests home
- Client routes → Home route: mounts route
- Home route → Home controller: dispatches
- Home controller → Home page: renders
- Admin user → Dashboard route: requests dashboard
- Admin routes → Dashboard route: mounts route
- Dashboard route → Dashboard controller: dispatches
- Dashboard controller → Dashboard page: renders
- Express startup → Table initialization: initializes tables
- Table initialization → Rental entities: invokes definitions
- Table initialization → Tenants and staff: invokes definitions
- Table initialization → Services and billing: invokes definitions
- Rental entities → MySQL pool: executes SQL
