Okay, here's a breakdown of the recommended libraries and architecture to help startups build native mobile applications blazing fast on Android and iOS using Kotlin Multiplatform (KMP) with Koko!
Build Faster with Koko: Your Guide to Kotlin Multiplatform Development
Welcome to Koko! We're here to help you build high-quality, native mobile applications for Android and iOS incredibly fast using Kotlin Multiplatform (KMP). We provide an opinionated guide on the best architecture and libraries, so you can focus on building amazing features, not reinventing the wheel.
Architecture: Model-View-ViewModel (MVVM) आर्किटेक्चर
We recommend the Model-View-ViewModel (MVVM) architecture for your KMP projects. It's a proven pattern that promotes a clean separation of concerns, making your codebase more maintainable, testable, and scalable.
Basics of MVVM:
- Model: Represents your application's data and business logic. It's platform-agnostic and contains the core functionality of your app. In KMP, this is often part of your shared Kotlin code.
- View: This is the UI (User Interface) that the user interacts with. It observes the ViewModel for data changes and displays them. For Android, this could be Jetpack Compose, and for iOS, SwiftUI. With Compose Multiplatform, you can even share this layer!
- ViewModel: Acts as a bridge between the Model and the View. It holds the UI-related data, prepares it for display, and handles user interactions from the View, delegating business logic to the Model. The ViewModel doesn't know about the specific View, making it highly testable.
Benefits of MVVM:
- Testability: With the UI logic separated in the ViewModel, you can easily write unit tests without needing to interact with the actual UI.
- Maintainability: Clear separation of concerns makes it easier to understand, modify, and debug your code.
- Scalability: As your application grows, MVVM helps manage complexity by keeping different parts of your app loosely coupled.
- Collaboration: Designers can focus on the View, while developers work on the ViewModel and Model, often in parallel.
- Reusability: ViewModels can be reused across different Views if the underlying data and interactions are similar.
Recommended Libraries 📚
Here are the libraries we endorse at Koko to get you up and running quickly. These have been selected for their KMP compatibility, performance, and strong community support.
Note on Bazel: While Gradle is our primary recommendation for most startups due to its widespread adoption and ease of use with KMP, Bazel is a powerful alternative build system that can offer significant build performance improvements for very large and complex projects. We include it as an option for teams that might scale to that level or have prior experience with it.
Get Started with Android Studio Narwhal 🐋 (2025.1.10 or higher)
To take full advantage of the latest KMP tooling, you'll want to use Android Studio Narwhal (version 2025.1.10) or higher. As of May 2025, this version is available in the nightly build channel.
🔗 Download Android Studio Nightly: developer.android.com/studio/nightly ↗
This version of Android Studio brings fantastic new features for KMP development:
- Live Edit for KMP: Modify your Composable functions (both in common and platform-specific code) and see the changes instantly on your running device or emulator without a full redeploy. This drastically speeds up UI development and iteration.
- Composable Preview for KMP: Preview your shared Composable UI elements directly in Android Studio, just like you would for Android-only Jetpack Compose. This allows for rapid UI prototyping and validation without needing to run the app on a device or emulator.
- KMP New Project Templates: Android Studio now includes updated and new project templates specifically designed for Kotlin Multiplatform, including templates for Compose Multiplatform that help you set up projects with shared UI for Android and iOS right from the start.
How to use these features:
- Installation:
- Download and install Android Studio Narwhal (2025.1.10 or higher) from the nightly channel.
- When creating a new project, look for the Kotlin Multiplatform App template or other KMP templates.
- Live Edit:
- Ensure your project is correctly configured for Compose Multiplatform.
- Run your application on an emulator or device.
- Make changes to your Composable functions in
commonMain
or Android-specific source sets. - You should see the changes update in the running app almost immediately.
- Preview:
- In your shared Compose code (
commonMain
), annotate your Composable functions with@Composable
and@Preview
(you might need specific imports for KMP previews). - The preview pane in Android Studio should render the UI component.
- In your shared Compose code (
- KMP Project Templates:
- Go to
File > New > New Project...
- Select the "Kotlin Multiplatform" tab or look for templates like "Kotlin Multiplatform App".
- Follow the wizard to configure your new KMP project, selecting options for iOS and shared UI with Compose Multiplatform as needed.
- Go to
For more details on these cutting-edge features, check out the official announcement: 🔗 Kotlin Multiplatform Tooling in IntelliJ IDEA and Android Studio: blog.jetbrains.com/kotlin/2025/05/kotlin-multiplatform-tooling-now-in-intellij-idea-and-android-studio/ ↗
Building Your Project: Gradle 🐘
For building your KMP application, we rely on Gradle. It's a powerful and flexible build automation tool that Kotlin Multiplatform uses to compile your code for different targets (Android, iOS, etc.), manage dependencies, and package your applications.
You'll define your project structure, dependencies (like the libraries listed above), and target platforms in Gradle build scripts (build.gradle.kts
files).
Using Room and ViewModel in KMP
For detailed, step-by-step guidance on integrating Room for local database storage and ViewModels (often with a KMP-compatible library) into your KMP project, the official Android Developer codelabs are excellent resources:
- Get started with Kotlin Multiplatform: developer.android.com/codelabs/kmp-get-started ↗
- Migrate an existing Android app's Room DB to KMP: developer.android.com/codelabs/kmp-migrate-room ↗
These codelabs will walk you through the setup and practical implementation.
Ready to build amazing apps with KMP? Koko is here to streamline your journey. Head over to gokoko.dev ↗ for more resources and to join our community!