Built-in frameworks
Some libraries need more than a dependency: compiler plugins, extra flags, or a set of matching artifacts. Kargo knows how to set these up. Turn them on in [frameworks]:
[frameworks]serialization = truecoroutines = trueFrom the command line:
kargo add --framework serialization,coroutineskargo new myapp -w ktor,serialization # when creating a projectEach framework adds what it needs for every target that supports it. Use kargo tree to see exactly what was added.
| Framework | JVM | Wasm | JS | Native | Android |
|---|---|---|---|---|---|
serialization |
✓ | ✓ | ✓ | ✓ | ✓ |
coroutines |
✓ | ✓ | ✓ | ✓ | ✓ |
ktor |
✓ | client | client | ✓ (CIO) | client |
compose |
desktop | Jetpack Compose | |||
spring-boot |
✓ | ||||
lombok |
✓ | ✓ | |||
benchmark |
✓ |
kotlinx.serialization
Section titled “kotlinx.serialization”[frameworks]serialization = true# orserialization = { version = "1.11.0", formats = ["json", "cbor", "protobuf"] }Adds the serialization compiler plugin and one library per format. Formats: json (the default), protobuf, cbor, properties, hocon (JVM only) and core.
import kotlinx.serialization.Serializableimport kotlinx.serialization.json.Json
@Serializabledata class User(val name: String, val age: Int)
fun main() { val json = Json.encodeToString(User("Ada", 36)) // {"name":"Ada","age":36} val user = Json.decodeFromString<User>(json)}Coroutines
Section titled “Coroutines”[frameworks]coroutines = true # or a version: coroutines = "1.11.0"Adds kotlinx-coroutines-core, plus kotlinx-coroutines-test for JVM tests and kotlinx-coroutines-swing when used with Compose Desktop.
import kotlinx.coroutines.*
fun main() = runBlocking { val results = (1..3).map { n -> async { delay(100L * n); n * n } }.awaitAll() println(results) // [1, 4, 9]}[frameworks]ktor = { server = "netty" }# all options:ktor = { version = "3.6.0", server = "netty", client = "cio", server-plugins = ["cors", "call-logging"], client-plugins = ["logging"], json = true }| Key | Effect |
|---|---|
server |
Adds ktor-server-core and ktor-server-<engine> (netty, cio, jetty, …). Native supports only cio. On the JVM it also adds Logback and ktor-server-test-host for tests. |
client |
Adds ktor-client-core and ktor-client-<engine> (cio, okhttp, java, js, …). |
server-plugins / client-plugins |
Each name adds ktor-server-<name> / ktor-client-<name>. |
json |
Adds ktor-serialization-kotlinx-json and content negotiation. Defaults to true when serialization is also enabled. |
See A REST API with Ktor for a full walkthrough.
Spring Boot
Section titled “Spring Boot”[frameworks]spring-boot = true# orspring-boot = { version = "4.1.1", starters = ["web", "data-jpa", "actuator"] }Imports the Spring Boot BOM, adds spring-boot-starter-<name> for each starter (default ["web"]), kotlin-reflect, Jackson’s Kotlin module for web starters (com.fasterxml.jackson.module for Spring Boot 3, tools.jackson.module for Spring Boot 4 and newer, which use Jackson 3) and spring-boot-starter-test for tests. It also configures the allopen compiler plugin with the Spring preset, the noarg plugin for JPA entities (when data-jpa is used, or jpa = true), and the -Xjsr305=strict and -java-parameters flags. JVM only.
See the Spring Boot guide.
Compose
Section titled “Compose”[frameworks]compose = true# orcompose = { version = "1.12.1", material3 = true, resources-package = "com.example.res", public-resources = false }# Compose compiler optionscompose = { stability-config = "compose-stability.conf", strong-skipping = true, feature-flags = ["OptimizeNonSkippingGroups"], metrics = true, reports = true }- On the JVM it sets up Compose Multiplatform for desktop: the Compose compiler plugin, the desktop runtime for your OS and Material 3 (disable with
material3 = false).kargo run --hot-reloadreloads the running app, andkargo previewrenders@Previewfunctions to PNG. - On Wasm (
environment = "browser") it builds a Compose for Web app, with Skiko’s runtime next to the module. - On Native (iOS platforms,
kind = "framework") it builds a Compose for iOS framework. - On Android it enables Jetpack Compose in the generated Gradle project.
- On both, a
composeResources/directory gets the generatedResclass of Compose Multiplatform resources (Res.drawable.*,Res.string.*, …) and the resources runtime.resources-packageandpublic-resourcesset the package and the visibility ofRes. stability-config,strong-skipping,feature-flags,metricsandreportsset the options of the Compose compiler on both targets; see Compose compiler options.kargo package --desktopbuilds an installer (or with--platforms alla jar for every OS) of a desktop application.kargo new <dir> --with compose-multiplatformcreates a project with a sharedApp()for the jvm and wasm targets. See Compose.
See the Compose Desktop guide.
Lombok
Section titled “Lombok”[frameworks]lombok = true# orlombok = { version = "1.18.48", config = "lombok.config" }Adds Lombok as a provided dependency and annotation processor for main and test Java sources, and the Kotlin Lombok compiler plugin so Kotlin code can see the generated getters, setters and builders. A lombok.config in the project root is picked up automatically. JVM and Android only.
Benchmarks
Section titled “Benchmarks”[frameworks]benchmark = true# orbenchmark = { version = "0.5.0" }Adds kotlinx-benchmark’s annotations (@Benchmark, @State, Blackhole) and JMH as dev-dependencies of the JVM target, so your editor resolves them in benches/. kargo bench runs without this framework too, with the same libraries; the framework is for the editor and to pin the version. kargo new --bench (or -w benchmark) and kargo add --framework benchmark also write a sample benchmark in benches/SampleBench.kt when there is none. JVM only; see Benchmarking.
Combining frameworks
Section titled “Combining frameworks”Frameworks combine. A few rules apply:
- Pick
spring-bootorktorfor a server, not both. spring-bootprojects are applications, so they can’t be created with--lib.spring-boot,lombokandcomposecan’t be used in projects that enable the Wasm or Native targets for that code, and none of them works on the JS target (Compose for Web runs on Wasm).
Something not covered here? Any compiler plugin can be added by hand; see Tasks and plugins.