Home

Awesome

Powered By Vaadin on Kotlin Join the chat at https://gitter.im/vaadin/vaadin-on-kotlin

Beverage Buddy App Starter for Vaadin

:coffee::tea::sake::baby_bottle::beer::cocktail::tropical_drink::wine_glass:

This is a Vaadin example application. A full-stack app: uses the H2 database instead of a dummy service; uses JOOQ to access the database. Requires Java 21+. Does not run on Spring.

The Starter demonstrates the core Vaadin Flow concepts:

On top of that, a very simple way of using JOOQ is demoed:

On top of that, the JOOQ-Vaadin integration is demoed as well:

This version of Beverage Buddy demoes the possibility of developing a Vaadin web application purely server-side in the Kotlin language. There is no JavaScript code in this project. We use Vaadin to avoid touching JavaScript after all.

See the online demo.

To run:

Run Main.kt main() function from your IDE, or run via ./gradlew run.

Documentation

Please see the Vaadin Boot documentation on how you run, develop and package this Vaadin-Boot-based app.

Database

Without the database, we could store the categories and reviews into session only, which would then be gone when the server rebooted. We will use the JOOQ library to ease access to the SQL. To make things easy we'll use in-memory H2 database which will be gone when the server is rebooted - touche :-D

We will use Flyway for database migration. Check out Bootstrap.kt on how the migration scripts are ran when the app is initialized.

JOOQ records are generated in the com.vaadin.starter.beveragebuddy.backend.jooq package, including the CategoryRecord and ReviewRecord. See JooqGenerator on how to generate the records. There are no DTOs - the records are passed around in the app and edited directly in the forms. The records therefore contain jakarta.validation annotations to validate user input. Careful when re-generating records, since those annotations will be lost.

The simplejooq package contains useful functions to access database without Spring:

Looking for jdbi-orm version?

See the beverage-buddy-vok version for an example app using the jdbi-orm framework underneath.

Advantages of jdbi-orm:

Disadvantages: