This is a Kotlin Multiplatform project targeting Web, Server.
-
/app/shared is for code that will be shared across your Compose Multiplatform applications. It contains several subfolders:
- commonMain is for code that’s common for all targets.
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, the iosMain folder would be the right place for such calls. Similarly, if you want to edit the Desktop (JVM) specific part, the jvmMain folder is the appropriate location.
-
/core is for the code that will be shared between all targets in the project. The most important subfolder is commonMain. If preferred, you can add code to the platform-specific folders here too.
-
/server is for the Ktor server application.
Use the run configurations provided by the run widget in your IDE's toolbar. You can also use these commands and options:
- Server:
./gradlew :server:run - Web app:
- Wasm target (faster, modern browsers):
./gradlew :app:webApp:wasmJsBrowserDevelopmentRun - JS target (slower, supports older browsers):
./gradlew :app:webApp:jsBrowserDevelopmentRun
- Wasm target (faster, modern browsers):
Use the run button in your IDE's editor gutter, or run tests using Gradle tasks:
- Server tests:
./gradlew :server:test - Web tests:
- Wasm target:
./gradlew :app:shared:wasmJsTest - JS target:
./gradlew :app:shared:jsTest
- Wasm target:
Host prerequisites:
- JDK 21
- On Debian/Ubuntu:
libatomic1(required by the Kotlin/JS Node toolchain during the build):sudo apt-get install libatomic1
Build the deployment image with a single command:
scripts/build-image.shThis builds the fat JAR on the host (./gradlew :server:shadowJar), builds the
bankteller:latest container image (Podman preferred, Docker fallback), and
automatically prunes dangling (untagged) images after each successful build, so
repeated rebuilds do not accumulate stale container layers.
To reclaim historical storage beyond dangling images, prune manually:
podman system prune # or: docker system prune
podman volume prune # or: docker volume pruneThe image sets JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75.0" so the JVM heap
sizes relative to the container's memory limit. Override it via the environment
(e.g. in docker-compose.yml or docker run -e JAVA_TOOL_OPTIONS=...).
Browser tests are unaffected: they still run in their dedicated container image
(scripts/build-browser-tests-image.sh, ./gradlew :app:web:containerJsBrowserTest).
Learn more about Kotlin Multiplatform, Compose Multiplatform, Kotlin/Wasm…
We would appreciate your feedback on Compose/Web and Kotlin/Wasm in the public Slack channel #compose-web. If you face any issues, please report them on YouTrack.