Overview
Kayan is a small, opinionated Kotlin Gradle plugin for layered JSON and YAML config. It works with 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”- You write JSON or YAML config files with a
flavorsobject for environment-specific values - You declare a schema in your
build.gradle.ktsusing thekayan {}DSL - Kayan merges base config with optional overrides and validates declared schema entries at build time
- A typed Kotlin object is generated that your shared code can import directly
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.
Deterministic precedence. Schema-driven validation. Generated Kotlin source.
