A CLI helping configure Firebase for Kotlin Multiplatform / Compose Multiplatform applications quickly and easily
Command: kmpfire — register Android / iOS Firebase apps and write native config from the terminal
A CLI to help with using Firebase in your Kotlin Multiplatform / Compose Multiplatform applications.
It wraps the Firebase CLI (firebase-tools) to register Android / iOS apps, write native service files, and track configuration in firebase.json.
Autodownload configuration files for Android and iOS apps, and patch the project files to use them.
LnyO34VlYKmxhYkx.mp4
- Firebase CLI installed and logged in (
firebase login) - A KMP / CMP project root (
settings.gradle.kts) - To build this repo: JDK 21+
| Layout | Paths |
|---|---|
| New template | shared/ + androidApp/ + iosApp/ |
Nested app/ (monorepo) |
app/shared/ + app/androidApp/ + app/iosApp/ |
| Legacy | composeApp/ + iosApp/ |
Platforms in v1: Android + iOS only (no desktop / web Firebase targets).
curl -fsSL https://raw.githubusercontent.com/dungngminh/kmpfire_cli/main/install.sh | bashPin a release tag:
curl -fsSL https://raw.githubusercontent.com/dungngminh/kmpfire_cli/main/install.sh | bash -s -- v0.2.0Installs into ~/.local/lib/kmpfire and links ~/.local/bin/kmpfire (adds that dir to your shell PATH if needed).
brew tap dungngminh/kmpfire_cli
brew install kmpfireRequires the tap repo dungngminh/homebrew-kmpfire_cli (updated on each GitHub Release).
Download kmpfire-<os>-<arch>.tar.gz from Releases, extract, rename to kmpfire, and put it on your PATH.
kmpfire --help
# Footer shows: kmpfire <version>git clone https://github.com/dungngminh/kmpfire_cli.git
cd kmpfire_cli
# Fast JVM path (dev):
./gradlew jvmRun --args='--help'
# Native release binary (example: Apple Silicon):
./gradlew linkReleaseExecutableMacosArm64
./build/bin/macosArm64/releaseExecutable/kmpfire.kexe --helpOther native hosts: MacosX64, LinuxX64, LinuxArm64, MingwX64.
From your KMP project root, run:
kmpfire configureAt a minimum this prompts for a Firebase project and platforms (android, ios).
No prompts (CI / scripts):
kmpfire configure --yes --project=<FIREBASE_PROJECT_ID>kmpfire auto-detects:
- Android
applicationIdfrom the androidApp Gradle file - iOS bundle id from
project.pbxproj, or Compose Multiplatform*.xcconfig($(TEAM_ID)resolved)
If no Firebase app matches, it creates one, then writes:
google-services.json(default underandroidApp/or nestedapp/androidApp/)GoogleService-Info.plist(default underiosApp/…)- merges state into
firebase.json→"kotlinMultiplatform"
Override package / bundle / paths when needed:
kmpfire configure --yes --project=<FIREBASE_PROJECT_ID> \
--android-package-name=<ANDROID_PACKAGE_NAME> \
--ios-bundle-id=<IOS_BUNDLE_ID> \
--android-out=androidApp/google-services.json \
--ios-out=iosApp/iosApp/GoogleService-Info.plistLimit platforms:
kmpfire configure --yes --project=<FIREBASE_PROJECT_ID> --platforms=android,iosCreate the Firebase project if the id is missing from your account:
kmpfire configure --yes --project=<NEW_PROJECT_ID> --create-project- Uses detected platforms when
--platformsis omitted - Requires
--project(unless reusing an existingkotlinMultiplatformsection) - Auto-reuses values from an existing
firebase.jsonkotlinMultiplatformsection when present
Selects the Firebase project and skips the project picker prompt.
If firebase.json already has a kotlinMultiplatform section, interactive configure asks whether to reuse those values (project, platforms, package/bundle, outs). Answer yes to prefill; --yes reuses automatically.
Important: kmpfire does not auto-detect flavors. Run configure once per flavor with explicit flags.
Use --flavor=<name> to store the entry under platforms.*.buildConfigurations.<name> (default entry is platforms.*.default).
kmpfire configure --platforms=android \
--flavor=dev \
--android-package-name=your.application.id.dev \
--android-out=androidApp/src/dev/google-services.json \
--project=<FIREBASE_PROJECT_ID> --yesPlace each google-services.json where the Google Services plugin expects it for that flavor/build type. Match the Firebase Android app’s application id to that flavor.
Important: pass --android-package-name for flavors; otherwise kmpfire detects the default applicationId only.
kmpfire configure --platforms=ios \
--flavor=Debug-dev \
--ios-bundle-id=your.bundle.id.dev \
--ios-out=iosApp/config/dev/GoogleService-Info.plist \
--project=<FIREBASE_PROJECT_ID> --yesImportant: pass --ios-bundle-id for flavors; otherwise kmpfire detects the default bundle id from pbxproj / .xcconfig only. iOS plist writes / Xcode patching are best-effort from a macOS environment.
# debug / default
kmpfire configure --yes --project=your-project-id --platforms=android,ios \
--android-out=androidApp/src/debug/google-services.json \
--android-package-name=com.example.myapp.debug \
--ios-out=iosApp/debug/GoogleService-Info.plist \
--ios-bundle-id=com.example.myapp.ios.debug
# release flavor
kmpfire configure --yes --project=your-project-id --platforms=android,ios \
--flavor=release \
--android-out=androidApp/src/release/google-services.json \
--android-package-name=com.example.myapp.release \
--ios-out=iosApp/release/GoogleService-Info.plist \
--ios-bundle-id=com.example.myapp.ios.releaseAfter changing Firebase products in the console (or to refresh configs), rewrite service files from stored paths:
kmpfire reconfigureThis uses firebase.json → kotlinMultiplatform to update each fileOutput in place (all default + buildConfigurations entries). Limit to one flavor:
kmpfire reconfigure --flavor=devOptional Gradle patch (Google Services on androidApp; GitLive on shared when --sdk=gitlive):
kmpfire reconfigure --deps
# or on first configure:
kmpfire configure --yes --project=<ID> --deps --sdk=gitlivekmpfire stores configuration in firebase.json under a kotlinMultiplatform section.
{
"kotlinMultiplatform": {
"projectId": "my-firebase",
"sdk": "gitlive",
"layoutKind": "app-nested",
"platforms": {
"android": {
"default": {
"appId": "1:…:android:…",
"fileOutput": "app/androidApp/google-services.json",
"packageNameOrBundleId": "com.example.app"
},
"buildConfigurations": {
"dev": {
"appId": "1:…:android:dev",
"fileOutput": "app/androidApp/src/dev/google-services.json",
"packageNameOrBundleId": "com.example.app.dev"
}
}
},
"ios": {
"default": {
"appId": "1:…:ios:…",
"fileOutput": "app/iosApp/iosApp/GoogleService-Info.plist",
"packageNameOrBundleId": "com.example.app"
}
}
}
}
}fileOutput paths are relative to the project root.
| Flag | Meaning |
|---|---|
--project / -P |
Firebase project id |
--project-dir |
KMP root (directory with settings.gradle.kts) |
--platforms=android,ios |
Platforms (omit → interactive multi-select) |
--flavor |
Named buildConfiguration (omit → default) |
--yes / -y |
Non-interactive defaults / reuse existing section |
--create-project |
Create Firebase project when id is missing |
--sdk gitlive|native |
Affects --deps / stored in state |
--deps |
Patch Gradle plugins / deps |
--android-package-name |
Override applicationId |
--ios-bundle-id |
Override PRODUCT_BUNDLE_IDENTIFIER |
--android-out / --ios-out |
Custom service file paths |
--dry-run |
Print actions only |
--version / -V |
Show CLI version |
- Prefer native service files for Android (
google-services.json) and iOS (GoogleService-Info.plist). kmpfire intentionally does not generate KotlinFirebaseOptionssource. - Google Services Gradle plugin applies on androidApp only, never on
shared. --depsis opt-in; Gradle /pbxprojpatches soft-fail (warn, do not abort successful config writes).- Firebase CLI’s published JSON schema does not list
kotlinMultiplatform; rare strict validation may warn. - iOS configuration assumes a macOS host for sensible Xcode / plist workflow.
git clone https://github.com/dungngminh/kmpfire_cli.git
cd kmpfire_cli
./gradlew jvmTest
./gradlew jvmRun --args='configure --help'- Fork this repository
- Create a branch and make your changes
- Open a Pull Request
MIT — see LICENSE
