How vladimirlogachov/moviespot works
Main Components of the System
• Native Application Shells:
• Android Module (androidApp): Contains Android-specific application files, resources, manifests, and entry points (e.g. MainActivity and MoviesPotApp).
• iOS Module (iosApp): Contains Xcode project files, iOS-specific assets, and application entry point (e.g. iOSApp.swift, MainViewController, etc.).
• Shared Modules:
• shared-data: Implements networking (using Ktor), local storage (possibly with multiplatform settings), and repository implementations that fetch movie data from the TMDB API.
• shared-domain: Encapsulates business logic, models (e.g. Movie, Genre, Settings) and use cases (e.g. DiscoverMovies, SearchMovies, LoadDetails). This layer handles the core decisions and rules that are platform agnostic.
• shared-presentation: Contains shared UI logic and components, including Compose screens, navigation (Jetpack Navigation on Android), theme definitions (Material 3 dynamic themes), dependency injection configurations (using Koin) and view models that bind the UI to domain logic. It further has platform-specific implementations for Android, iOS, desktop, and web (WASM/JS).
Relationships and Interactions
• The shared-presentation layer calls use cases from the shared-domain layer to retrieve or manipulate data.
• The shared-domain layer, in turn, interacts with repositories and data sources defined in shared-data.
• Native modules (androidApp and iosApp) serve as entry points that initialize the application and setup platform-specific configurations. They rely on the shared code for business and UI functionalities.
• Configuration and build files (build.gradle.kts, settings.gradle.kts, gradle.properties) indicate build-time dependency management and project setup, supporting multiplatform compilation.
• The communication with the TMDB API is managed from the repositories (RemoteMovieRepository, RemoteDiscoverRepository, etc.) present in shared-data, and results are transformed via HTTP utilities and mapping to domain models.
Architectural Patterns and Design Principles
• Layered Architecture: Clear separation of concerns into Data, Domain, and Presentation layers.
• Multiplatform: Common code repositories preventing duplication across Android, iOS, web, and even desktop.
• MVVM or MVI patterns (hinted by the presence of use cases, view models, and view state classes in shared-presentation).
• Dependency Injection handled by Koin for modularity and easier testing.
• Asynchronous Data Flows using Kotlin Coroutines Flow for reactive UI updates.
• Modular composition, where each layer interacts only via well-defined interfaces and dependency boundaries.
Relevant Technologies & Frameworks
• Kotlin Multiplatform for shared code.
• Compose Multiplatform and Material 3 design for the UI.
• Jetpack Navigation and Paging for Android navigation and data pagination.
• Ktor for network calls.
• Koin for dependency injection.
• Additional testing libraries like Turbine, Mokkery, and Detekt for static analysis.