Quick Start
1. Add your config
Section titled “1. Add your config”{ "flavors": { "prod": { "api_base_url": "https://api.example.com", "feature_search_enabled": false }, "dev": { "api_base_url": "https://dev.example.com", "feature_search_enabled": true } }, "brand_name": "Example App"}YAML works with the same shape:
flavors: prod: api_base_url: https://api.example.com feature_search_enabled: false dev: api_base_url: https://dev.example.com feature_search_enabled: truebrand_name: Example App2. Apply the plugin and declare schema
Section titled “2. Apply the plugin and declare schema”plugins { // Use any supported Kotlin plugin: // kotlin("multiplatform"), kotlin("jvm"), or kotlin("android") kotlin("multiplatform") version "<kotlin-version>" id("io.github.mohamadjaara.kayan") version "<kayan-version>"}
kayan { packageName.set("sample.generated") flavor.set("prod")
schema { string("api_base_url", "API_BASE_URL", required = true) boolean("feature_search_enabled", "FEATURE_SEARCH_ENABLED") string("brand_name", "BRAND_NAME") }}3. Build to generate
Section titled “3. Build to generate”./gradlew generateKayanConfigGenerated source lands in build/generated/kayan/kotlin and is wired into the appropriate
source set automatically (commonMain for KMP, main for JVM/Android).
4. Use generated values
Section titled “4. Use generated values”import sample.generated.SampleConfig
val baseUrl = SampleConfig.API_BASE_URLval search = SampleConfig.FEATURE_SEARCH_ENABLEDval brand = SampleConfig.BRAND_NAME