/kmplate

Kmplate is a template to easily create a new Kotlin Multiplaform project based on Clean Architecture with modularization by features.

Primary LanguageKotlin

Kmplate

Template to easily creare new pre-configured Kotlin Multiplatform projects

Website X/Twitter

Kotlin gradle-version License


⭐️ Introduction

Kmplate is a template to easily create a new Kotlin Multiplatform project based on Clean Architecture with modularization by layer.

Current stack:

💾 Installation

1. Clone this template

Create your repository by cloning this template, using the green button at the top-right corner of the homepage. Screenshot 2024-02-21 at 18 42 43

2. Create a webhook post messages on Slack

  1. For Github Actions to post messages on Slack, you must create a new webhook URL by using the Incoming Webhook app.
  2. Create a new Github Actions secret with name SLACK_WEBHOOK_URL, and copy paste the webhook created in the previous step as value of this secret.

3. Configure the Slack bot to post on Slack

We will configure 2 Slack bots to post message on Slack: one bot to check for outdated dependencies, and one bot for the build status. To configure these 2 Slack bots, we need to create 3 Github Actions variables:

  1. SLACK_GITHUB_ACTIONS_CHANNEL_NAME: the name of the Slack channel where Github Actions will post messages (ie. myproject_build_status).
  2. SLACK_GITHUB_ACTIONS_DEPENDENCY_UPDATES_ICON_URL: the icon URL to be used as a profile picture for the "Dependency Updates" Slack bot.
  3. SLACK_GITHUB_ACTIONS_ICON_URL: the icon URL to be used as a profile picture for the "Github Actions CI" Slack bot.

4. Rename package name to your own

  1. Open buildSrc/src/main/kotlin/Dependencies.kt and rename the following things:
    1. Line 13: Replace MyProject object name with your own project name,
    2. Line 14: Replace com.tweener.changehere package name with your own package name.
  2. Open settings.gradle.kts and replace MyProjectName on line 18 with your own project name.
  3. Rename packages name (import and package) in all existing files:
    1. Click on Edit > Find > Replace in files,
    2. In the first input field, type com.tweener.changehere,
    3. In the second input field, type your own package name,
    4. Click on Replace all button.
  4. Replace com/tweener/changehere with your own directory path in the following directories:
    1. androidApp/src/main/kotlin/com/tweener/changehere
    2. shared/src/commonMain/kotlin/com/tweener/changehere
    3. shared/data/src/androidMain/kotlin/com/tweener/changehere
    4. shared/data/src/androidUnitTest/kotlin/com/tweener/changehere
    5. shared/data/src/commonMain/kotlin/com/tweener/changehere
    6. shared/data/src/iosMain/kotlin/com/tweener/changehere
    7. shared/data/src/iosTest/kotlin/com/tweener/changehere
    8. shared/domain/src/commonMain/kotlin/com/tweener/changehere
    9. shared/domain/src/commonTest/kotlin/com/tweener/changehere
  5. Open file Theme.kt and rename MyProjectTheme to your own project name. ie: AmazingAppTheme.
  6. Rename file MyProjectUIDefaults.kt to your own project name. ie: AmazingAppUIDefaults.kt.
  7. Open file NavigationBar.kt and rename MyProjectNavigationBar to your own project name. ie: AmazingAppNavigationBar.
  8. Build and run the androidApp target from Android Studio.

5. Update iOS configuration

  1. Open iosApp/myProjectName.xcworkspace in Xcode and build the project.
  2. In Xcode, in the left panel, click on iosApp, then in tab Signing & Capabilities and replace the Bundle identifier value with your own bundleID (ie. "com.mycompany.myproject"),
  3. Close Xcode and go back to Android Studio.
  4. Run the iosApp target.

6. Rename Github Actions names

  1. Open .github/workflows/buildRelease.xml and replace Kmplate on lines 1, 42 and 54 with your own name.
  2. Open .github/workflows/notify.xml and replace Kmplate on lines 21 and 33 with your own name.

7. Use your own Google Services configurations

  1. For Android, replace androidApp/google-services.json with your own google-services.json generated by Firebase.
  2. For iOS, replace iosApp/iosApp/GoogleService-Info.plist with your own GoogleService-Info.plist generated by Firebase.