This template is based on Kotlin Multiplatform and Compose Multiplatform for developing both Andorid and iOS apps. It is modularized into several feature modules and core modules, and new modules can be easily added using already defined Custom Gradle Plugins and Version Catalog. In addition, essential libraries that support multi-platforms such as coil, ktor, and koin have been added, and awesome lint tools such as spotless and detekt have already been applied in optimal configuration. Now let’s create a KMP multi-module project quickly and easily!
- Kotlin 2.1.10
- Compose Multiplatform 1.7.1
- AGP 8.8.0
| Name | Responsibilities |
app
|
Brings everything together required for the app to function correctly. This includes UI scaffolding and navigation. |
feature:main |
Functionality associated with a specific feature or user journey. Typically contains UI components and ViewModels which read data from other modules. |
core:data
|
Fetching app data from multiple sources, shared by different features. |
core:designsystem
|
Design system which includes Core UI components such as customized Material 3 components. |
core:ui
|
Composite UI components and resources used by feature modules. Unlike the designsystem module, it is dependent on the data layer since it renders models.
|
core:common
|
Common classes shared between modules. |
core:network
|
Making network requests and handling responses from a remote data source. |
core:datastore
|
Storing persistent data using DataStore. |
core:database
|
Local database storage using Room. |
core:model
|
Model classes used throughout the app. |
Now you can add feature modules as you want!
- kotlinx-coroutines
- kotlinx-datetime
- kotlinx-serialization
- navigation-compose
- First, modify
rootProject.nameon rootsettings.gradle.kts. - Replace all
dev.yjyoon.templatestring to your package name. (Usecmd(ctrl)+shift+Ron Android Studio) - Replace all
templatestring to your project name. - Rename all package directories to your package name. (You can change all package directory names at once through Android Studio)
- Input your name to license header on
SpotlessPlugin.kt - Finally,
cleanyour project.
// format your codes with ktlint rules
./gradlew spotlessCheck
./gradlew spotlessApply
// run code static analysis with twitter compose rules
./gradlew detekt
// generate project dependency graph (need to install graphviz)
./gradlew projectDependencyGraphThanks to all the projects that helped create this template!
