# noumanzindani/traveller architecture

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

- Interactive diagram: https://gitdiagram.com/noumanzindani/traveller
- Repository: https://github.com/noumanzindani/traveller

## Overview

##### Project type and purpose
- Traveller is a cross-platform Flutter mobile/desktop/web client app for browsing and booking trips.
- It uses MVVM (Model-View-ViewModel) with Provider for state management.

##### File structure
- Top-level folders: android, ios, linux, macos, windows, web → platform targets via the Flutter engine
- lib/
- model/ – Dart classes representing Trip data
- provider/ – ViewModel/state classes (e.g., Favor)
- view/ – Screens (Splash, Home, Detail, Recipet)
- widgets/ – Reusable UI components (Slider, ScreenTitle, TripList)
- main.dart – App entry point, sets up DI and routes
- pubspec.yaml + pubspec.lock – dependencies (provider, slide_to_act, uuid, flutter_native_splash)
- README.md – confirms MVVM architecture, feature set, tech stack

##### README for additional insights
- Architecture: MVVM
- Packages:
- provider – state injection & change notifications
- slide_to_act – custom UI control for booking
- uuid – generate unique IDs
- flutter_native_splash – splash screen

##### Components
a. Presentation Layer
- Views (SplashView, HomeView, DetailView, RecipetView)
- Widgets (TripList, ScreenTitle, Slider, RecipitText)
b. State & Business Logic
- ViewModels/Providers (Favor, plus any you add for tripListing, booking)
c. Data Layer
- Models (Trip, User, Booking – represented by trip.dart and future classes)
d. External Systems
- REST API endpoints (destination catalogue, booking service)
- Third-party packages (uuid, slide_to_act)
e. Platform Integration
- Flutter Engine
- Platform channels if any native code (android/app, ios/Runner)

##### Relationships & interactions
- Views subscribe to ViewModels via Provider → receive state & commands
- ViewModels call Services to fetch/update data → map JSON to Models
- Models represent domain data and flow back into ViewModels → trigger UI updates
- External API ↔ Services → JSON ↔ Models
- Platform layer handles rendering, plugin callbacks, native integrations

##### Architectural patterns
- MVVM: strict separation of UI (Views), state/logic (ViewModels), and data (Models/Services)
- Dependency injection & reactivity via Provider
- Single source of truth: ViewModel state drives entire UI

##### Detail orientation
- Don’t over-complicate: focus on MVVM layers, data flow, and major dependencies
- Component is named exactly as in the codebase (e.g., FavorProvider, Trip model)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        SplashView["SplashView"]:::presentation
        HomeView["HomeView"]:::presentation
        DetailView["DetailView"]:::presentation
        RecipetView["RecipetView"]:::presentation
        subgraph "Widgets"
            direction TB
            TripList["TripList"]:::presentation
            ScreenTitle["ScreenTitle"]:::presentation
            SliderW["Slider"]:::presentation
            RecipitText["RecipitText"]:::presentation
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        FavorProvider["FavorProvider"]:::business
    end

    %% Data & Services Layer
    subgraph "Data & Services Layer"
        direction TB
        subgraph "Models"
            TripModel["Trip"]:::data
            UserModel["User"]:::data
            BookingModel["Booking"]:::data
        end
        subgraph "Services"
            ApiService["ApiService"]:::data
            AuthService["AuthService"]:::data
            BookingService["BookingService"]:::data
        end
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        RESTDestinations["Destinations API"]:::external
        RESTBooking["Booking API"]:::external
        FlutterEngine["Flutter Engine"]:::external
        AndroidNative["Android Native\nMainActivity.kt"]:::external
        iOSNative["iOS Native\nAppDelegate.swift"]:::external
        WebShell["Web Shell\nindex.html"]:::external
    end

    %% Entry & Config
    MainApp["main.dart"]:::presentation
    Pubspec["pubspec.yaml"]:::external

    %% Relationships
    MainApp -->|"initProviders() / setupRoutes()"| SplashView
    SplashView -->|"subscribe()"| FavorProvider
    HomeView -->|"subscribe()"| FavorProvider
    DetailView -->|"subscribe()"| FavorProvider
    RecipetView -->|"subscribe()"| FavorProvider

    TripList -->|"used by" | HomeView
    ScreenTitle -->|"used by" | HomeView
    SliderW -->|"used by" | RecipetView
    RecipitText -->|"used by" | RecipetView

    FavorProvider -->|"fetchFavorites()"| ApiService
    FavorProvider -->|"bookTrip()"| BookingService

    ApiService -->|"fetchDestinations()"| RESTDestinations
    BookingService -->|"createBooking()"| RESTBooking
    AuthService -->|"authenticate()"| RESTDestinations

    ApiService -->|"mapJson()"| TripModel
    AuthService -->|"mapJson()"| UserModel
    BookingService -->|"mapJson()"| BookingModel

    FlutterEngine --> SplashView
    FlutterEngine --> MainApp
    FlutterEngine --> AndroidNative
    FlutterEngine --> iOSNative
    FlutterEngine --> WebShell

    %% Click Events
    click SplashView "https://github.com/noumanzindani/traveller/blob/main/lib/view/splash.dart"
    click HomeView "https://github.com/noumanzindani/traveller/blob/main/lib/view/homeview.dart"
    click DetailView "https://github.com/noumanzindani/traveller/blob/main/lib/view/detailview.dart"
    click RecipetView "https://github.com/noumanzindani/traveller/blob/main/lib/view/recipet.dart"
    click TripList "https://github.com/noumanzindani/traveller/blob/main/lib/widgets/triplist.dart"
    click ScreenTitle "https://github.com/noumanzindani/traveller/blob/main/lib/widgets/screentitle.dart"
    click SliderW "https://github.com/noumanzindani/traveller/blob/main/lib/widgets/slider.dart"
    click RecipitText "https://github.com/noumanzindani/traveller/blob/main/lib/widgets/recipittext.dart"
    click FavorProvider "https://github.com/noumanzindani/traveller/blob/main/lib/provider/favor.dart"
    click TripModel "https://github.com/noumanzindani/traveller/blob/main/lib/model/trip.dart"
    click MainApp "https://github.com/noumanzindani/traveller/blob/main/lib/main.dart"
    click Pubspec "https://github.com/noumanzindani/traveller/blob/main/pubspec.yaml"
    click AndroidNative "https://github.com/noumanzindani/traveller/blob/main/android/app/src/main/kotlin/com/example/traveller/MainActivity.kt"
    click iOSNative "https://github.com/noumanzindani/traveller/blob/main/ios/Runner/AppDelegate.swift"
    click WebShell "https://github.com/noumanzindani/traveller/blob/main/web/index.html"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0366d6,color:#000
    classDef business fill:#D0FFD0,stroke:#28a745,color:#000
    classDef data fill:#FFE0B2,stroke:#e36209,color:#000
    classDef external fill:#E0E0E0,stroke:#6a737d,color:#000
```
