Note
This branch is designed for partial customized projects. Running the customizer.sh script doesn't rename any application module, instead it'll change all core
and feature
module namespaces, packages, and other related configurations accordingly.
and change your android and desktop application id and namespace in libs.versions.toml
file.
For full customization, please use the full-customizable
branch instead.
The Kotlin Multiplatform Multi-module Project generator simplifies the development of cross-platform applications for Android, iOS, Desktop(JVM), and Web.
Unlike other wizards that only generate a basic Kotlin Multiplatform (KMP) or Compose Multiplatform (CMP) library and require users to configure their projects manually—a challenging and time-consuming process.
This generator streamlines the setup. By simply running the customizer.sh
bash script
with your desired package and project name, the template generates an entire, fully-configured
project in just few minutes.
The resulting project is ready to run seamlessly across multiple platforms, combining shared business logic and UI components with native platform capabilities.
This template goes beyond the basics, offering a production-ready setup out of the box. It includes:
- Multi-module Structure: Organized core, feature, and platform-specific modules for easy development.
- Shared UI Components: Compose Multiplatform for shared UI components across platforms.
- Dependency Management: Gradle Kotlin DSL for dependency management and build scripts.
- Static Analysis Tools: Pre-configured Detekt and Spotless for code quality and style consistency.
- Git Hooks: Automated checks to ensure high-quality commits.
- CI/CD Workflows: GitHub Actions for KMP build and publish pipelines, complete with PR checks.
- Fastlane: Automated deployment and release management for Android and iOS platforms.
- Run configurations: for Android, iOS, Desktop, and Web platforms.
- Dynamic Versioning: Automatic versioning and release notes generation for each platform.
The generated project is ready to run seamlessly across multiple platforms, combining shared business logic and UI components with native platform capabilities.
The project includes a bash script (customizer.sh
) that helps in customizing the project for
different implementations. This script automates the process of renaming packages, updating
configurations, and maintaining consistency across the project structure.
- Bash version 4 or higher
- Unix-like environment (macOS, Linux) or Git Bash on Windows
-
Download the project: Clone or download the repository to your local machine.
git clone <repository-url> cd <project-folder>
-
Run the setup script: Execute the customizer.sh script with your desired package and project name.
./customizer.sh <package-name> <project-name> [application-name]
Example:
./customizer.sh org.delta MyKMPApp
-
Generated project: The script will generate a fully-configured, multi-module KMP project in just 2 minutes.
-
Run and develop: Open the project in your favorite IDE (e.g., IntelliJ IDEA), and start building your cross-platform application.
package-name
: New package name (e.g., com.example.myapp)project-name
: New project nameapplication-name
: (Optional) Custom application name (defaults to project-name)
After running the customizer script to change package names and project structure, you'll need to update the license and copyright information across the project. This process involves:
- Locate License Files
- Navigate to the
spotless
directory - Find the license header templates
- Update the copyright year and organization information
- Navigate to the
- Apply Changes
- Run the Spotless plugin to update all files:
./gradlew spotlessApply
- This will automatically update the license headers in all source files
- Verify the changes in a few files to ensure correct application
- Run the Spotless plugin to update all files:
- Create a new feature module in the
feature/
directory - Follow the existing module structure
- Use shared components from
core/
modules - Implement platform-specific code in respective modules
- Use
expect/actual
declarations for platform-specific implementations - Leverage Compose Multiplatform for UI components
- Keep business logic in shared modules
- Use KMP-compatible dependencies
- Use appropriate run configurations for each platform
- Ensure all required SDKs are installed
- Follow platform-specific build instructions
- buildLogic/: Contains shared Gradle build configurations and custom plugins
- core/: Contains the main business logic modules
analytics
: Analytics and logging utilitiescommon
: Shared code across all platformsmodel
: Data models and structuresdata
: Data layer implementationnetwork
: Network communication and API clientsdomain
: Business logic and use casesui
: Shared UI components using Compose Multiplatformdesignsystem
: App-wide design system componentsdatastore
: Local data storage implementation
- feature/: Contains feature-specific modules
home
: Home screen and related functionalityprofile
: User profile managementsettings
: Application settings
- cmp-android/: Android application implementation
- cmp-ios/: iOS application implementation
- cmp-desktop/: Desktop application implementation
- cmp-web/: Web application implementation
- cmp-shared/: Shared Kotlin Multiplatform code
graph TD
A[Project Root] --> B[buildLogic]
A --> C[core]
A --> D[feature]
A --> E[Platform Modules]
C --> C1[common]
C --> C2[model]
C --> C3[data]
C --> C4[network]
C --> C5[domain]
C --> C6[ui]
C --> C7[designsystem]
C --> C8[datastore]
D --> D1[home]
D --> D2[profile]
D --> D3[settings]
E --> E1[cmp-android]
E --> E2[cmp-ios]
E --> E3[cmp-desktop]
E --> E4[cmp-web]
E --> E5[cmp-shared]
subgraph Core Modules
C1
C2
C3
C4
C5
C6
C7
C8
end
subgraph Feature Modules
D1
D2
D3
end
subgraph Platform Implementation
E1
E2
E3
E4
E5
end
- Follow the project's coding standards
- Write tests for new features
- Document changes and additions
- Submit pull requests with clear descriptions
- Check build logs for errors
- Verify module dependencies
- Ensure correct SDK versions
- Check platform-specific configurations