# aymenchla/bookyourhotel architecture

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

- Interactive diagram: https://gitdiagram.com/aymenchla/bookyourhotel
- Repository: https://github.com/aymenchla/bookyourhotel

## Overview

##### Project type and purpose
- From the file tree and the minimal README (“BookYourHotel”), we see a classic Java-based full-stack hotel-booking web application. It uses Maven for build, Spring MVC (with an Application.java entry point, MvcConfig, WebSecurityConfigAdmin), Spring Security, JPA repositories (dao/*Repository.java), JSP views under webapp/WEB-INF/views, and a relational database. The static folder contains CSS/JS/assets (Bootstrap, jQuery, DataTables, custom scripts), indicating a rich client UI.

##### File structure
- Top-level:
- pom.xml, application.properties – build & config
- src/main/java/config – Spring Boot/Servlet config, MVC and security configuration
- src/main/java/controllers – Spring MVC controllers handling HTTP requests
- src/main/java/dao – Spring Data JPA repositories for data access
- src/main/java/entities – JPA entities modeling database tables
- src/main/java/security – custom UserDetails and authentication logic
- src/main/resources/static – client-side assets (CSS, JS, images, third-party libs)
- src/main/webapp/WEB-INF/views – JSP pages for server-side templates
- There is no distinct “service” package; controllers likely inject repositories directly. Spring’s DispatcherServlet acts as the front-controller.

##### README for additional insights
- The README only names the project. No further architecture details are present; we rely entirely on the file layout.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Client Side"
        direction TB
        Browser["Client Browser"]:::frontend
        StaticResources["Static Resources\n(src/main/resources/static/)"]:::frontend
        JSPViews["JSP Views\n(src/main/webapp/WEB-INF/views/)"]:::frontend
    end

    %% Server Side
    subgraph "Server Side"
        direction TB

        %% Configuration Layer
        subgraph "Configuration"
            direction TB
            Application["Application.java"]:::config
            MvcConfig["MvcConfig.java"]:::config
            WebSecurityConfigAdmin["WebSecurityConfigAdmin.java"]:::config
            Application --> MvcConfig
            Application --> WebSecurityConfigAdmin
        end

        %% Front Controller
        DispatcherServlet["DispatcherServlet\n(Spring MVC)"]:::backend

        %% Security Layer
        subgraph "Security"
            direction TB
            SecurityFilterChain["Spring Security Filter Chain"]:::backend
            CustomUserDetailsService["CustomUserDetailsService.java"]:::backend
            CustomUserDetails["CustomUserDetails.java"]:::backend
            SecurityFilterChain --> CustomUserDetailsService
            CustomUserDetailsService --> CustomUserDetails
        end

        %% Controllers
        subgraph "Controllers"
            direction TB
            AdminController["AdminController.java"]:::backend
            ClientController["ClientController.java"]:::backend
            CommentaireController["CommentaireController.java"]:::backend
            GerantController["GerantController.java"]:::backend
            GestionCompteController["GestionCompteController.java"]:::backend
            RatingController["RatingController.java"]:::backend
            RechercheController["RechercheController.java"]:::backend
            ReservationController["ReservationController.java"]:::backend
        end

        %% Data Access Layer
        subgraph "Repositories"
            direction TB
            AdminRepository["AdminRepository.java"]:::backend
            ChambreRepository["ChambreRepository.java"]:::backend
            ClientRepository["ClientRepository.java"]:::backend
            CommentaireRepository["CommentaireRepository.java"]:::backend
            GerantRepository["GerantRepository.java"]:::backend
            HotelRepository["HotelRepository.java"]:::backend
            PrixRepository["PrixRepository.java"]:::backend
            RatingRepository["RatingRepository.java"]:::backend
            ReservationRepository["ReservationRepository.java"]:::backend
            ResidentRepository["ResidentRepository.java"]:::backend
            UserRepository["UserRepository.java"]:::backend
        end

        %% Domain Model
        Entities["Entities\n(src/main/java/entities/*.java)"]:::backend

        %% Database
        Database["Relational Database"]:::db

        %% Configuration Properties
        AppProperties["application.properties"]:::config
        Pom["pom.xml"]:::config

        %% Connections inside server
        Application --> DispatcherServlet
        DispatcherServlet --> SecurityFilterChain
        SecurityFilterChain --> AdminController
        SecurityFilterChain --> ClientController
        SecurityFilterChain --> CommentaireController
        SecurityFilterChain --> GerantController
        SecurityFilterChain --> GestionCompteController
        SecurityFilterChain --> RatingController
        SecurityFilterChain --> RechercheController
        SecurityFilterChain --> ReservationController

        AdminController --> AdminRepository
        ClientController --> ClientRepository
        CommentaireController --> CommentaireRepository
        GerantController --> GerantRepository
        GestionCompteController --> UserRepository
        RatingController --> RatingRepository
        RechercheController --> HotelRepository
        ReservationController --> ReservationRepository

        AdminRepository --> Entities
        ClientRepository --> Entities
        CommentaireRepository --> Entities
        GerantRepository --> Entities
        HotelRepository --> Entities
        PrixRepository --> Entities
        RatingRepository --> Entities
        ReservationRepository --> Entities
        ResidentRepository --> Entities
        UserRepository --> Entities

        Entities --> Database
        AppProperties --> Database
        Pom --> Application
    end

    %% Client to Server interactions
    Browser -->|"HTTP Request"| DispatcherServlet
    Browser -->|"Request Static Assets"| StaticResources
    DispatcherServlet -->|"Resolve JSP"| JSPViews
    JSPViews -->|"Render HTML"| Browser

    %% Click Events
    click Application "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/config/Application.java"
    click MvcConfig "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/config/MvcConfig.java"
    click WebSecurityConfigAdmin "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/config/WebSecurityConfigAdmin.java"
    click AdminController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/AdminController.java"
    click ClientController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/ClientController.java"
    click CommentaireController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/CommentaireController.java"
    click GerantController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/GerantController.java"
    click GestionCompteController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/GestionCompteController.java"
    click RatingController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/RatingController.java"
    click RechercheController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/RechercheController.java"
    click ReservationController "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/controllers/ReservationController.java"
    click CustomUserDetails "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/security/CustomUserDetails.java"
    click CustomUserDetailsService "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/security/CustomUserDetailsService.java"
    click AdminRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/AdminRepository.java"
    click ChambreRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/ChambreRepository.java"
    click ClientRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/ClientRepository.java"
    click CommentaireRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/CommentaireRepository.java"
    click GerantRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/GerantRepository.java"
    click HotelRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/HotelRepository.java"
    click PrixRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/PrixRepository.java"
    click RatingRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/RatingRepository.java"
    click ReservationRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/ReservationRepository.java"
    click ResidentRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/ResidentRepository.java"
    click UserRepository "https://github.com/aymenchla/bookyourhotel/blob/master/src/main/java/dao/UserRepository.java"
    click StaticResources "https://github.com/aymenchla/bookyourhotel/tree/master/src/main/resources/static/"
    click JSPViews "https://github.com/aymenchla/bookyourhotel/tree/master/src/main/webapp/WEB-INF/views/"
    click AppProperties "https://github.com/aymenchla/bookyourhotel/blob/master/application.properties"
    click Pom "https://github.com/aymenchla/bookyourhotel/blob/master/pom.xml"

    %% Styles
    classDef frontend fill:#6fbf73,stroke:#333,stroke-width:1px
    classDef backend fill:#72a0c1,stroke:#333,stroke-width:1px
    classDef db fill:#f9a,stroke:#333,stroke-width:1px
    classDef config fill:#f2d14b,stroke:#333,stroke-width:1px
```
