# boostcampwm-2024/ios05-heim architecture

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

- Interactive diagram: https://gitdiagram.com/boostcampwm-2024/ios05-heim
- Repository: https://github.com/boostcampwm-2024/ios05-heim

## Overview

##### Main Components

a. Presentation Layer:
- UI Components (organized by features):
- Record Feature
- Diary Detail
- Music Match
- Report
- Settings
- MVVM-C Architecture components for each feature
- Common UI components and extensions

b. Domain Layer:
- Use Cases
- Entities
- Repository Interfaces
- Error Handling
- ML Model Integration

c. Data Layer:
- Repositories Implementation
- Network Providers
- Storage Implementations
- External Services Integration:
- Gemini AI
- Spotify Integration
- CoreML Integration

##### Key Architectural Elements

- Clean Architecture layers with clear boundaries
- MVVM-C pattern implementation
- Data flow between components
- External service integrations
- Core features implementation

**[User Interface Layer]**
- ↑↓
**[Presentation Layer (MVVM-C)]**
- ↑↓
**[Domain Layer]**
- ↑↓
**[Data Layer]**
- ↑↓
**[External Services/Infrastructure]**

##### Component Relationships

- Data flow direction
- Dependencies between layers
- Communication patterns
- Event handling

##### Special Focus Areas

Following key features:
- Voice Recording & Processing Pipeline
- Emotion Analysis Flow using CoreML
- Gemini AI Integration for Response Generation
- Spotify Music Integration
- Local Storage Implementation

##### Technical Details

- Swift Concurrency flows
- Combine data binding patterns
- Repository pattern implementation
- Coordinator pattern flow
- Error handling paths

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        Record["Record Feature"]:::ui
        DiaryDetail["Diary Detail"]:::ui
        MusicMatch["Music Match"]:::ui
        Report["Report"]:::ui
        Settings["Settings"]:::ui
    end

    subgraph PL["Presentation Layer (MVVM-C)"]
        RecordMVVM["Record MVVM"]:::presentation
        DiaryMVVM["Diary MVVM"]:::presentation
        MusicMVVM["Music MVVM"]:::presentation
        ReportMVVM["Report MVVM"]:::presentation
        SettingsMVVM["Settings MVVM"]:::presentation
    end

    subgraph DL["Domain Layer"]
        UseCases["Use Cases"]:::domain
        Entities["Entities"]:::domain
        RepoInterfaces["Repository Interfaces"]:::domain
        MLModel["Emotion Classifier ML Model"]:::ml
    end

    subgraph DataL["Data Layer"]
        Repositories["Repositories"]:::data
        NetworkProviders["Network Providers"]:::data
        Storage["Storage"]:::data
    end

    subgraph External["External Services"]
        GeminiAI["Gemini AI"]:::external
        SpotifyAPI["Spotify API"]:::external
        CoreML["CoreML"]:::external
    end

    subgraph Core["Core Infrastructure"]
        DI["DI Container"]:::infra
        Logger["Logger"]:::infra
        NetworkInfra["Network Infrastructure"]:::infra
        DataStorage["Data Storage"]:::infra
    end

    %% Relationships
    Record --> RecordMVVM
    DiaryDetail --> DiaryMVVM
    MusicMatch --> MusicMVVM
    Report --> ReportMVVM
    Settings --> SettingsMVVM

    RecordMVVM --> UseCases
    DiaryMVVM --> UseCases
    MusicMVVM --> UseCases
    ReportMVVM --> UseCases
    SettingsMVVM --> UseCases

    UseCases --> Entities
    UseCases --> RepoInterfaces
    UseCases --> MLModel

    RepoInterfaces --> Repositories
    Repositories --> NetworkProviders
    Repositories --> Storage

    NetworkProviders --> GeminiAI
    NetworkProviders --> SpotifyAPI
    MLModel --> CoreML

    %% Core Infrastructure Connections
    DI -.-> PL
    Logger -.-> DataL
    NetworkInfra -.-> NetworkProviders
    DataStorage -.-> Storage

    %% Click Events
    click Record "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Presentation/Presentation/Record/"
    click DiaryDetail "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Presentation/Presentation/Detail/DiaryDetail/"
    click MusicMatch "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Presentation/Presentation/Music/"
    click Report "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Presentation/Presentation/Report/"
    click Settings "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Presentation/Presentation/Setting/"
    click UseCases "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Domain/Domain/UseCase/"
    click Entities "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Domain/Domain/Entity/"
    click RepoInterfaces "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/Domain/Domain/Interface/Repository/"
    click MLModel "https://github.com/boostcampwm-2024/iOS05-Heim/blob/develop/Heim/Domain/Domain/MLModel/EmotionClassifier.mlmodel"
    click Repositories "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/DataModule/DataModule/Repository/"
    click NetworkProviders "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/NetworkModule/NetworkModule/NetworkProvider/"
    click Storage "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/DataStorage/DataStorageModule/"
    click GeminiAI "https://github.com/boostcampwm-2024/iOS05-Heim/blob/develop/Heim/DataModule/DataModule/API/GeminiAPI.swift"
    click SpotifyAPI "https://github.com/boostcampwm-2024/iOS05-Heim/blob/develop/Heim/DataModule/DataModule/API/SpotifyAPI.swift"
    click DI "https://github.com/boostcampwm-2024/iOS05-Heim/blob/develop/Heim/Core/Core/DIContainer/DIContainer.swift"
    click Logger "https://github.com/boostcampwm-2024/iOS05-Heim/blob/develop/Heim/Core/Core/Logger/Logger.swift"
    click NetworkInfra "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/NetworkModule/NetworkModule/"
    click DataStorage "https://github.com/boostcampwm-2024/iOS05-Heim/tree/develop/Heim/DataStorage/DataStorageModule/"

    %% Styles
    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef presentation fill:#42A5F5,stroke:#1E88E5,color:white
    classDef domain fill:#4CAF50,stroke:#388E3C,color:white
    classDef data fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef infra fill:#757575,stroke:#616161,color:white
    classDef ml fill:#F44336,stroke:#D32F2F,color:white
```
