Kotlin is a programming language that has gained much popularity over the last few years. Its concise and expressive syntax feels liberating compared to the verbosity of Java. Vaadin supports the Kotlin programming language through the Karibu-DSL library, which contains various extensions to use Vaadin and Kotlin together.
Despite its simplicity, Kotlin is a fully type-safe language and helps you avoid many common programming errors in Java, such as null-pointer exceptions. Kotlin runs on the JVM and is fully interoperable with existing Java code, which means you can use it both in new and existing projects.
Can you build web applications with Kotlin?
Although Kotlin is well-known among developers as a language for building Android apps and backends, it's also great for building web apps. If you want to stay close to the browser API, you can compile Kotlin to JavaScript to build frontend applications instead of using JavaScript.
A full-stack framework makes building web apps in Kotlin even easier. The Vaadin framework allows you to build web apps on a higher level of abstraction, working with components instead of DOM elements. Vaadin handles the communication between the server and browser transparently.
Vaadin: a full-stack web framework with Kotlin support
Vaadin Flow is an open-source web framework for JVM backends. It features a large library of customizable UI components and supports an intuitive Kotlin DSL for building UIs declaratively.
verticalLayout {
val nameField = textField("Your name")
button("Say hello") {
onLeftClick { Notification.show("Hello, ${nameField.value}") }
}
}
Vaadin applications run on the JVM, giving you full access to backend services, databases, and other server resources as you build your app. The apps are secure by default, thanks to Vaadin's unique architecture.
Get started: build a Kotlin web app with Vaadin
Here are some links to help you get started:
- Getting started with Vaadin and Kotlin.
- Open a Vaadin and Kotlin project in GitPod and try it in your browser.
- Clone the starter repo to try it out locally.