# hieunguyen6524/the-wild-oasis architecture

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

- Interactive diagram: https://gitdiagram.com/hieunguyen6524/the-wild-oasis
- Repository: https://github.com/hieunguyen6524/the-wild-oasis

## Overview

##### Main Components
- User Interface (UI) Layer:
- UI components reside in the src/ui folder (e.g., Button, Modal, Header, Sidebar).
- Global styling and layout components found in src/styles and src/ui/AppLayout.jsx.
- Features/Domain Components:
- Authentication (login, signup, user data update, and avatar): Located in src/features/authentication.
- Cabin Management: Components and hooks under src/features/cabins (tables, forms, create, edit, and delete cabins).
- Bookings: Contains booking listings, details, operations and corresponding hooks in src/features/bookings.
- Check-In/Check-Out: Components and hooks for check-in/out processes in src/features/check-in-out.
- Dashboard & Settings: Components handling analytics (charts, activity), dashboard layout, and settings update.
- Pages/Routes:
- The src/pages folder represents different screens (Account, Booking, Cabins, Dashboard, etc.). These pages bring together various UI and feature components.
- Data and Service Layers:
- Data files in src/data provide static/mock data (for cabins, bookings, guests, and uploader functionality).
- The src/services folder includes API clients that interface with backend data or external services (e.g., apiBookings.js, apiCapbins.js, supabase.js).
- Application Entry and Configuration:
- The main entry point in src/main.jsx and configuration files like vite.config.js set up the project’s runtime.

##### Relationships and Interactions
- The UI (individual components in src/ui) will be composed together inside feature components (src/features/*) and pages (src/pages).
- Communication between the UI and data layer occurs via hooks (residing in each feature or in the global hooks folder) and the service modules in src/services.
- Data flows from service APIs to the custom hooks (e.g., useCabins, useBooking) that manage the state and then feed into the components.
- The routing handled at the page level directs users to views like Login, Dashboard, and Bookings. These pages orchestrate the various feature components.

##### Architectural Patterns and Technologies
- Component-based Architecture: Clear separation between reusable UI components, feature-specific logic, and page-level compositions.
- Feature-based Organization: Grouping by domain (authentication, bookings, cabins, etc.) facilitates scalability and maintainability.
- Unidirectional Data Flow: Data is fetched in hooks (possibly handling API calls from src/services) and passed down to presentational components.
- Vite & React Setup: The README highlights usage of plugins (React with Babel or SWC for Fast Refresh), which affects the build and development process.

##### Summary of Detailed Steps
- Presentation Layer: UI components (src/ui) and styling (src/styles).
- Feature Layer: Each domain-specific folder under src/features (Authentication, Bookings, Cabins, etc.).
- Route/Page Layer: Components under src/pages that represent different routes.
- Data Access Layer: Services in src/services and data helpers in src/data and src/utils.
- Notes on the usage of hooks (e.g., custom hooks in src/hooks) which act as intermediaries between UI and data services.
- Optionally, show external links mentioning the technologies (React, Vite, Supabase, and ESLint as recommended by the .eslintrc.cjs file).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Entry"
        A["Entry (src/main.jsx)"]:::entry
        B["Config (vite.config.js)"]:::entry
    end

    subgraph "UI Layer"
        C["Main Layout (AppLayout)"]:::ui
        D["UI Components"]:::ui
        E["Global Styles"]:::ui
    end

    subgraph "Pages/Routes"
        F["Pages"]:::pages
    end

    subgraph "Features Layer"
        G["Authentication Module"]:::features
        H["Cabin Management"]:::features
        I["Bookings Module"]:::features
        J["Check-In/Out Module"]:::features
        K["Dashboard Components"]:::features
        L["Settings Module"]:::features
    end

    subgraph "Data Access Layer"
        M["Service APIs"]:::data
        N["Data Files"]:::data
    end

    %% Relationships between layers
    A -->|"initializes"| C
    B -->|"configures"| A
    C -->|"routesTo"| F
    F -->|"invokes"| G
    F -->|"invokes"| H
    F -->|"invokes"| I
    F -->|"invokes"| J
    F -->|"invokes"| K
    F -->|"invokes"| L

    %% Feature modules interacting with Data Access
    G -->|"calls"| M
    H -->|"calls"| M
    I -->|"calls"| M
    J -->|"calls"| M
    K -->|"calls"| M
    L -->|"calls"| M

    M -->|"fetchesData"| N

    %% Feature modules rendering UI components
    G -->|"renders"| D
    H -->|"renders"| D
    I -->|"renders"| D
    J -->|"renders"| D
    K -->|"renders"| D
    L -->|"renders"| D

    %% UI Layer utilizing global styling
    C -->|"stylesWith"| E

    %% Click Events
    click A "https://github.com/hieunguyen6524/the-wild-oasis/blob/main/src/main.jsx"
    click B "https://github.com/hieunguyen6524/the-wild-oasis/blob/main/vite.config.js"
    click C "https://github.com/hieunguyen6524/the-wild-oasis/blob/main/src/ui/AppLayout.jsx"
    click D "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/ui"
    click E "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/styles"
    click F "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/pages"
    click G "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/features/authentication"
    click H "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/features/cabins"
    click I "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/features/bookings"
    click J "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/features/check-in-out"
    click K "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/features/dashboard"
    click L "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/features/settings"
    click M "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/services"
    click N "https://github.com/hieunguyen6524/the-wild-oasis/tree/main/src/data"

    %% Styles
    classDef entry fill:#f4cccc,stroke:#d00000,stroke-width:2px;
    classDef ui fill:#c9daf8,stroke:#6d9eeb,stroke-width:2px;
    classDef pages fill:#b6d7a8,stroke:#38761d,stroke-width:2px;
    classDef features fill:#ffe599,stroke:#f1c232,stroke-width:2px;
    classDef data fill:#d9ead3,stroke:#6aa84f,stroke-width:2px;
```
