A modern, cross-platform recipe application built entirely with Kotlin Multiplatform (KMP) and Compose Multiplatform. This project showcases a single, shared codebase for UI, business logic, and data handling, targeting both Android and iOS.
It is architected for scalability, testability, and a robust offline-first experience, demonstrating a production-grade implementation of the latest KMP stack.
- Truly Cross-Platform: A single
commonMaincodebase, written in Kotlin, powers both the Android and iOS applications. - Shared Declarative UI: The entire user interface is built and shared using Compose Multiplatform, providing a reactive, platform-agnostic UI layer.
- Offline-First Persistence: Implements a robust offline strategy using Room Multiplatform for persistent database storage (e.g., saved recipes) and DataStore for user preferences.
- Modern KMP Networking: Leverages Ktor Client for all network operations, with Kotlinx Serialization for efficient, type-safe JSON parsing.
- Modular Dependency Injection: Utilizes Koin as a KMP-native DI framework to manage dependencies and a clean, decoupled architecture across all modules (common, Android, iOS).
- Asynchronous Image Loading: Uses Coil 3 for KMP, ensuring efficient fetching, caching, and display of recipe images from network sources.
- Android App Widgets: Provides rich homescreen functionality using the modern Glance API for app widgets.
This project follows a strict Clean Architecture + MVVM pattern, fully adapted for Kotlin Multiplatform:
- UI Layer (
commonMain): Shared Compose Multiplatform screens and ViewModels (using Koin's ViewModel integration) that manage and observe state. - Domain Layer (
commonMain): Encapsulates all business logic, use cases, and repository interfaces. This layer is pure Kotlin and has no platform dependencies. - Data Layer (
commonMain): Contains repository implementations that abstract data sources. It uses Ktor for remote API calls and Room for local database caching. - Dependency Injection: Koin is used to inject dependencies (like Repositories, Use Cases, and ViewModels) throughout the
commonMain,androidMain, andiosMainsource sets.
This architecture ensures a single source of truth across platforms, maximizes code reuse (UI, logic, data), and maintains a clean, testable, and scalable structure.
- Android Studio Iguana (2023.2.1+)
- Xcode 15+ (for running the iOS target)
- JDK 17
- Android device/emulator running API 24+
Clone the repository:
git clone [https://github.com/yourusername/trecipe.git](https://github.com/yourusername/trecipe.git)
cd trecipe- For Android: Open the project in Android Studio, select the
androidApprun configuration, and deploy to a device or emulator. - For iOS: Open the project in Android Studio and select an iOS target, or open the
iosApp/iosApp.xcworkspacefile in Xcode and run from there.
This app is more than a simple recipe holder; it serves as a technical blueprint for building modern, production-ready KMP applications.
- True KMP Implementation: This isn't just shared logic; it's a demonstration of shared UI (Compose Multiplatform), shared data persistence (Room), and shared networking (Ktor).
- Robust Offline Strategy: It correctly implements a sophisticated offline-first model using Room's multiplatform capabilities, a non-trivial task that is critical for a high-quality user experience.
- Platform-Specific Integration: It shows how to integrate platform-specific features (like Android's Glance App Widgets) while keeping the core application logic 100% shared and platform-agnostic.
- Modern, End-to-End Stack: The project relies entirely on the modern KMP ecosystem (Ktor, Koin, Coil 3, Room) rather than legacy libraries, showcasing proficiency in the current best practices for cross-platform development.