Examples
The examples/ folder of the repository holds complete projects, each with its own kargo.toml, sources, tests and a README with the commands to run it. Copy one out and run it:
git clone https://github.com/enekocm7/kargocp -r kargo/examples/ktor-server ~/ktor-servercd ~/ktor-serverkargo run| Example | Shows | Targets | Guide |
|---|---|---|---|
hello-jvm |
The smallest project: an application and a test | JVM | Your first Kotlin app |
ktor-server |
A Ktor server with kotlinx.serialization | JVM | A REST API with Ktor |
spring-boot |
A Spring Boot web application | JVM | Spring Boot |
compose-desktop |
A Compose Multiplatform desktop window | JVM | Compose |
compose-multiplatform |
One shared App() on desktop and in the browser |
JVM, Wasm | Compose |
compose-html |
Compose HTML rendering DOM elements | JS | Compose |
android |
An Android app, with no Gradle files | Android | Android |
kotlin-wasm |
A browser app on Kotlin/Wasm | Wasm | WebAssembly |
kotlin-js |
A Kotlin/JS application | JS | JavaScript (Kotlin/JS) |
kotlin-native |
A native executable | Native | Kotlin/Native |
multiplatform-library |
A serializable library for three targets | JVM, JS, Wasm | Multiplatform projects |
workspace |
Two packages joined by a path dependency | JVM | Workspaces |
They match Kargo’s defaults
Section titled “They match Kargo’s defaults”None of the examples pins a Kotlin, framework or JVM version, so they build with the versions of the Kargo you have installed. Apart from workspace, each one is exactly what kargo new writes for the same flags (kargo new ktor-server --with ktor,serialization, for instance), so you can also generate a fresh copy yourself.
For contributors
Section titled “For contributors”cargo test --test examples checks offline that every example still equals the output of kargo new, that no kargo.toml pins a version other than Kargo’s default, and that each one loads. When a template changes, refresh the examples:
KARGO_UPDATE_EXAMPLES=1 cargo test --test examplesThe Examples workflow builds and tests every example with the real compilers on each change to examples/, on pull requests that touch the templates, and once a week. See Contributing.