Web App with Kotlin, how to get started?


#1

Are there any frameworks recommendation (Java side also ok) which allow me to get started to build a web app with Kotlin?

I’ve learned Scala before, so I want something like playframework which allow me to learn the language while building a real app.


#2

Kara?


#3

Check http://kotlin.link it has a lot of links to projects in Kotlin.


#4

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

Have fun! :slight_smile:


#5

Nice work!


#6

Thanks! Glad you like it :slight_smile:


#7

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 :stuck_out_tongue:

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.


#8

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.


#9

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).


#10

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: https://vaadin.com/flow . 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: https://www.youtube.com/watch?v=1GVdKwrI16A


#11

Thanks for the website.


#12

Posting the proper link to the Kotlin bindings: http://www.vaadinonkotlin.eu/