Ktor server with compose for web

Does any example exist?

I have a server written with ktor which targets jvm and must run as headless service. The server is managed by admin panel using browser. I want to create web ui using Compose for Web(js is more stable, wasm is experimental but I can give a try because is is not very complex ui required for administration of the service)

For now I see what I need 1) create api for administration 2) to create separate project compose for web client 3) bundle it to the server resources 4) manage routing inside ktor

It is pretty complex to organize, maybe there is a way to write client code right inside of the server project?

Main goal is to create single fat jar which is launched on the linux server and is controlled via chrome from the outside.

I think it is easier to use Compoes-html if you do not want to mirror the desktop logic. You can use my full-stack demo if it helps: altavir/kotlin-full-stack-demo: Full stack demo including Kotlin multiplatform, serialization, coroutines and RSocket - kotlin-full-stack-demo - SPC-git.

1 Like

I did something similar as a multi module project. You can find the template here GitHub - sureshg/kotlin-mpp-playground: Kotlin Multiplatform playground! . Check backend/jvm and frontend/js projects. As usual most of my time spent on Gradle configs :grin: