# nhantrinh0305/house-rental-management architecture

> Architecture diagram of the GitHub repository nhantrinh0305/house-rental-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhantrinh0305/house-rental-management
- Repository: https://github.com/nhantrinh0305/house-rental-management

## Overview

##### Project type and purpose
- This is a Java-based backend application (likely a Spring Boot monolith) that provides RESTful APIs for managing house rentals (CRUD operations on houses and users).
- There is no frontend code here—this service is intended to be consumed by a client (web, mobile, or another service).

##### File structure
- Top-level “house-rental-management” project with a standard Maven/Gradle layout under src/main/java.
- Package com.nhan.houserentalmanagement contains four subpackages:
- controller – REST endpoints (HouseController, UserController)
- service – business logic interfaces and implementations (HouseService, HouseServiceImpl, UserService, UserServiceImpl)
- repository – Spring Data JPA repositories (HouseRepository, UserRepository)
- model – domain entities (House, User)

##### Detailed breakdown to capture essential components
- Client (Browser/Mobile)
- HTTP Request → HouseController / UserController
- HouseController → HouseService (interface)
- HouseServiceImpl → HouseRepository (CRUD JPA repo)
- HouseRepository → House table in RDBMS
- Similarly for User flow
- Packages or layer names around component groups

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Client["Client (Web/Mobile)"]:::client

    %% API Layer
    subgraph "API Layer"
        HC["HouseController\n(GET /houses, POST /houses, PUT /houses/{id}, DELETE /houses/{id})"]:::api
        UC["UserController\n(GET /users, POST /users, PUT /users/{id}, DELETE /users/{id})"]:::api
    end

    %% Business Layer
    subgraph "Business Layer"
        HS["HouseService (interface)"]:::biz
        HSI["HouseServiceImpl"]:::biz
        US["UserService (interface)"]:::biz
        USI["UserServiceImpl"]:::biz
    end

    %% Data Layer
    subgraph "Data Layer"
        HR["HouseRepository"]:::repo
        UR["UserRepository"]:::repo
    end

    %% Database
    Database["Relational Database\n(House, User tables)"]:::db

    %% Interactions
    Client -->|"HTTP calls"| HC
    Client -->|"HTTP calls"| UC

    HC -->|"calls"| HS
    UC -->|"calls"| US

    HSI -->|"implements"| HS
    USI -->|"implements"| US

    HS -->|"invokes"| HSI
    US -->|"invokes"| USI

    HSI -->|"uses"| HR
    USI -->|"uses"| UR

    HR -->|"CRUD operations"| Database
    UR -->|"CRUD operations"| Database

    %% Click Events
    click HC "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/controller/HouseController.java"
    click UC "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/controller/UserController.java"
    click HS "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/service/HouseService.java"
    click HSI "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/service/HouseServiceImpl.java"
    click US "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/service/UserService.java"
    click USI "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/service/UserServiceImpl.java"
    click HR "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/repository/HouseRepository.java"
    click UR "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/repository/UserRepository.java"
    click Database "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/model/House.java"
    click Database "https://github.com/nhantrinh0305/house-rental-management/blob/main/house-rental-management/src/main/java/com/nhan/houserentalmanagement/model/User.java"

    %% Styles
    classDef client fill:#E0F7FA,stroke:#006064,color:#004D40
    classDef api fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1
    classDef biz fill:#C8E6C9,stroke:#2E7D32,color:#1B5E20
    classDef repo fill:#FFE0B2,stroke:#E65100,color:#BF360C
    classDef db fill:#ECEFF1,stroke:#455A64,color:#263238,shape:cylinder
```
