Create New Module
This guide outlines how to add a new module to the project using baselines convention plugins.
1. Choose the Layer
Determine where your module belongs to maintain architectural separation:
| Layer | Purpose |
|---|---|
ui | Feature screens, navigation, theming. |
domain | Business logic, use-case orchestration, rules. |
data | Repository implementations, network, database. |
toolkit | Reusable utilities, DI, logging, crypto, etc. |
Action: Create a directory under the chosen layer (e.g., ui/profile).
2. Configure the Module
Choose the type of module you are building below.
🅰️ Option A: Multiplatform Module (Android + iOS)
Standard choice for most logic and UI.
1. Create build.gradle.kts
Create the file inside your new directory and paste the following content.
kotlin1import io.baselines.gradle.multiplatform.androidLibrary23plugins {4 alias(libs.plugins.baselines.multiplatform.kotlin)5 alias(libs.plugins.baselines.multiplatform.android.library)6 // Only needed if this module contains UI/Compose code7 alias(libs.plugins.baselines.compose)8}910// 1. Set your specific namespace11androidLibrary("com.example.ui.profile")1213// 2. Define dependencies14kotlin {15 sourceSets {16 commonMain.dependencies {17 // Shared dependencies18 }19 androidMain.dependencies {20 // Android specific21 }22 iosMain.dependencies {23 // iOS specific24 }25 }26}
2. Create Folder Structure
Create the source folders matching your namespace (e.g., com/example/ui/profile):
text1📂 src2 ┣ 📂 commonMain/kotlin/com/example/ui/profile3 ┣ 📂 androidMain/kotlin/com/example/ui/profile4 ┗ 📂 iosMain/kotlin/com/example/ui/profile
🅱️ Option B: Android-Only Module
Use for platform-specific features (e.g., Google Services, Camera, Splash).
1. Create build.gradle.kts
Create the file inside your new directory and paste the following content.
kotlin1import io.baselines.gradle.android.androidLibrary23plugins {4 alias(libs.plugins.baselines.android.library)5 // Only needed if this module contains UI/Compose code6 alias(libs.plugins.baselines.compose)7}89// 1. Set your specific namespace10androidLibrary("com.example.ui.profile")1112// 2. Define dependencies13dependencies {14 // Android dependencies15}
2. Create Folder Structure Create the standard Android source folder matching your namespace:
text1📂 src2 ┗ 📂 main/kotlin/com/example/ui/profile