Add the Dependency
Add the GoRules engine to your Gradle project.
// build.gradle.kts
dependencies {
implementation("io.gorules:zen-engine:0.29.2")
}Load a Decision
Create an engine and load your decision graph.
import io.gorules.zen.ZenEngine
import java.nio.file.Path
val engine = ZenEngine()
val content = Path.of("./decision.json").toFile().readText()
val decision = engine.createDecision(content)Evaluate Rules
Pass your input data and receive the decision result.
val input = mapOf(
"customer" to mapOf("tier" to "premium", "country" to "US"),
"cart" to mapOf("total" to 150, "items" to 3)
)
val result = decision.evaluate(input)
println(result.result)
// {discount=15, freeShipping=true}Why Kotlin?
Built for performance and developer experience
Kotlin-Native API
Idiomatic Kotlin with extension functions, null-safety, and type inference throughout.
Coroutine Support
Suspend functions for non-blocking rule evaluation. Perfect for Ktor and other async frameworks.
Android Compatible
Full Android support for embedding business rules directly in mobile applications.
About the Kotlin SDK
GoRules provides first-class Kotlin support for business rules management. Built on our Java SDK with Kotlin-specific extensions, it delivers an idiomatic development experience with coroutine support and type-safe builders.
The Kotlin SDK embraces modern JVM development practices with suspend functions, extension methods, and null-safety throughout. Whether you're building with Ktor, Spring Boot, or Android applications, GoRules integrates naturally with your Kotlin codebase.
Leverage Kotlin's expressive syntax alongside GoRules' powerful rule engine. The SDK supports all GoRules features including decision tables, expressions, and complex rule graphs, all accessible through a clean, Kotlin-native API.