# ho-ngoc-tai/thuexehn architecture

> Architecture diagram of the GitHub repository ho-ngoc-tai/thuexehn, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ho-ngoc-tai/thuexehn
- Repository: https://github.com/ho-ngoc-tai/thuexehn

## Overview

##### Overall Project Purpose and Structure
- The project is a full‐stack rental management system.
- It is divided into three main parts:
– ThueXeHN-Admin: The administrative panel, which manages vehicle approvals, password resets, and possibly other administrative tasks.
– ThueXeHN-Backend: The core backend server implementing a RESTful API to manage authentication, orders (rentals, asset management), notifications, dashboard functions, news, and payment processing (e.g., through PayPal integration).
– ThueXeHN-Client: This folder splits into two separate client applications—one for “Owner” and one for “Renter”—each providing a tailored front-end interface with their specific pages and API integrations.

##### Analyzing the File Structure for Architectural Insights
- The Admin front-end (ThueXeHN-Admin) contains a public directory (with an index.html) and a structured src directory with pages (e.g., Rentals/VehicleApproval, ResetPassword). This suggests it is likely built using a modern client-side framework (possibly React).
- The Backend (ThueXeHN-Backend) uses a typical Model-View-Controller (MVC) structure:
– The “config” folder holds database configurations and constants.
– “controllers” manage business logic for various modules (authentication, rental, orders, news, etc.).
– “routers” define API endpoints.
– “models” and a createTables script show how the database layer is handled.
– “utils” include middleware for request processing.
- The Client side (ThueXeHN-Client) further differentiates between Owner and Renter:
– Both contain separate APIs and page modules for functions like Login, Profile, Account Management, and specific rental-related operations.
- The presence of files like “database.sql” indicates a relational database is assumed (or used for development/testing).

a. Main Components to Include:
– User Interfaces:
- Admin UI (ThueXeHN-Admin)
- Owner UI (ThueXeHN-Client/Owner)
- Renter UI (ThueXeHN-Client/Renter)
– Backend API Server (ThueXeHN-Backend)
– Database (backed by SQL, as indicated by database.sql)
– External Services:
- Payment Gateway (e.g., PayPal integration from paypalController.js)
- (Possibly) Firebase (as indicated by the .firebaserc file in the Admin project)

b. Establish Relationships and Data Flows:
– Connect the Backend API to the Database, showing CRUD operations.
– Indicate how the Backend interacts with third-party services like PayPal for payment processing.

c. Architectural Patterns and Key Technologies:
– Note the use of the MVC architectural pattern in the backend (routers, controllers, models).
– Emphasize the separation of concerns: distinct projects for Admin, Owner, and Renter interfaces.
– Call out that the API layer in the Backend provides a centralized business logic and data access point.
– Mention any relevant frameworks or libraries (e.g., Node/Express in the backend, modern JavaScript frameworks in the frontends, Firebase configuration, and integration with PayPal).

– For this full-stack application, clearly separate the frontend components (dividing them into Admin, Owner, and Renter UIs) from the backend service.
– Include the database as a separate component that the backend communicates with for persistent storage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend"
        AdminUI["Admin UI"]:::frontend
        OwnerUI["Owner Client UI"]:::frontend
        RenterUI["Renter Client UI"]:::frontend
    end

    subgraph "Backend Layer"
        BackendAPI["Backend API Server"]:::backend
    end

    Firebase["Firebase Integration"]:::external
    Payment["Payment Gateway (PayPal) Integration"]:::external
    Database(("SQL Database")):::database

    AdminUI -->|"API requests"| BackendAPI
    OwnerUI -->|"API requests"| BackendAPI
    RenterUI -->|"API requests"| BackendAPI

    BackendAPI -->|"SQL CRUD"| Database
    BackendAPI -->|"Payment processing"| Payment

    AdminUI -->|"Firebase_auth"| Firebase

    click AdminUI "https://github.com/ho-ngoc-tai/thuexehn/tree/main/ThueXeHN-Admin"
    click Firebase "https://github.com/ho-ngoc-tai/thuexehn/blob/main/ThueXeHN-Admin/.firebaserc"
    click BackendAPI "https://github.com/ho-ngoc-tai/thuexehn/tree/main/ThueXeHN-Backend"
    click Payment "https://github.com/ho-ngoc-tai/thuexehn/blob/main/ThueXeHN-Backend/app/controllers/paypalController.js"
    click Database "https://github.com/ho-ngoc-tai/thuexehn/blob/main/database.sql"
    click OwnerUI "https://github.com/ho-ngoc-tai/thuexehn/tree/main/ThueXeHN-Client/Owner"
    click RenterUI "https://github.com/ho-ngoc-tai/thuexehn/tree/main/ThueXeHN-Client/Renter"

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef database fill:#F08080,stroke:#000,stroke-width:2px;
```
