# haesookimdev/hop-u architecture

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

- Interactive diagram: https://gitdiagram.com/haesookimdev/hop-u
- Repository: https://github.com/haesookimdev/hop-u

## Overview

##### Main Components

a. Client-Side (Android App)
- UI Layer (Activities and Fragments)
- ViewModel Layer
- Repository Layer
- Notification System

b. Backend Services
- Firebase Services (indicated by the google-services.json and Firebase-related classes)
- Authentication
- Real-time Database
- Cloud Messaging (FCM)

c. External Services
- Daum Maps Integration (indicated by libDaumMapAndroid.jar)
- API Services (indicated by APIService.java)

##### Frontend Architecture (Top Level)
- Main UI components:
- Main Activities (MainActivity, LogInActivity, SignUpActivity)
- Key Fragments (MainHomeFragment, NewsFragment, ConsultingFragment)
- ViewModels (LogInViewModel, SignInViewModel, DatabaseViewModel)
- Adapters for RecyclerViews

##### Data Flow Layer (Middle Level)
- Repository Pattern Implementation:
- FirebaseInstanceDatabase
- FirebaseLoginInstance
- FirebaseSignUpInstance

##### External Services (Bottom Level)
- Firebase Services
- Daum Maps API
- Custom API Services

##### Specific Implementation Details

- Blue rectangles: UI components
- Green rectangles: ViewModels
- Yellow rectangles: Repositories
- Red rectangles: External services
- Purple rectangles: Notification system

##### Connection Flows

- Data flow between components
- Authentication flow
- API calls
- Push notification path

##### Key Features to Highlight

- Chat System (MessageActivity, ChatList)
- Quiz Game Feature (QuizGameActivity)
- Integration (MapActivity)
- News System (NewsFragment, NewsMoreActivity)
- Trial System (TrialActivity)

##### Architecture Patterns to Emphasize

- MVVM Architecture (ViewModels and Repository pattern)
- Observer Pattern (for LiveData usage)
- Adapter Pattern (for RecyclerViews)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef viewmodel fill:#2ecc71,stroke:#27ae60,color:white
    classDef repository fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef notification fill:#9b59b6,stroke:#8e44ad,color:white
    
    %% UI Layer
    subgraph UI
        MA["MainActivity"]:::ui
        LA["LogInActivity"]:::ui
        SA["SignUpActivity"]:::ui
        
        subgraph Fragments
            MHF["MainHomeFragment"]:::ui
            NF["NewsFragment"]:::ui
            CF["ConsultingFragment"]:::ui
        end
        
        subgraph Chat
            MSA["MessageActivity"]:::ui
            CL["ChatList"]:::ui
            MAD["MessageAdapter"]:::ui
        end
        
        subgraph Quiz
            QGA["QuizGameActivity"]:::ui
            QF["Quiz Fragments"]:::ui
            QCF["Quiz Commentary"]:::ui
        end
        
        MAP["MapActivity"]:::ui
    end
    
    %% ViewModel Layer
    subgraph ViewModels
        LVM["LogInViewModel"]:::viewmodel
        SVM["SignInViewModel"]:::viewmodel
        DVM["DatabaseViewModel"]:::viewmodel
    end
    
    %% Repository Layer
    subgraph Repositories
        FID["FirebaseInstanceDatabase"]:::repository
        FLI["FirebaseLoginInstance"]:::repository
        FSI["FirebaseSignUpInstance"]:::repository
    end
    
    %% Notification System
    subgraph Notifications
        NFM["MyFirebaseMessaging"]:::notification
    end
    
    %% External Services
    subgraph External
        FBS["Firebase Services"]:::external
        DMA["Daum Maps API"]:::external
        API["APIService"]:::external
    end
    
    %% Relationships
    MA --> MHF & NF & CF
    LA --> LVM
    SA --> SVM
    LVM & SVM --> FLI
    DVM --> FID
    MSA --> MAD
    QGA --> QF --> QCF
    MAP --> DMA
    FID & FLI & FSI --> FBS
    NFM --> FBS
    
    %% Click Events
    click MA "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/MainActivity.java"
    click LA "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/LogInActivity.java"
    click SA "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/SignUpActivity.java"
    click MHF "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/MainHomeFragment.java"
    click NF "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/NewsFragment.java"
    click CF "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/ConsultingFragment.java"
    click LVM "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/viewModel/LogInViewModel.java"
    click SVM "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/viewModel/SignInViewModel.java"
    click DVM "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/viewModel/DatabaseViewModel.java"
    click FID "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/repository/FirebaseInstanceDatabase.java"
    click FLI "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/repository/FirebaseLoginInstance.java"
    click FSI "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/repository/FirebaseSignUpInstance.java"
    click NFM "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/notifications/MyFirebaseMessaging.java"
    click API "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/APIService.java"
    click MAP "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/MapActivity.java"
    click MSA "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/MessageActivity.java"
    click CL "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/ChatList.java"
    click MAD "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/MessageAdapter.java"
    click QGA "https://github.com/haesookimDev/HOP-U/blob/main/app/src/main/java/com/example/HOP_U/QuizGameActivity.java"
    
    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        VM_L["ViewModels"]:::viewmodel
        REPO_L["Repositories"]:::repository
        EXT_L["External Services"]:::external
        NOT_L["Notifications"]:::notification
    end
```
