# rohan-varghese02/travelgo_user architecture

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

- Interactive diagram: https://gitdiagram.com/rohan-varghese02/travelgo_user
- Repository: https://github.com/rohan-varghese02/travelgo_user

## Overview

##### Project type and purpose
- TravLGO is a cross-platform Flutter application for event discovery, booking, chat, reminders and payments.
- It targets Android, iOS, Web, macOS, Windows and Linux.
- It uses BLoC for state management, Firebase for backend services, Stripe for payments, Hive for local storage and Lottie for UI animations.

##### File structure
- Top-level “android”, “ios”, “windows”, “linux”, “macos”, “web” folders contain platform-specific Flutter wrappers and build configs.
- lib/core – low-level services and constants (API calls, auth, Firebase options, chat, Stripe, local storage).
- lib/data – data models (Firestore models, Hive-generated types).
- lib/features/logic – BLoC implementations grouped by domain (auth, journal, navigation, post, user).
- lib/features/view – UI screens and reusable widgets organized by feature (auth, main, pages, shared widgets).
- pubspec.yaml, firebase.json, google-services.json configure dependencies and Firebase integration.

##### README for insights
- Confirms core features: browsing events, booking tickets, push notifications, real-time chat, secure payments.
- Technology stack: Flutter/Dart, flutter_bloc, HTTP (REST), Stripe, Lottie, Firebase Core/Auth/Firestore, Hive.

a. Components
– Client (Flutter UI across platforms)
– Presentation Layer (Widgets in lib/features/view)
– Business Logic Layer (BLoC classes in lib/features/logic)
– Data Layer (Services in lib/core/services + Data Models in lib/data)
– Local Storage (Hive)
– Remote Services:
- Firebase Auth
- Cloud Firestore (and Firestore streams)
- RESTful API endpoints (dio/http for events listing, booking)
- Payment Gateway (Stripe / Razorpay via flutter_stripe)
- Push Notification Service (Firebase Messaging)
– External Real-Time Chat (could be Firestore streams or WebSocket server)

b. Interactions
– UI components dispatch events to BLoC → BLoC invokes core services → services call remote APIs or local storage → responses flow back through BLoC to UI.
– AuthService ↔ Firebase Auth; FirestoreService ↔ Cloud Firestore; ApiServices ↔ REST endpoints; StripeServices ↔ Stripe API; ChatServices ↔ WebSocket or Firestore streams; LocalStorage ↔ Hive.
– Push notifications configured via firebase.json and platform wrappers.

c. Architectural patterns
– Layered clean architecture style (Presentation → BLoC → Service → Data)
– BLoC state management decouples UI and business logic
– Dependency injection of services via constructors (or global providers)
– Separation of concerns: UI, logic, data models, platform integrations

d. Key technologies/frameworks
– flutter_bloc for state management
– dio/http package for REST calls
– firebase_auth, cloud_firestore, firebase_core for backend
– flutter_stripe for payments
– hive/hive_flutter for local persistence
– lottie for animations

##### Final recommendation
– Capture all layers from UI to external services.
– Annotate key protocols (HTTP, WebSocket, gRPC if used).
– Document any asynchronous flows (Firestore streams, push notifications).
– Iterate with developers to refine component boundaries and data pathways.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        FlutterClient["Flutter Client\n(lib/main.dart)"]:::presentation
        UIScreens["UI Screens & Widgets\n(lib/features/view)"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        AuthBLoC["Auth BLoC"]:::bloc
        JournalBLoC["Journal BLoC"]:::bloc
        NavBLoC["Navigation BLoC"]:::bloc
        PostBLoC["Post BLoC"]:::bloc
        UserBLoC["User BLoC"]:::bloc
    end

    %% Core Services Layer
    subgraph "Core Services"
        direction TB
        ApiService["API Services"]:::service
        AuthService["Auth Service"]:::service
        FirestoreService["Firestore Service"]:::service
        ChatService["Chat Service"]:::service
        StreamService["Stream Service"]:::service
        StripeService["Stripe Service"]:::service
        FavoriteService["Favorites Service"]:::service
        LocalStorageService["Local Storage Service"]:::service
        FirebaseConfig["Firebase Config"]:::service
    end

    %% Local Storage
    LocalStorage[(Hive Storage)]:::storage

    %% External Services
    subgraph "External Services"
        direction TB
        FirebaseAuth["Firebase Auth"]:::external
        FirestoreExt["Cloud Firestore"]:::external
        RestAPI["REST API Endpoints"]:::external
        StripeAPI["Stripe Payment Gateway"]:::external
        PushNotif["Push Notification Service"]:::external
    end

    %% Connections
    FlutterClient -->|renders| UIScreens
    UIScreens -->|dispatch events to| AuthBLoC
    UIScreens -->|dispatch events to| JournalBLoC
    UIScreens -->|dispatch events to| NavBLoC
    UIScreens -->|dispatch events to| PostBLoC
    UIScreens -->|dispatch events to| UserBLoC

    AuthBLoC -->|calls| AuthService
    JournalBLoC -->|calls| ApiService
    JournalBLoC -->|calls| LocalStorageService
    NavBLoC -->|calls| StreamService
    PostBLoC -->|calls| ApiService
    UserBLoC -->|calls| FirestoreService

    ApiService -->|HTTP| RestAPI
    AuthService -->|Firebase SDK| FirebaseAuth
    FirestoreService -->|Firestore SDK| FirestoreExt
    ChatService -->|WebSocket/Firestore| FirestoreExt
    StreamService -->|Firestore Streams| FirestoreExt
    StripeService -->|Stripe SDK| StripeAPI
    LocalStorageService -->|Hive API| LocalStorage

    PushNotif -->|Push to| UIScreens

    %% Click Events
    click FlutterClient "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/main.dart"
    click UIScreens "https://github.com/rohan-varghese02/travelgo_user/tree/main/lib/features/view"
    click AuthBLoC "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/features/logic/auth/auth_bloc.dart"
    click JournalBLoC "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/features/logic/journal/journal_bloc.dart"
    click NavBLoC "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/features/logic/nav/nav_bloc.dart"
    click PostBLoC "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/features/logic/post/post_bloc.dart"
    click UserBLoC "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/features/logic/user/user_bloc.dart"
    click ApiService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/api_services.dart"
    click AuthService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/auth/authservice.dart"
    click FirestoreService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/firestore_services.dart"
    click ChatService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/chat_services.dart"
    click StreamService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/stream_services.dart"
    click StripeService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/stripe_services.dart"
    click FavoriteService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/favorite_service.dart"
    click LocalStorageService "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/local_storage.dart"
    click FirebaseConfig "https://github.com/rohan-varghese02/travelgo_user/blob/main/lib/core/services/firebase_options.dart"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef bloc fill:#d4edda,stroke:#333,stroke-width:1px
    classDef service fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef storage fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#f8d7da,stroke:#333,stroke-width:1px
```
