https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

rcd27

03/04/2024, 5:50 AM
Greetings! So now, when Compose can be rendered right in Web, targeting Kotlin/WASM, we are thinking about: could we move UI to "backend"/Ktor app(like to standalone KMP/Gradle module in project). What do you think about pros/cons and technical effort of this solutions, dear community and beloved JB?
h

hfhbd

03/04/2024, 6:27 AM
What do you mean? At the moment, you have two (backend + frontend) or three (backend, shared, frontend) modules, the first is a Kotlin JVM module, the latter a WASM module and you want to merge them into a multiplatform module with a JVM and wasm target? I never did this but should be technologically possible. On the other hand I prefer separate modules which makes the gradle setup less complex and the complication much faster due smaller sizes and less abi changes. Additionally you need to run the compose compiler only on a subset, the wasm module, until there will be an option to exclude Kotlin complications, like the backend. I would only merge the modules if you actually need expect/actual. Otherwise use separate modules.
r

rcd27

03/04/2024, 6:38 AM
We don't have anything yet, just thinking about one repository with Ktor for backend and Compose for frontend. I imagine serving network calls with Ktor, which somehow answers/redirects to Compose pages. Not sure yet.
j

Joel Denke

03/04/2024, 7:59 AM
I would check if possible to share things like models in backend vs frontend, being same. But I advice in general keep things modular and isolated as much as possible. A common module is still isolated 🙂 Its worse if mixing things like Ktor setup in same module or such I think.
4 Views