Introducing Web Scene
After the Kotlin 1.1 release the Kotlin JS platform is now stable (production ready) but is lacking good Kotlin specific libraries/frameworks for developing a web client (front-end) entirely in Kotlin. As a result there was no way to easily develop a full stack web application entirely in Kotlin until now. To solve this problem Web Scene was created which is a series of libraries (Web Scene Client and Web Scene Server) for building and managing web UIs.
All Web Scene libraries have the following design goals:
- No magical programming (e.g. no reflection and annotations)
- Be explicit whenever possible
- Minimise the levels of abstraction involved
- Reuse established technologies as much as possible
- Make it easy to use the library (low learning curve)
Important to note that the Web Scene Client library is highly experimental due to the unstable nature of the standard Web APIs (implementations greatly differ between all major Web Browsers).
Web Scene Server
Basic Kotlin library (Kotlin JVM only) that builds web UIs. Designed for doing the initial creation of HTML views (skeletons) on the web server which are sent to the web client via HTTP/S. Can be used with any Java/Kotlin server side web framework (Vert.x, Java Spark etc.) which allows an HTTP GET response to be sent that outputs HTML. Unlike Kotlinx HTML it is easier to build HTML, create custom HTML elements, loosely couple the DSL, and has HTML templates.
Web Scene Client
Basic Kotlin library (Kotlin JS only) that builds and manages web UIs. This library unlike the Web Scene Server library handles the web client, which includes DOM queries, DOM manipulation, and a HTTP/S client for communication with the server. Unlike Kotlinx HTML the DSL allows for loose coupling, and the library has a central place for creating and manipulating DOM elements on a web page.
Conclusion
With the Web Scene libraries Kotlin now has an option which is an alternative to Facebook’s React (JavaScript library), and is more comprehensive than Kotlinx HTML. Expect to see additional Kotlin options created by the Kotlin community in the next few months.