• Grey Facebook Icon
  • Grey Twitter Icon
  • Grey YouTube Icon

Droidcon is a registered trademark of Mobile Seasons GmbH

Connect platforms with a Kotlin DSL

Patrick Cousins

Staff Android Engineer


Staff Android Engineer at Etsy and founder of Brooklyn Kotlin. Fan of whiteboarding, corny jokes, and seal puns, preferably all at the same time.


Not everyone can jump right into a Kotlin Multiplatform world. Many of us have legacy codebases and need to support our businesses first. Yet we can already use Kotlin to connect our platforms and realize significant value. In this talk we’ll learn to build a DSL that defines a contract between an API and its clients. We’ll make our DSL into a common vocabulary that translates platform idiosyncrasies. Then, by connecting it to CI, we’ll enforce our contract to keep our platforms on speaking terms. The examples in this talk will be from Sprout, an internal library in development at Etsy. The Sprout Kotlin DSL is the seed that generates code for many platforms: Retrofit endpoints, Moshi models, Swift, PHP, and more. We’ll look at how to use Kotlin as a templating language, and how the DSL can even generate itself. Finally we’ll peek at the future potential of these types of DSLs. What does connecting a Figma file look like? What about Jetpack Compose and Swift UI? Let’s dream big and then write a DSL for it.