Overview
Kayan is a Kotlin Gradle plugin for layered JSON and YAML config. It supports Kotlin Multiplatform, JVM, and Android projects.
Kayan generates a typed Kotlin API so your code can read configuration directly instead of routing values through platform-specific build config.
Kayan is designed for non-sensitive configuration. If a value should stay out of generated code or normal Gradle configuration, keep it out of Kayan. See Security for the trust model and main boundaries.
How it works
Section titled “How it works”- Write a JSON or YAML config file with a
flavorsobject for environment-specific values. - Declare the schema in
build.gradle.ktswith thekayan {}DSL. - Kayan merges the base and override files, then validates the declared entries.
- Kayan generates a typed Kotlin object that shared code can import.
Merge priority
Section titled “Merge priority”For a selected flavor, values resolve in this priority order:
- Custom config flavor value
- Custom config top-level default value
- Base config flavor value
- Base config top-level default value
Common setups
Section titled “Common setups”- Use Gradle usage for the main plugin DSL and defaults.
- Use Target-specific generation when KMP source sets need different resolved values behind one shared API.
- Use Multi-module shared config when several modules read one shared config file.
- Use Build-time config access when Gradle logic needs resolved values during configuration.
