An open API service indexing awesome lists of open source software.

https://github.com/yjyoon-dev/kmp-multi-module-template

Kotlin Multiplatform Multi Modules Template for targeting Android & iOS
https://github.com/yjyoon-dev/kmp-multi-module-template

Last synced: 11 months ago
JSON representation

Kotlin Multiplatform Multi Modules Template for targeting Android & iOS

Awesome Lists containing this project

README

          

## Kotlin Multiplatform multi-module template for Android/iOS






This template is based on [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) and [Compose Multiplatform](https://www.jetbrains.com/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](https://coil-kt.github.io/coil/), [ktor](https://ktor.io/), and [koin](https://insert-koin.io/) have been added, and **awesome lint tools** such as [spotless](https://github.com/diffplug/spotless) and [detekt](https://detekt.dev/) have already been applied in optimal configuration.
**Now let’s create a KMP multi-module project quickly and easily!**


## Support
- Kotlin 2.1.10
- Compose Multiplatform 1.7.1
- AGP 8.8.0


## Multi Module




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!


## Dependencies

### Kotlin
- kotlinx-coroutines
- kotlinx-datetime
- kotlinx-serialization

### Navigation
- navigation-compose

### Data
- [Okio](https://square.github.io/okio/)
- DataStore
- SQLite
- Room
- [Ktor](https://ktor.io/)
- [Ktorfit](https://foso.github.io/Ktorfit/)

### DI
- [Koin](https://insert-koin.io/)

### Image
- [Coil](https://coil-kt.github.io/coil/)

### Lint
- [Spotless](https://github.com/diffplug/spotless)
- [Ktlint](https://github.com/pinterest/ktlint)
- [detekt](https://detekt.dev/)
- [twitter-compose-rule](https://github.com/twitter/compose-rules)


## How to use
1. First, modify `rootProject.name` on root `settings.gradle.kts`.
2. Replace all `dev.yjyoon.template` string to your package name. (Use `cmd(ctrl)`+`shift`+`R` on Android Studio)
3. Replace all `template` string to your project name.
4. Rename all package directories to your package name. (You can change all package directory names at once through Android Studio)
5. Input your name to license header on `SpotlessPlugin.kt`
6. Finally, `clean` your project.

### Gradle tasks
```java
// 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 projectDependencyGraph
```


## References
Thanks to all the projects that helped create this template!
- https://github.com/android/nowinandroid
- https://github.com/DroidKaigi/conference-app-2024
- https://github.com/droidknights/DroidKnightsApp
- https://github.com/serbelga/Todometer-KMP