# reemakusa/staypal architecture

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

- Interactive diagram: https://gitdiagram.com/reemakusa/staypal
- Repository: https://github.com/reemakusa/staypal

## Overview

##### Project Type and Purpose
- StayPal is a multi-platform (iOS, Android, web, desktop) Flutter application for booking hotels and events, with user, admin, hotel-manager, and event-organizer roles.
- It uses Firebase for authentication, data storage (Firestore), cloud functions, and hosting.

##### File Structure Analysis
- Top-level “android”, “ios”, “linux”, “macos”, “windows”, “web”: Flutter platform shells.
- “functions/”: Firebase Cloud Functions (Node.js).
- “lib/”: core Dart code, organized by feature:
- DB + firebase_options.dart
- constants, utils, theme
- models (POJOs for bookings, events, hotels, user, etc.)
- services (booking_service, user_service, event_service…)
- screens (split into sub-folders by feature/role: auth, homePage, booking, detailsPage, admin, event_organizer, hotel_manager, profile, wishlist, reviews, searchResult)
- viewmodels under each screen (MVVM pattern).
- widgets (reusable UI components and webNavBar).
- Firebase config files: .firebaserc, firebase.json, google-services.json, GoogleService-Info.plist.

##### Key Architectural Insights from README
- Although the README is boilerplate, the presence of Firebase config + Cloud Functions implies a serverless backend with user- and role-based workflows.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Flutter Client Zone
    subgraph "Flutter Client"
        direction TB
        Main["Main App\n(lib/main.dart)"]:::entry
        subgraph "UI Layer (Screens)"
            direction TB
            UI["Screens\n(lib/screens)"]:::ui
        end
        subgraph "Presentation Layer (ViewModels)"
            direction TB
            VM["ViewModels\n(lib/screens/**/viewmodels)"]:::vm
        end
        subgraph "Domain & Data Layer (Services)"
            direction TB
            US["UserService"]:::service
            BS["BookingService"]:::service
            ES["EventService"]:::service
            HS["HotelService"]:::service
            ETS["EventTicketService"]:::service
            HBS["HotelBookingService"]:::service
        end
        subgraph "Data Models"
            direction TB
            Models["Models\n(lib/models)"]:::model
        end
        subgraph "Shared Components"
            direction TB
            Widgets["Widgets\n(lib/widgets)"]:::shared
            Theme["AppTheme\n(lib/theme/app_theme.dart)"]:::shared
            Constants["Constants\n(lib/constants)"]:::shared
            Utils["Utils\n(lib/utils)"]:::shared
        end
        subgraph "Initialization"
            direction TB
            FI["Firebase Options\n(lib/DB/firebase_options.dart)"]:::config
        end
        subgraph "Platform Shells"
            direction TB
            PS["android, ios, linux,\nmacos, windows, web"]:::platform
        end
    end

    %% Firebase Backend Zone
    subgraph "Firebase Backend"
        direction TB
        Auth["Authentication\n(Firebase Auth)"]:::firebase
        Firestore["Firestore\n(Collections)"]:::firebase
        CF["Cloud Functions\n(functions/index.js)"]:::firebase
        Hosting["Hosting\n(firebase.json, web/index.html)"]:::firebase
    end

    External["Payment Gateway & Analytics"]:::external

    %% Connections
    Main --> UI
    UI --> VM
    VM --> US
    VM --> BS
    VM --> ES
    VM --> HS
    VM --> ETS
    VM --> HBS
    US --> Auth
    US --> Firestore
    BS --> Firestore
    ES --> Firestore
    HS --> Firestore
    ETS --> Firestore
    HBS --> Firestore
    VM --> CF
    CF --> Firestore
    Main --> FI
    Main --> Widgets
    Main --> Theme
    Main --> Constants
    Main --> Utils
    UI --> Widgets
    UI --> Theme
    UI --> Constants
    UI --> Utils
    Main --> PS
    BS --> External

    %% Click Events
    click Main "https://github.com/reemakusa/staypal/blob/main/lib/main.dart"
    click UI "https://github.com/reemakusa/staypal/tree/main/lib/screens"
    click VM "https://github.com/reemakusa/staypal/tree/main/lib/screens/**/viewmodels"
    click US "https://github.com/reemakusa/staypal/blob/main/lib/services/user_service.dart"
    click BS "https://github.com/reemakusa/staypal/blob/main/lib/services/booking_service.dart"
    click ES "https://github.com/reemakusa/staypal/blob/main/lib/services/event_service.dart"
    click HS "https://github.com/reemakusa/staypal/blob/main/lib/services/hotel_service.dart"
    click ETS "https://github.com/reemakusa/staypal/blob/main/lib/services/event_ticket_service.dart"
    click HBS "https://github.com/reemakusa/staypal/blob/main/lib/services/hotel_booking_service.dart"
    click Models "https://github.com/reemakusa/staypal/tree/main/lib/models"
    click Widgets "https://github.com/reemakusa/staypal/tree/main/lib/widgets"
    click Theme "https://github.com/reemakusa/staypal/blob/main/lib/theme/app_theme.dart"
    click Constants "https://github.com/reemakusa/staypal/tree/main/lib/constants"
    click Utils "https://github.com/reemakusa/staypal/tree/main/lib/utils"
    click FI "https://github.com/reemakusa/staypal/blob/main/lib/DB/firebase_options.dart"
    click CF "https://github.com/reemakusa/staypal/blob/main/functions/index.js"
    click Hosting "https://github.com/reemakusa/staypal/blob/main/firebase.json"

    %% Styles
    classDef entry fill:#B2EBF2,stroke:#0277BD,color:#000
    classDef ui fill:#BBDEFB,stroke:#1565C0,color:#000
    classDef vm fill:#C8E6C9,stroke:#2E7D32,color:#000
    classDef service fill:#FFE0B2,stroke:#EF6C00,color:#000
    classDef model fill:#CFD8DC,stroke:#455A64,color:#000
    classDef shared fill:#E1BEE7,stroke:#6A1B9A,color:#000
    classDef config fill:#FFF9C4,stroke:#F9A825,color:#000
    classDef platform fill:#D7CCC8,stroke:#5D4037,color:#000
    classDef firebase fill:#CE93D8,stroke:#8E24AA,color:#000
    classDef external fill:#FFCDD2,stroke:#C62828,color:#000
```
