Skip to content

inovexAcademy/kmp-training

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

KMP Task Manager - Training Edition

A cross-platform Task Manager application built with Kotlin Multiplatform (KMP) demonstrating stable KMP technologies for mobile development.

πŸŽ“ Training Information

This repository is set up for a 7-hour KMP training workshop.

Branch Structure

Branch Purpose
main Exercises - Contains TODO skeletons for hands-on learning
solution Complete implementation - Reference for instructors and stuck participants

Getting Started

  1. Clone this repository (you'll be on main branch)
  2. Open the project in Android Studio or IntelliJ IDEA
  3. Read EXERCISES.md for detailed exercise instructions
  4. Work through the exercises in order

If You Get Stuck

  • 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 .

Technologies Used

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

Module Architecture

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 Descriptions

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

Integration Order for Training

Participants can integrate the modules in this order:

  1. Start with :core:model - Define the domain models
  2. Add :core:database - Implement local persistence with Room
  3. Add :core:network - Set up networking with Ktor
  4. Add :core:data - Create repositories combining data sources
  5. Complete with :composeApp - Build the UI and wire everything together

Project Structure

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

Features

Task Management

  • 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

Categories

  • Create custom categories with colors
  • Filter tasks by category
  • Edit and delete categories

Search & Filtering

  • Real-time search with debounce
  • Filter by completion status
  • Filter by priority level
  • Filter by category

Sorting

  • Sort by creation date
  • Sort by due date
  • Sort by priority
  • Sort alphabetically

Remote Sync (Demo)

  • Mock API service demonstrating Ktor usage
  • Simulated network delays for realistic behavior
  • Demonstrates sync patterns for offline-first apps

Running the App

Android

./gradlew :composeApp:assembleDebug
# Install on device/emulator
adb install composeApp/build/outputs/apk/debug/composeApp-debug.apk

iOS

Open iosApp/iosApp.xcodeproj in Xcode and run the app on a simulator or device.

Or build the iOS framework:

./gradlew :composeApp:linkDebugFrameworkIosSimulatorArm64

Key KMP Concepts Demonstrated

1. Room Database (Multiplatform)

  • @Database, @Entity, @Dao annotations
  • @ConstructedBy for non-Android platforms
  • Platform-specific database builders using expect/actual
  • Flow-based reactive queries

2. Koin Dependency Injection

  • Shared modules across platforms
  • Platform-specific initialization
  • ViewModel injection with koinViewModel()

3. Ktor HTTP Client

  • Platform-specific engines (CIO for Android, Darwin for iOS)
  • Content negotiation with kotlinx.serialization
  • Configurable logging

4. Compose Multiplatform

  • Shared UI code across platforms
  • Material 3 theming
  • Animated navigation transitions
  • Platform-specific safe area handling

5. expect/actual Pattern

  • Database builders (getDatabaseBuilder())
  • HTTP client engines (createPlatformHttpClient())
  • Platform information

6. Modular Architecture

  • Clean separation of concerns
  • Each layer can be tested independently
  • Incremental integration for learning

Dependencies

All dependencies are managed in gradle/libs.versions.toml using the Gradle Version Catalog.

License

This project is for educational and training purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published