# parksanggwon/movieapplication architecture

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

- Interactive diagram: https://gitdiagram.com/parksanggwon/movieapplication
- Repository: https://github.com/parksanggwon/movieapplication

## Overview

##### Main Components
- App Module (Entry Point): The “app” module contains the AndroidManifest and the MovieApplication class. It acts as the bootstrap and DI “glue” between the various modules.
- Presentation/UI Layer: Split between the “presentation” and “ui” modules. The presentation layer holds ViewModels and other presentation logic (e.g., MovieListViewModel, MovieDetailViewModel, BaseViewModel) while the ui module contains Activities, Fragments, adapters, and custom views.
- Domain Layer: The “domain” module holds the core business logic. It includes models (Movie, Genre, SummaryMovie, etc.) and use cases (e.g., GetMovieUseCase, GetActorListUseCase) that encapsulate the application’s business rules.
- Data Layer: Split into several modules:
- “data” module for repository implementations, data mappers, and business logic that transforms or aggregates data.
- “remote” module, which contains API-related classes (ApiService, RemoteDataSourceModule, interceptors) for network operations with TMDB.
- “local” module, which houses local data sources, Room database configurations, DAOs, and preference managers.
- “data-resource” module for handling resource driven data flows.
- Supporting/Common Infrastructure: Modules such as “common” (for exception handling, utility extensions, and shared utilities), “component” (for cross-cutting services like error handling, device feedback providers like haptic and toast services), “device” (for device-specific implementations including DI for device-related components), and “design” (which provides design assets, layout resources, and style extensions).

##### Relationships and Interactions
- Dependency Inversion: The domain layer depends solely on abstractions (interfaces) defined in the domain modules (e.g., the MovieRepository interface). Repository implementations reside in the data layer and are injected via dependency injection.
- Data Flow: The presentation layer invokes use cases in the domain layer. Underneath, these use cases delegate to repository implementations that coordinate between local (Room/Preferences) and remote (API calls) data sources. The “data” module then uses mappers to convert between remote responses (in the “remote” module) and local domain models.
- UI Interaction: The UI components (Activities, Fragments, and Adapters in the “ui” module) observe changes to ViewModels (from the “presentation” module) and trigger user events that flow back up to invoke domain use cases.
- Cross-Cutting Concerns: The “component”, “device”, and “common” modules provide services such as logging, error handling, haptic feedback, and toast messaging. Their DI modules (e.g., AppComponent, DeviceModule, CommonModule) wire these services into the rest of the application.

##### Architectural Patterns and Key Principles
- Modularity: Each module in the project represents a specific concern, which makes boundaries explicit. This also aids in independent testing and maintainability.
- Dependency Injection: DI components are used for wiring dependencies (see the various “di” packages and AppComponent).
- Separation of Concerns: For example, the “remote” module solely handles API interactions, the “local” module handles data persistence, and the “domain” focuses on business logic.

##### Relevant Technologies, Frameworks, and Libraries
- Android and Kotlin: The project uses Android development best practices with Kotlin.
- Room Database: In the “local” module for data persistence.
- Retrofit/Network Libraries: Likely used in the “remote/api” package for API calls.
- Dependency Injection Framework: DI is evident (perhaps Dagger or Hilt) via the various “di” modules.

##### Detail and Essential Architectural Elements
- Setup shows the interaction between UI, use cases, repository implementations, and data sources.
- Clean Architecture’s separation of concerns, making sure that dependencies only cross the boundaries in the intended directions (e.g., presentation uses domain, domain is isolated from UI).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "App/Bootstrap"
        appMovie["MovieApplication"] 
        appManifest["AndroidManifest"]
    end

    subgraph "Presentation Layer"
        presentationUI["UI Components"]
        presentationVM["ViewModels"]
    end

    subgraph "Domain Layer"
        domainLayer["Use Cases & Domain Models"]
    end

    subgraph "Data Layer"
        dataRepo["Repository & Mappers"]
        dataRemote["Remote Data Source"]
        dataLocal["Local Data Source"]
        dataResource["Data Resources"]
    end

    subgraph "Supporting Services"
        commonUtil["Common Utilities"]
        componentServices["Component Services"]
        deviceImpl["Device Implementations"]
        designAssets["Design Assets"]
    end

    %% Data flow connections
    presentationUI -->|"triggers"| presentationVM
    presentationVM -->|"calls"| domainLayer
    domainLayer -->|"delegates"| dataRepo
    dataRepo -->|"fetchesFrom"| dataRemote
    dataRepo -->|"fetchesFrom"| dataLocal
    dataRepo -->|"mapsData"| dataResource

    %% Dependency Injection (DI) connections from App/Bootstrap
    appMovie -->|"DI_injects"| presentationUI
    appMovie -->|"DI_injects"| presentationVM
    appMovie -->|"DI_injects"| dataRepo

    %% Supporting Services integrations
    designAssets -->|"providesUI"| presentationUI
    commonUtil -->|"supports"| presentationVM
    componentServices -->|"handlesErrors"| presentationUI
    deviceImpl -->|"providesDeviceService"| componentServices

    %% Click Events
    click appMovie "https://github.com/parksanggwon/movieapplication/blob/main/app/src/main/kotlin/ted/gun0912/movie/MovieApplication.kt"
    click appManifest "https://github.com/parksanggwon/movieapplication/blob/main/app/src/main/AndroidManifest.xml"
    click presentationVM "https://github.com/parksanggwon/movieapplication/tree/main/presentation/src/main/kotlin/ted/gun0912/movie/presentation"
    click presentationUI "https://github.com/parksanggwon/movieapplication/tree/main/ui/src/main/kotlin/ted/gun0912/movie/ui"
    click domainLayer "https://github.com/parksanggwon/movieapplication/tree/main/domain/src/main/kotlin/ted/gun0912/movie/domain"
    click dataRepo "https://github.com/parksanggwon/movieapplication/tree/main/data/src/main/kotlin/ted/gun0912/movie/data"
    click dataRemote "https://github.com/parksanggwon/movieapplication/tree/main/remote/src/main/kotlin/ted/gun0912/movie/remote"
    click dataLocal "https://github.com/parksanggwon/movieapplication/tree/main/local/src/main/kotlin/ted/gun0912/movie/local"
    click dataResource "https://github.com/parksanggwon/movieapplication/tree/main/data-resource/src/main/kotlin/ted/gun0912/movie/data_resource"
    click commonUtil "https://github.com/parksanggwon/movieapplication/tree/main/common/src/main/kotlin/ted/gun0912/movie/common"
    click componentServices "https://github.com/parksanggwon/movieapplication/tree/main/component/src/main/kotlin/ted/gun0912/movie/component"
    click deviceImpl "https://github.com/parksanggwon/movieapplication/tree/main/device/src/main/kotlin/ted/gun0912/movie/device"
    click designAssets "https://github.com/parksanggwon/movieapplication/tree/main/design/src/main/kotlin/ted/gun0912/movie/design"

    %% Class assignments for styling
    class appMovie,appManifest app
    class presentationUI,presentationVM presentation
    class domainLayer domain
    class dataRepo,dataRemote,dataLocal,dataResource data
    class commonUtil,componentServices,deviceImpl,designAssets supporting

    %% Styles
    classDef app fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef domain fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef data fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef supporting fill:#DDA0DD,stroke:#333,stroke-width:2px;
```
