# vamshikittu22/wanderlusttrails architecture

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

- Interactive diagram: https://gitdiagram.com/vamshikittu22/wanderlusttrails
- Repository: https://github.com/vamshikittu22/wanderlusttrails

## Overview

##### Project’s Main Components
- Frontend: Located under the “Frontend/WanderlustTrails” directory (and a separate “test” folder with similar structure), this contains the user interface, pages (such as Home, Login, Signup, BookingDetails, etc.), reusable React components (for header, footer, dashboards, etc.), context management (e.g., TodoContext and UserContext), assets (images, videos), and routing.
- Backend: Found in the “Backend” folder, this includes PHP scripts providing APIs for various functionalities: authentication (login, signup, logout, JWT helper, etc.), managing travel packages, user operations, booking operations (create, edit, cancel, view bookings), and even a todo management system. There is a separation ensuring different API endpoints and controllers organized under subdirectories like “config/AdminDashboard”, “config/UserDashboard”, “config/booking”, etc.
- Database: Although no explicit DB server is defined, the existence of “Backend/db” (with inc_dbconfig.php) implies a relational database for persisting user data, booking information, travel packages, etc.
- Assets: Shared static resources (images, video) exist both in the root “Assets” and inside the Frontend directory, which should be shown as data/resource stores.
- External Dependencies: The backend uses PHP Composer (composer.json and composer.lock) while the frontend has package.json dependencies (React, Vite, Tailwind, and ESLint configurations). Note also potential JWT authentication libraries and others used in the PHP and JS stacks.

##### Out the Relationships and Interactions
- Client (Browser) interacts with the Frontend application (React SPA). The pages and components make API calls to the backend.
- The Frontend’s API service (apiService.js) is the bridge to the PHP API endpoints in the Backend.
- The Backend scripts handle authentication, user management, booking processing, and admin functionalities. These scripts interact with the Database (detailed in inc_dbconfig.php) to perform CRUD operations.
- The separation between Admin and User dashboards should be captured, with distinct API calls and UI components for each type of user.
- Static Assets (images, videos, etc.) are used by frontend components to enrich the UI, and some may also be managed/uploaded from the backend.

##### Important Architectural Patterns and Technologies
- Client-Server Architecture: Clear distinction between frontend (React SPA) and backend (PHP API).
- MVC-like Pattern: Even if not a textbook MVC, the backend has separate configurations for various operations (authentication, booking, user management) and corresponding model files (for database and business logic).
- RESTful API Design: PHP files like getAllBookings.php, createBooking.php, etc. act as endpoints for various actions.
- Use of JWT for Authentication: Indicated by “jwt_helper.php” in the auth folder, suggesting token-based user session management.
- Modularization: Separation of concerns for the admin dashboard vs. user dashboard and for different features (booking, travel packages, todos).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Client["Client (Browser)"]:::client

    %% Frontend Layer
    subgraph "Frontend Layer"
        A1["Frontend (React SPA)"]:::frontend
        A2["Routing, Pages & Components"]:::frontend
        A3["API Service"]:::frontend
        A4["Context Management"]:::frontend
        A5["Frontend Assets"]:::assets
        F1["package.json"]:::dependency
        F2["package-lock.json"]:::dependency
    end

    %% Backend Layer
    subgraph "Backend Layer"
        B1["Backend API (PHP)"]:::backend
        subgraph "Backend Controllers"
            B1a["Authentication & JWT"]:::backend
            B1b["Travel Package Management"]:::backend
            B1c["User Management (Admin)"]:::backend
            B1d["User Profile Management"]:::backend
            B1e["Booking Operations"]:::backend
            B1f["Todo Management"]:::backend
        end
        B2a["composer.json"]:::dependency
        B2b["composer.lock"]:::dependency
    end

    %% Data and Shared Assets Layers
    C["Database"]:::database
    D["Shared Static Assets"]:::assets

    %% Connections - Frontend
    Client -->|"uses"| A1
    A1 -->|"contains"| A2
    A1 -->|"calls"| A3
    A1 -->|"manages"| A4
    A2 -->|"renders"| A5
    A1 -->|"depends_on"| F1
    A1 -->|"depends_on"| F2

    %% Frontend to Backend
    A3 -->|"API_request"| B1
    A3 -->|"auth_call"| B1a

    %% Backend internal dependency and usage of configuration files
    B1 -->|"depends_on"| B2a
    B1 -->|"depends_on"| B2b

    %% Backend to Data
    B1 -->|"CRUD_operations"| C

    %% Relationship from Backend Controllers to Database (implied for operations)
    B1b -->|"uses"| C
    B1c -->|"uses"| C
    B1d -->|"uses"| C
    B1e -->|"uses"| C
    B1f -->|"uses"| C

    %% Frontend Assets using Shared Static Assets
    A5 -->|"uses_shared"| D

    %% Click events for Frontend
    click A1 "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Frontend/WanderlustTrails"
    click A2 "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Frontend/WanderlustTrails/src"
    click A3 "https://github.com/vamshikittu22/wanderlusttrails/blob/main/Frontend/WanderlustTrails/src/apiService.js"
    click A4 "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Frontend/WanderlustTrails/src/context"
    click A5 "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Frontend/WanderlustTrails/src/assets"
    click F1 "https://github.com/vamshikittu22/wanderlusttrails/blob/main/Frontend/WanderlustTrails/package.json"
    click F2 "https://github.com/vamshikittu22/wanderlusttrails/blob/main/package-lock.json"

    %% Click events for Shared Assets
    click D "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Assets/Images"

    %% Click events for Backend
    click B1 "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config"
    click B1a "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config/auth"
    click B1b "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config/AdminDashboard/manageDestinations"
    click B1c "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config/AdminDashboard/manageUsers"
    click B1d "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config/UserDashboard/manageUserProfile"
    click B1e "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config/booking"
    click B1f "https://github.com/vamshikittu22/wanderlusttrails/tree/main/Backend/config/todo"
    click C "https://github.com/vamshikittu22/wanderlusttrails/blob/main/Backend/db/inc_dbconfig.php"
    click B2a "https://github.com/vamshikittu22/wanderlusttrails/blob/main/Backend/composer.json"
    click B2b "https://github.com/vamshikittu22/wanderlusttrails/blob/main/Backend/composer.lock"

    %% Styles
    classDef client fill:#FFE4B5,stroke:#CD853F,stroke-width:2px;
    classDef frontend fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef backend fill:#FFB6C1,stroke:#8B0000,stroke-width:2px;
    classDef assets fill:#98FB98,stroke:#2E8B57,stroke-width:2px;
    classDef dependency fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef database fill:#E0FFFF,stroke:#20B2AA,stroke-width:2px;
```
