A cross-platform Task Manager application built with Kotlin Multiplatform (KMP) demonstrating stable KMP technologies for mobile development.
This repository is set up for a 7-hour KMP training workshop.
| Branch | Purpose |
|---|---|
main |
Exercises - Contains TODO skeletons for hands-on learning |
solution |
Complete implementation - Reference for instructors and stuck participants |
- Clone this repository (you'll be on
mainbranch) - Open the project in Android Studio or IntelliJ IDEA
- Read
EXERCISES.mdfor detailed exercise instructions - Work through the exercises in order
- View solution for a specific file:
git show solution:<filepath> - Compare your work:
git diff main solution -- <filepath> - Reset a file:
git checkout -- <filepath> - Reset everything:
git checkout .
| Technology | Purpose |
|---|---|
| Room | Local SQLite database with type-safe queries |
| Koin | Dependency injection framework |
| Ktor | HTTP client for networking (with mock API demo) |
| Compose Multiplatform | Shared UI across Android and iOS |
| Navigation Compose | Type-safe navigation with animated transitions |
| Kotlinx Serialization | JSON serialization for network responses |
| Kotlinx Datetime | Cross-platform date/time handling |
| Kotlinx Coroutines | Asynchronous programming with Flow |
The project is structured into modular layers that can be integrated incrementally:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β :composeApp β
β (UI Layer: Screens, ViewModels, Navigation, DI) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β :core:data β
β (Repository implementations) β
βββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ€
β :core:database β :core:network β
β (Room: Entities, β (Ktor: HttpClient, β
β DAOs, Database) β Mock API, DTOs) β
βββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββ€
β :core:model β
β (Domain models: Task, Category, Priority) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Module | Description | Dependencies |
|---|---|---|
:core:model |
Pure Kotlin domain models (Task, Category, Priority). No platform dependencies. | kotlinx-datetime |
:core:database |
Room database layer with entities, DAOs, and platform-specific builders. | :core:model, Room |
:core:network |
Ktor HTTP client with mock API service for demonstrating network calls. | :core:model, Ktor |
:core:data |
Repository pattern implementations combining local and remote data sources. | :core:database, :core:network |
:composeApp |
Main application with UI (screens, ViewModels), navigation, and Koin DI setup. | All core modules |
Participants can integrate the modules in this order:
- Start with
:core:model- Define the domain models - Add
:core:database- Implement local persistence with Room - Add
:core:network- Set up networking with Ktor - Add
:core:data- Create repositories combining data sources - Complete with
:composeApp- Build the UI and wire everything together
kmp-training/
βββ core/
β βββ model/ # Domain models
β β βββ src/commonMain/kotlin/
β β βββ de/inovex/kmp_training/core/model/
β β βββ Task.kt
β β βββ Category.kt
β β βββ Priority.kt
β β
β βββ database/ # Room database layer
β β βββ src/
β β βββ commonMain/kotlin/
β β β βββ de/inovex/kmp_training/core/database/
β β β βββ TaskDatabase.kt
β β β βββ DatabaseBuilder.kt
β β β βββ entity/
β β β βββ dao/
β β βββ androidMain/ # Android database builder
β β βββ iosMain/ # iOS database builder
β β
β βββ network/ # Ktor networking layer
β β βββ src/
β β βββ commonMain/kotlin/
β β β βββ de/inovex/kmp_training/core/network/
β β β βββ HttpClientFactory.kt
β β β βββ MockApiService.kt
β β β βββ dto/
β β βββ androidMain/ # CIO engine
β β βββ iosMain/ # Darwin engine
β β
β βββ data/ # Repository layer
β βββ src/commonMain/kotlin/
β βββ de/inovex/kmp_training/core/data/repository/
β βββ TaskRepository.kt
β βββ TaskRepositoryImpl.kt
β βββ CategoryRepository.kt
β βββ CategoryRepositoryImpl.kt
β
βββ composeApp/ # Main application
β βββ src/
β βββ commonMain/kotlin/
β β βββ de/inovex/kmp_training/
β β βββ App.kt
β β βββ di/ # Koin modules
β β βββ ui/
β β βββ navigation/
β β βββ screens/
β β βββ components/
β β βββ theme/
β βββ androidMain/
β βββ iosMain/
β
βββ iosApp/ # iOS host app
- Create, edit, and delete tasks
- Mark tasks as completed
- Set due dates with date picker
- Assign priority levels (Low, Medium, High)
- Organize tasks by categories
- Create custom categories with colors
- Filter tasks by category
- Edit and delete categories
- Real-time search with debounce
- Filter by completion status
- Filter by priority level
- Filter by category
- Sort by creation date
- Sort by due date
- Sort by priority
- Sort alphabetically
- Mock API service demonstrating Ktor usage
- Simulated network delays for realistic behavior
- Demonstrates sync patterns for offline-first apps
./gradlew :composeApp:assembleDebug
# Install on device/emulator
adb install composeApp/build/outputs/apk/debug/composeApp-debug.apkOpen iosApp/iosApp.xcodeproj in Xcode and run the app on a simulator or device.
Or build the iOS framework:
./gradlew :composeApp:linkDebugFrameworkIosSimulatorArm64@Database,@Entity,@Daoannotations@ConstructedByfor non-Android platforms- Platform-specific database builders using
expect/actual - Flow-based reactive queries
- Shared modules across platforms
- Platform-specific initialization
- ViewModel injection with
koinViewModel()
- Platform-specific engines (CIO for Android, Darwin for iOS)
- Content negotiation with kotlinx.serialization
- Configurable logging
- Shared UI code across platforms
- Material 3 theming
- Animated navigation transitions
- Platform-specific safe area handling
- Database builders (
getDatabaseBuilder()) - HTTP client engines (
createPlatformHttpClient()) - Platform information
- Clean separation of concerns
- Each layer can be tested independently
- Incremental integration for learning
All dependencies are managed in gradle/libs.versions.toml using the Gradle Version Catalog.
This project is for educational and training purposes.