This quotes app targets Android, iOS and Desktop platforms, and is developed using Kotlin Multiplatform, JetBrains Compose Multiplatform, App Modularization, Clean Architecture and other Jetpack Components and multiplatform libraries. Project is developed in TDD (Test Driven Development) style by writing Unit and UI tests.
This Github project contains 5 main branches:
main -> Latest version of the project using Kotlin MultiPlatform targetting ios and android platforms. UI side of the project is implemented using JetBrains Compose Multiplatform.
compose_ui_android -> Android version of the project using Jetpack Compose UI
mvvm -> Initial version written in mvvm pattern
clean-architecture-layered -> Second refactoring from mvvm to clean architecture (creating UseCases, and separate modules (domain, data, presentation).
multi_modular -> Third refactoring using modularization (separating domain, data presentation layers as a package inside each feature module)
Related Blog Posts
Achieving iOS Compatibility(KMM+Compose Multiplatform) : https://medium.com/p/edd364854a0d
Migrating to Jetpack Compose: https://medium.com/p/b7f57504df2b
Refactoring of architecture of this project: https://medium.com/p/ef6cdcb409a
JetBrains Compose Multiplatform - For providing shared UI for android and ios
Koin - For dependency injection
Napier - Logging library
Navigation - https://github.com/chRyNaN/navigation
Kotlinx Datetime - A multiplatform Kotlin library for working with date and time
Ktor - Networking library for both in server and client side
Moko Resources - A multiplatform Kotlin library for sharing resources
Backend is developed using Kotlin and Ktor library. MongoDB database is used and it is deployed in Google App Engine.
All feature modules are included in shared multiplatform root module. Main responsibility of root module is providing dependencies using Koin Dependency Injection, navigation between modules, and providing MainView for android, ios and desktop platforms.
:shared:feature:quotes: This module is for listing and adding new quotes.
:shared: feature:profile: This module is for viewing profile.
Each feature module is multiplatform module that is developed using Clean Architecture, and inside each module there are 3 packages (domain, data, presentation) for separating layers. Because in kotlin there is no package visibility modifier, custom Clean Architecture detekt rule is created in :customdetektrules module, and this module is implemented in each feature module in order not to breaking clean architecture rules. Beside that each feature module includes :shared:common:core and :shared:common:ui modules. For testing purposes :shared:test-utils is also included in feature modules.
:shared:common:core: This module contains core objects that can be used in every multiplatform library module, like Result or ErrorEntity classes.
:shared:common:ui: This module contains main styling, coloring, theming of the project. It also includes some UI helper classes.
Contains helper classes for making testing easier. It is included in each module for both Unit and Instrumentation Tests.
Custom rules for checking code styles using detekt are created in this module.
One custom rule that is created inside module is Clean Architecture Rule which checks that
if any violation of architecture occurred in somewhere in the code.
Code style can be checked by running this gradle command: ./gradlew detekt
The project uses the Kotlin DSL to make it easy to include new dependencies and versions of libraries and modules. These are included inside buildSrc module. Inside buildSrc module common multiplatform library gradle script is also created for making gradle files of modules more readable.
./gradlew ktlintFormat
- Checks kotlin code styles and format it if possible.
./gradlew detekt
- Checks kotlin code styles and custom code styles that is created inside customDetektRules module.
./gradlew unitTestReport
- Code coverage report for Unit tests.
./gradlew androidTestReport
- Code coverage report for both Android and Unit tests.
*Each time when adding new commit pre-commit hook script will run, which checks if there is any code style problem before committing it to Github. This can be skipped using git commit --no-verify, but it will run again in CI using Github actions.
You can download the apk, and can add your own quote :).
demo.mov
Uploading desktopdemo.mov…