# cmput301-w25/project-impostersyndrome architecture

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

- Interactive diagram: https://gitdiagram.com/cmput301-w25/project-impostersyndrome
- Repository: https://github.com/cmput301-w25/project-impostersyndrome

## Overview

##### Main Components
- Android Client (Frontend/UI):
– Activities, Fragments, Adapters, and various view components (e.g., MainActivity, LoginActivity, MapActivity, EditProfileActivity). These are located under the “code/app/src/main/java/com/example/impostersyndrom/view” and “controller” packages.
– UI Resources (layouts, drawable assets, themes, etc.).
- Business Logic & Data Handling Layer:
– Controllers and models implementing application logic. The “controller” package (e.g., CommentsAdapter, MoodAdapter) and the “model” package (e.g., MoodDataManager, MoodDataCache, ProfileDataManager, User) represent this part.
– Offline caching and local data management mechanisms (indicated by classes like MoodDataCache and offline sync capabilities).
- Network & External Services:
– Communication modules with external APIs and services. This includes:
- Firebase integration for authentication and secure storage.
- The “network” package (e.g., SpotifyApiService, SpotifyAuthService) for external service calls.
- The “spotify” package handling Spotify-specific functionality (e.g., SpotifyManager, MoodAudioMapper).
- Testing and Quality Assurance:
– Automated UI tests (using Espresso in the androidTest directory) and unit tests (using JUnit in the test directory).

##### Relationships and Interactions
- Flow from user interactions (e.g., mood logging, editing) to data validation, offline caching, and then synchronization to Firebase.
- Specify the integration points for security measures (e.g., Firebase authentication) that are vital for handling user credentials and post privacy.

##### Architectural Patterns and Principles
- MVC/MV* Pattern: The repository of “controller” and “model” packages suggests a model-view-controller (or related MV* variation) which should be reflected in separate blocks for UI components, business logic, and data access/networking.
- Extensibility and Modularity: With dedicated packages for networking and Spotify functionalities, show standalone components that communicate via well-defined interfaces.

##### Technologies, Frameworks, and Libraries
- Android Framework (Activities, Fragments, ViewPager, RecyclerView, etc.).
- Firebase (Auth, Storage, Firestore) as external backend services.
- Network libraries such as Retrofit (implied by the implementation of API services) and utility libraries like Glide for image handling.
- Testing frameworks: Espresso (for UI tests) and JUnit (unit testing).
- Gradle as the build system (evidenced by the “build.gradle.kts” files).

##### Essential Elements
– UI Layer (Activities, Fragments, Adapters)
– Business Logic Layer (Controllers and Models such as MoodDataManager, ProfileDataManager)
– Data & Network Layer (Firebase services, Spotify Service components)
- Annotations indicating critical design patterns (MVC/MVVM, offline-first sync) and security measures like authentication.
- Notes or legends for technologies (highlight Flutter Firebase, Retrofit, Gradle, Espresso) used in corresponding parts of the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Android Application"
        subgraph "UI Layer"
            UI["Android Client (Activities,Fragements,Adapters)"]:::uiStyle
        end
        subgraph "Business Logic Layer"
            CTRL["Controllers (BusinessLogic)"]:::logicStyle
            MODEL["Models&LocalCaching"]:::logicStyle
        end
        subgraph "Data & Network Layer"
            FB["Firebase Services (Auth,Storage,Firestore)"]:::networkStyle
            SPOTIFY["Spotify Services (API&Auth)"]:::networkStyle
        end
        subgraph "Testing & QA"
            TEST["UI_Tests(Espresso)&Unit_Tests(JUnit)"]:::testStyle
        end
    end

    UI -->|"triggers"| CTRL
    CTRL -->|"updates"| MODEL
    CTRL -->|"calls"| SPOTIFY
    MODEL -->|"syncs_with"| FB
    CTRL -->|"authenticates"| FB
    TEST -->|"runs"| UI
    TEST -->|"verifies"| CTRL

    click UI "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/main/java/com/example/impostersyndrom/view"
    click CTRL "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/main/java/com/example/impostersyndrom/controller"
    click MODEL "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/main/java/com/example/impostersyndrom/model"
    click SPOTIFY "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/main/java/com/example/impostersyndrom/network"
    click SPOTIFY "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/main/java/com/example/impostersyndrom/spotify"
    click TEST "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/androidTest"
    click TEST "https://github.com/cmput301-w25/project-impostersyndrome/tree/main/code/app/src/test"

    classDef uiStyle fill:#cce5ff,stroke:#0066cc,stroke-width:2px;
    classDef logicStyle fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef networkStyle fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef testStyle fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
```
