# abhiramchil/wandersync architecture

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

- Interactive diagram: https://gitdiagram.com/abhiramchil/wandersync
- Repository: https://github.com/abhiramchil/wandersync

## Overview

##### Main Components
- User Interface (UI) Layer: Represent Activities and Fragments.
- Primary activities such as MainActivity and SecondActivity.
- Fragments (DestinationFragment, DiningEstablishmentsFragment, AccommodationsFragment, LogisticsFragment, TransportationFragment, TravelCommunityFragment) with clear labels showing their purpose (e.g., itinerary management, dining options).
- Adapter classes as part of the UI layer (AccommodationAdapter, ReservationAdapter, TravelPostAdapter).
- ViewModel Layer:
- ViewModels (e.g., AccommodationViewModel, AccountCreationViewModel, DestinationViewModel, LoginPageViewModel, LogisticsViewModel) that mediate communication between UI and data.
- Data/Model Layer:
- Model classes (Accommodation, Reservation, TravelPost, DestinationFragmentModel, MainFragmentModel, LogisticsFragmentModel) that hold the business logic and data.
- FirebaseDatabaseHelper as the core component that manages interactions with Firebase.
- Firebase & External Services:
- Architectural Patterns:
- Use of the Singleton pattern (for shared resources like FirebaseDatabaseHelper) and adherence to SOLID design principles.

- From UI elements (Activities/Fragments) to their respective ViewModels. This demonstrates user interactions triggering business logic.
- From ViewModels to Model components to illustrate data processing and business logic.
- From Model components to the Firebase service node which handles data persistence and authentication.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        subgraph "Activities"
            MA["MainActivity"]:::ui
            SA["SecondActivity"]:::ui
        end
        subgraph "Fragments"
            AF["AccommodationsFragment"]:::ui
            DF["DestinationFragment"]:::ui
            DEF["DiningEstablishmentsFragment"]:::ui
            LF["LogisticsFragment"]:::ui
            TF["TransportationFragment"]:::ui
            TCF["TravelCommunityFragment"]:::ui
        end
        subgraph "Adapters"
            AA["AccommodationAdapter"]:::ui
            RA["ReservationAdapter"]:::ui
            TPA["TravelPostAdapter"]:::ui
        end
    end

    %% ViewModel Layer
    subgraph "ViewModel Layer"
        AVM["AccommodationViewModel"]:::viewmodel
        ACVM["AccountCreationViewModel"]:::viewmodel
        DVM["DestinationViewModel"]:::viewmodel
        LPVM["LoginPageViewModel"]:::viewmodel
        LVM["LogisticsViewModel"]:::viewmodel
    end

    %% Data/Model Layer
    subgraph "Data/Model Layer"
        AModel["Accommodation"]:::model
        RModel["Reservation"]:::model
        TPModel["TravelPost"]:::model
        DFM["DestinationFragmentModel"]:::model
        MFM["MainFragmentModel"]:::model
        LFM["LogisticsFragmentModel"]:::model
        FDB["FirebaseDatabaseHelper"]:::model
    end

    %% Firebase & External Services
    subgraph "Firebase & External Services"
        FB["Firebase Authentication & Firestore"]:::external
    end

    %% Connections: UI Layer to ViewModel Layer
    AF -->|"binds_to"| AVM
    DF -->|"binds_to"| DVM
    LF -->|"binds_to"| LVM
    MA -->|"initiates"| LPVM
    SA -->|"initiates"| ACVM

    AA -->|"renders"| AF
    RA -->|"renders"| AF
    TPA -->|"renders"| TCF

    %% Connections: ViewModel Layer to Data/Model Layer
    AVM -->|"updates"| AModel
    DVM -->|"updates"| DFM
    LVM -->|"updates"| LFM
    LPVM -->|"updates"| TPModel
    ACVM -->|"updates"| RModel

    %% Connections: Data/Model Layer to Firebase Integration
    AModel -->|"syncs"| FDB
    RModel -->|"syncs"| FDB
    TPModel -->|"syncs"| FDB
    DFM -->|"syncs"| FDB
    MFM -->|"syncs"| FDB
    LFM -->|"syncs"| FDB

    FDB -->|"communicates"| FB

    %% Click Events for UI Layer - Activities
    click MA "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/MainActivity.java"
    click SA "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/SecondActivity.java"

    %% Click Events for UI Layer - Fragments
    click AF "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/AccommodationsFragment.java"
    click DF "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/DestinationFragment.java"
    click DEF "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/DiningEstablishmentsFragment.java"
    click LF "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/LogisticsFragment.java"
    click TF "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/TransportationFragment.java"
    click TCF "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/TravelCommunityFragment.java"

    %% Click Events for UI Layer - Adapters
    click AA "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/AccommodationAdapter.java"
    click RA "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/ReservationAdapter.java"
    click TPA "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/views/TravelPostAdapter.java"

    %% Click Events for ViewModel Layer
    click AVM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/viewmodels/AccommodationViewModel.java"
    click ACVM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/viewmodels/AccountCreationViewModel.java"
    click DVM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/viewmodels/DestinationViewModel.java"
    click LPVM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/viewmodels/LoginPageViewModel.java"
    click LVM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/viewmodels/LogisticsViewModel.java"

    %% Click Events for Data/Model Layer
    click AModel "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/Accommodation.java"
    click RModel "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/Reservation.java"
    click TPModel "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/TravelPost.java"
    click DFM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/DestinationFragmentModel.java"
    click MFM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/MainFragmentModel.java"
    click LFM "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/LogisticsFragmentModel.java"
    click FDB "https://github.com/abhiramchil/wandersync/blob/main/src/main/java/model/FirebaseDatabaseHelper.java"

    %% Click Event for Firebase & External Services
    click FB "https://github.com/abhiramchil/wandersync/blob/main/google-services.json"

    %% Styling
    classDef ui fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef viewmodel fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
    classDef model fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
```
