Notflix is a Kotlin Multiplatform app that demonstrates cross-platform development using a single codebase and Compose Multiplatform for a consistent UI across Android, iOS and desktop(Linux, Windows & macOS) devices.
It consumes the TMDB API to fetch movie data and display it on all platforms.
Note
This repository is under constant development/refactor since the project is designed to showcase the basics of Kotlin/Compose Multiplatform and is not intended for production use
- JDK - Required for Android development.
- Android Studio - For Android development and project management.
- Xcode - For iOS development and project management.
- Kotlin Multiplatform Plugin- In Android Studio, select Settings/Preferences | Plugins, search Marketplace for Kotlin Multiplatform, and then install it.
- Clone the repository from GitHub:
git clone https://github.com/VictorKabata/Notflix.git
To install the android application:
- Open the project in Android Studio and connect your android device/emulator.
- Configure the TMDB API key in the
local.properties
file.
api_key=<YOUR TMDB API KEY>
- Sync the Gradle project to download dependencies.
- Run the gradle command below from Android Studio terminal to build and install the android application on the connected android device/emulator:
./gradlew installDebug
To install the iOS application:
- Open the iOS project from XCode and connect your iOS device/emulator.
- Run the project.
To install the desktop application:
- Open the project in Android Studio and run the gradle command below to build and install the application on the desktop:
gradlew desktopRun
The application has two main modules:
- composeApp: This is the core module containing the shared Kotlin Multiplatform code for network, caching, and UI logic.
-
androidMain: Contains Android-specific code, primarily serving as an entry point for the Android application. This directory includes the MainActivity class, application-level configuration, and Android-specific dependencies or initialization.
-
iOSMain: Contains iOS-specific code, primarily serving as an entry point for the iOS application. This directory includes the ContentView class, application-level configuration, and iOS-specific initialization for Koin.
-
desktopMain: Contains desktop-specific code, primarily serving as an entry point for the desktop application. This directory includes the main application class, window creation, and desktop-specific dependencies or initialization.
-
commonMain: Contains the core business logic, data access, and UI components that are shared across all platforms.
- domain: This package houses the domain layer, which defines the business logic and entities of the application. It typically includes interfaces, data classes, and utils.
- data: This package houses the data layer, which is responsible for fetching and caching data. It might include repositories, data sources, and network clients.
- ui: This package houses the UI components that are shared across all platforms. These components can be implemented using Compose Multiplatform, allowing for a consistent user experience.
- di: Contains the dependency injection setup, managing the creation and provision of dependencies throughout the application.
- appiOS: This module houses the iOS-specific app code, serving as the entry point for the iOS application, providing the necessary configuration and integration with the shared composeApp module.
- Kotlin Multiplatform - The foundation of the project, enabling shared code across platforms.
- Compose Multiplatform - Enables building consistent UI components for Android, iOS, and desktop.
- KotlinX Coroutines - Manages asynchronous operations for efficient app performance.
- Datastore - Provides a mechanism for storing and retrieving key value pairs like user preferences.
- Koin - A dependency injection framework for managing dependencies throughout the application.
- kotlinx.serialization - Enables serialization and deserialization of data objects.
- Ktor - A multiplatform HTTP client for making network requests and handling responses.
- Napier - A logging library for providing detailed logs during development.
- kotlinx.datetime - A multiplatform Kotlin library for working with date and time.
- Room - Provides a persistence layer for storing data locally.
- Paging - Enables efficient handling of large datasets for pagination in UI components.
- BuildKonfig - Supports embedding values from gradle file.
- Coil3 - Compose Image library for Kotlin Multiplatform
- Jetpack Navigation - Provides navigation components for handling UI transitions within the app.
- KMP Palette - Provides tools for working with colors on multiple platforms.
- Ktlint: For enforcing code style consistency.
- Detekt: For static code analysis and quality checks.
In this section I've included some resources ie. articles and GitHub repositories that i used to learn about kotlin multiplatform:
- Your First Kotlin Multiplatform Mobile App Tutorial
- Sharing Code between iOS and Android with Kotlin #1
- Kotlin Multiplatform Hands-on: Networking and Data Storage
- KaMPKit General Architecture
- Using Koin in a Kotlin Multiplatform Project
- Create your first cross-platform mobile app – tutorial - Learn how to create and run your first Kotlin Multiplatform Mobile application.
- Kotlin Multiplatform. Very beginner’s guide (part 1-3)
- Using Realm persistence library in a Kotlin Multiplatform project
- KMM Sample - A sample project for experiments with Kotlin Multiplatform mobile.
- Fantasy Premier League - Kotlin Multiplatform project with Jetpack Compose, Compose for Desktop and SwiftUI clients (and using Ktor for remote API requests and Realm for persistence).
- KaMPKit
- People In Space - Minimal Kotlin Multiplatform project with SwiftUI, Jetpack Compose, Compose for Wear OS, Compose for Desktop, Compose for Web, and Kotlin/JS + React clients along with Ktor backend.
- Poetree - Poetree is a minimalistic poetry app that helps people freely access art from a global community full of poetry lovers.