# hoanglinh51/hotel-booking architecture

> Architecture diagram of the GitHub repository hoanglinh51/hotel-booking, 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/hoanglinh51/hotel-booking
- Repository: https://github.com/hoanglinh51/hotel-booking

## Overview

##### Main Components
- Application Entry Point:
- That the project starts with “src/index.html” and “src/main.ts”, which bootstrap the Angular application.
- Core Angular Application (App Module):
- “src/app/app.module.ts” as the central module that ties together various submodules, services, and shared components.
- Layout Components:
- Layout sections such as the header (both “header” and “header-nonsearch”) and footer. These are part of the UI shell.
- Feature Modules:
- Home Module: Includes the various sub-components like the beach page, images, body, and showmap. This module likely handles the landing or main booking overview.
- Detail Module: Provides detailed booking information covering components like title, comments, map, booking details (vila-owner, payment-method, infor-booking), etc.
- About-Us Module: Presents an informational section about the service.
- Profile-User Module: Manages user profile interactions (booked-trip, favorite, my-profile, payment-options) with their own routing.
- Data & Services:
- The “src/app/data” directory houses constants, helpers like the fake-backend (suggesting possible mocking or abstraction of API calls), modal models (for alert, beach, booking, etc.), and services (such as Auth, Category, Post, LocalStorage).
- How these services provide the business logic and interaction with potential APIs.
- Shared Module:
- Assets:
- Assets (images for various sections) as static resources that are used by multiple components.

##### Architectural Patterns and Design Principles
- Modular Architecture: Highlight how the code is organized into discrete feature modules to separate concerns.
- Component-Based UI: Illustrate how Angular components encapsulate HTML, CSS, and logic.
- Service-Oriented Communication: Explain the design where services handle data access and business rules, supporting separation of concerns and easier testing.
- Routing and Navigation: Indicate that Angular routing is being used to determine which components are displayed based on the URL.

##### Relevant Technologies, Frameworks, and Libraries
- Angular (CLI version 16.2.1) is the core framework.
- Angular modules, components, routing, dependency injection, and services.
- Karma is noted as the unit testing framework, and end-to-end tests can be run with a tool configured by the developer.
- The project integrates static assets (images) and likely uses Angular’s animation or responsive design features.

##### Elements
- Optionally, include annotations or legends for clarity (e.g., “Routing Module – handles URL navigation”, “Data Service – communicates with backend or mocks”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point Section
    EP["Index.html & Main.ts"]:::entry
    AM["App Module"]:::module
    EP -->|"bootstraps"| AM
    click EP "https://github.com/hoanglinh51/hotel-booking/blob/main/src/index.html"
    click EP "https://github.com/hoanglinh51/hotel-booking/blob/main/src/main.ts"
    click AM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/app.module.ts"

    %% Layout Components
    subgraph "Layout Components"
        LH["Header Component"]:::layout
        LHN["Header (Nonsearch) Component"]:::layout
        LF["Footer Component"]:::layout
    end
    AM -->|"includes"| LH
    AM -->|"includes"| LHN
    AM -->|"includes"| LF
    click LH "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/layout/header/header.component.ts"
    click LHN "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/layout/header-nonsearch/header-nonsearch.component.ts"
    click LF "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/layout/footer/footer.component.ts"

    %% Feature Modules
    subgraph "Feature Modules"
        %% Home Module
        HM["Home Module"]:::module
        HRM["Home Routing"]:::module
        HB["Beach Component"]:::component
        HM -->|"routes via"| HRM
        HRM -->|"loads"| HB
        click HM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/home/home.module.ts"
        click HRM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/home/home-routing.module.ts"
        click HB "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/home/page/beach/beach.component.ts"

        %% Auth Module
        AMd["Auth Module"]:::module
        ARM["Auth Routing"]:::module
        AL["Login Component"]:::component
        AR["Register Component"]:::component
        AG["Auth Guard"]:::component
        AMd -->|"routes via"| ARM
        ARM -->|"loads"| AL
        ARM -->|"loads"| AR
        AMd -->|"secures"| AG
        click AMd "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/auth/auth.module.ts"
        click ARM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/auth/auth-routing.module.ts"
        click AL "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/auth/page/login/login.component.ts"
        click AR "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/auth/page/register/register.component.ts"
        click AG "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/auth/auth.guard.ts"

        %% Detail Module
        DM["Detail Module"]:::module
        DRM["Detail Routing"]:::module
        DT["Title Component"]:::component
        DC["Comments Component"]:::component
        DMap["Map Component"]:::component
        DB["Booking Details"]:::component
        DM -->|"routes via"| DRM
        DRM -->|"loads"| DT
        DRM -->|"loads"| DC
        DRM -->|"loads"| DMap
        DRM -->|"loads"| DB
        click DM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/detail/detail.module.ts"
        click DRM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/detail/detail-routing.module.ts"
        click DT "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/detail/page/title/title.component.ts"
        click DC "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/detail/page/comments/comments.component.ts"
        click DMap "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/detail/page/map/map.component.ts"
        %% Note: Booking details may include multiple subcomponents e.g., vila-owner etc.
        
        %% About-Us Module
        AUM["About-Us Module"]:::module
        AURM["About-Us Routing"]:::module
        AUP["Page Component"]:::component
        AUM -->|"routes via"| AURM
        AURM -->|"loads"| AUP
        click AUM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/about-us/about-us.module.ts"
        click AURM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/about-us/about-us-routing.module.ts"
        click AUP "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/about-us/page/page.component.ts"

        %% Profile-User Module
        PUM["Profile-User Module"]:::module
        PURM["Profile-User Routing"]:::module
        PT["Booked Trip"]:::component
        PF["Favorite"]:::component
        PP["My Profile"]:::component
        PPO["Payment Options"]:::component
        PUM -->|"routes via"| PURM
        PURM -->|"loads"| PT
        PURM -->|"loads"| PF
        PURM -->|"loads"| PP
        PURM -->|"loads"| PPO
        click PUM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/profile-user/profile-user.module.ts"
        click PURM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/profile-user/profile-user-routing.module.ts"
        click PT "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/profile-user/page/booked-trip/booked-trip.component.ts"
        click PF "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/profile-user/page/favorite/favorite.component.ts"
        click PP "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/profile-user/page/my-profile/my-profile.component.ts"
        click PPO "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/modules/profile-user/page/payment-options/payment-options.component.ts"
    end
    AM -->|"loads Feature Modules"| HM
    AM -->|"loads Feature Modules"| AMd
    AM -->|"loads Feature Modules"| DM
    AM -->|"loads Feature Modules"| AUM
    AM -->|"loads Feature Modules"| PUM

    %% Data & Services
    subgraph "Data & Services"
        CONST["LocalStorage Constants"]:::data
        HELP["Fake Backend Helper"]:::data
        MODALS["Modal Models"]:::data
        DS["Data Services"]:::data
        AS["Auth Service"]:::service
        CS["Category Service"]:::service
        LS["LocalStorage Service"]:::service
        PS["Post Service"]:::service
        DS --> AS
        DS --> CS
        DS --> LS
        DS --> PS
    end
    AM -->|"utilizes"| CONST
    AM -->|"utilizes"| HELP
    AM -->|"utilizes"| MODALS
    AM -->|"utilizes"| DS
    click CONST "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/constant/localstorage-key.ts"
    click HELP "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/helpers/fake-backend.ts"
    click DS "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/service/auth.service.ts"
    click AS "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/service/auth.service.ts"
    click CS "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/service/category.service.ts"
    click LS "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/service/localstorage.service.ts"
    click PS "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/data/service/post.service.ts"

    %% Shared Module
    SM["Shared Module"]:::module
    AM -->|"imports"| SM
    click SM "https://github.com/hoanglinh51/hotel-booking/blob/main/src/app/shared/shared.module.ts"

    %% Assets
    ASSETS["Static Assets"]:::asset
    AM -->|"uses"| ASSETS
    click ASSETS "https://github.com/hoanglinh51/hotel-booking/tree/main/src/assets"

    %% Styles
    classDef entry fill:#E0FFFF,stroke:#000,stroke-width:2px;
    classDef module fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef component fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef layout fill:#EE82EE,stroke:#000,stroke-width:2px;
    classDef data fill:#FFB6C1,stroke:#000,stroke-width:2px;
    classDef service fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef asset fill:#D3D3D3,stroke:#000,stroke-width:2px;
```
