I’m working on an example for Kotlin web development based on the latest 1.1 RC.
What I have should already be enough to get you started: https://github.com/bascan/kotlin-js-example
Just to ask the question, are you sure Java/Kotlin is the right solution these days for a web application?
In other words, with the ease of developing in NodeJS and React/VueJS/Angular2, is it better to leave the backend components to Java/Kotlin and the frontend web app to better technologies?
I’m sometimes terrible at phrasing things well, but I ask this because our team has experienced this and split frontend/backend and it is working great (for us - key point).
Personally, I can’t imagine developing frontend/middle-tier code in Java/Kotlin when other solutions make it so much easier.
Disclaimer: I’m also a REST API focused developer, I don’t build frontend stuff myself professionally.
Okay, having written all of that… If I were to do something like this, I would probably go with Java EE (JSP?) as that would be the most logical fit for our environment. So that could very well be the worst option to go with
I would probably go check out the Kotlin link, or one of the two “awesome kotlin” github repos and look for a fitting framework.
More likely though, on personal projects where I have a frontend I last went VueJS served by NodeJS for the app and Java EE with REST APIs for the backend.
True. I dont expect Java/Kotlin to serve the frontend tier. JSP is terrible in that sense. I appreciated bascan about his work. Personally, i dont want to see myself using Kotlin to develop a html.
Actually using kotlinx.html works quite nice. The really great thing about it is that if you are a bit careful you can share the page layout between the backend/jvm and frontent/js for a reduction in repetition (search engines can get the correct page, and users will not have to execute js first - but you can still have the smooth ajax interaction and good concistency). The main win of using Kotlin for javascript is really the ability to reuse code between front and backend (not just UI code).
One way of writing webcomponent-based webapps is to use pure-JS on client-side, communicating with REST with server-side. However, there is also another option now. It is possible to only include pre-existing webcomponents to your page, then you can nest them, orchestrate them and control them from your JVM-based server. This is the essence of Vaadin 10 / Flow: Vaadin Flow - Modern web apps in Java . There are Kotlin bindings of course, see an example project here: https://github.com/mvysny/vaadin-on-kotlin/tree/master/vok-example-flow-sql2o . The following videos explain these ideas further: Vaadin-on-Kotlin Flow Part 1 - YouTube