بنقرة واحدة
kmp-modules
// Guidance on where to place different types of code in this Kotlin Multiplatform project.
// Guidance on where to place different types of code in this Kotlin Multiplatform project.
Audit repo dependencies by default and only apply library upgrades when explicitly requested.
Use Gradle commands to build and run the app by platform.
How to run, write, and debug local UI tests for Android, iOS, and browser builds.
How to list, pick, and boot Android emulators and iOS simulators for local app runs.
Guidelines for where to place different types of code in a Kotlin Multiplatform project.
How to create plans and follow roadmaps
| name | kmp-modules |
| description | Guidance on where to place different types of code in this Kotlin Multiplatform project. |
This repository follows standard Kotlin Multiplatform source-set conventions, organized into distinct modules, each serving a specific purpose.
The project is divided into three primary modules. Understanding their responsibilities and dependencies is key to placing code in the correct location.
sharedLib (Shared Logic)This is the core module containing all business logic, data models, state management, and storage mechanisms.
cliApp or composeApp.expect/actual declarations.composeApp (GUI Library)This module contains most of the common Graphical User Interface (GUI) application code, built using Compose Multiplatform.
sharedLib to fetch data, observe state, and trigger actions.sharedLib.<platform>Main source sets.main window) and iOS (framework) within their source sets.androidApp (Android App Entry Point)This is a thin wrapper module that hosts the Android application entry point.
Application class, Activity, manifest, and app-level resources (icons, strings).composeApp which provides all the shared UI and business logic.TwoFacApplication (Application class) and MainActivity (Activity).AndroidManifest.xml with application/activity declarations.composeApp/androidMain.cliApp (Command Line Interface)This module contains code specifically related to the Command Line Interface application.
sharedLib to perform corresponding operations without needing a graphical interface.mordant).Within each Kotlin Multiplatform module (especially sharedLib and composeApp), the code is further organized by source sets:
commonMain: Shared production code that is platform-agnostic. Most of the code should live here.commonTest: Shared tests for testing code in commonMain.<platform>Main (e.g., jvmMain, iosMain, androidMain): Platform-specific implementations. Place code here when you need to access platform APIs (e.g., java.io.File on JVM, NSUserDefaults on iOS) that are not available in the common standard library.<platform>Test: Platform-specific tests.sharedLib/src/commonMain.sharedLib that are easy to consume for both declarative reactive UIs (composeApp) and procedural/terminal UIs (cliApp).expect/actual mechanism.