Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Powered By Vaadin on Kotlin Join the chat at Heroku

Beverage Buddy App Starter for Vaadin 14


This is a Vaadin 14 Vaadin-on-Kotlin example application, used to demonstrate features of the Vaadin Flow Java framework. A full-stack app: uses the H2 database instead of a dummy service.

The Starter demonstrates the core Vaadin Flow concepts:

This version of Beverage Buddy demoes the possibility of developing a Vaadin 14 web application purely server-side in the Kotlin language. There is no JavaScript code in this project. If you'd like to see a demo on how to create Polymer Templates, please head to the page of the original Beverage Buddy App (in Java).

Live Demo

You can find the Online Beverage Buddy Demo running on Heroku.

Preparing Environment

The Vaadin 14 build requires node.js and npm. Vaadin Gradle plugin will install those for you automatically (handy for the CI); alternatively you can install those to your OS:

Also make sure that you have Java 8 (or higher) JDK installed.

Getting Started

To quickly start the app, just type this into your terminal:

git clone
cd beverage-buddy-vok
./gradlew appRun

Gradle will automatically download an embedded servlet container (Jetty) and will run your app in it. Your app will be running on http://localhost:8080.

Since the build system is a Gradle file written in Kotlin, we suggest you use Intellij IDEA to edit the project files. The Community edition is enough to run the server via Gretty's ./gradlew appRun. The Ultimate edition will allow you to run the project in Tomcat - this is the recommended option for a real development.

Supported Modes

Runs in Vaadin 14 npm mode, using the Vaadin Gradle Plugin.

Both the development and production modes are supported. To prepare for development mode, just run:

./gradlew clean vaadinPrepareFrontend

To build in production mode, just run:

./gradlew clean build -Pvaadin.productionMode

If you don't have node installed in your CI environment, Gradle Vaadin plugin will download node.js for you automatically:

./gradlew clean build -Pvaadin.productionMode


To compile the entire project in production mode, run ./gradlew -Pvaadin.productionMode.

To run the application in development mode, run ./gradlew appRun and open http://localhost:8080/.

To produce a deployable production-mode WAR:

  • run ./gradlew -Pvaadin.productionMode
  • You will find the WAR file in build/libs/*.war
  • To revert your environment back to development mode, just run ./gradlew or ./gradlew vaadinPrepareFrontend (omit the -Pvaadin.productionMode) switch.

This will allow you to quickly start the example app and allow you to do some basic modifications.

Dissection of project files

Let's look at all files that this project is composed of, and what are the points where you'll add functionality:

Files Meaning
build.gradle.kts Gradle build tool configuration files. Gradle is used to compile your app, download all dependency jars and build a war file
gradlew, gradlew.bat, gradle/ Gradle runtime files, so that you can build your app from command-line simply by running ./gradlew, without having to download and install Gradle distribution yourself.
.travis.yml Configuration file for Travis-CI which tells Travis how to build the app. Travis watches your repo; it automatically builds your app and runs all the tests after every commit.
Procfile Tells Heroku hosting service how to run your app in a cloud. See below on how to deploy your app on Heroku for free.
.gitignore Tells Git to ignore files that can be produced from your app's sources - be it files produced by Gradle, Intellij project files etc.
src/main/resources/ A bunch of static files not compiled by Kotlin in any way; see below for explanation. We're using Slf4j for logging and this is the configuration file for Slf4j
db/migration/ Database upgrade instructions for the Flyway framework. Database is upgraded on every server boot, to ensure it's always up-to-date. See the Migration Naming Guide for more details.
webapp/ contains static webapp resources, such as potential Polymer templates, components, the global app CSS file, etc. The CSS file references the Vaadin Lumo theme and configures it by the means of CSS variables. Polymer templates are not used in this project.
frontend/styles/shared-styles.html The CSS styles applied to your web app. Vaadin by default uses Vaadin Lumo Theme; you can tweak the Lumo theme by the means of setting CSS variables.
src/main/kotlin/ The main Kotlin sources of your web app. You'll be mostly editing files located in this folder.
Bootstrap.kt When Servlet Container (such as Tomcat) starts your app, it will run the Bootstrap.contextInitialized() function before any calls to your app are made. We need to bootstrap the Vaadin-on-Kotlin framework, in order to have support for the database; then we'll run Flyway migration scripts, to make sure that the database is up-to-date. After that's done, your app is ready to be serving client browsers.
MainLayout.kt The main view of the app, it defines how the UI looks like and how the components are nested into one another. The UI is defined by the means of so-called DSL; see Karibu-DSL examples for more examples.
CategoriesList.kt An example view which is constructed entirely server-side. Demonstrates the use of the Vaadin Grid component.
ReviewsList.kt An example view which demoes the possibility of the Grid to act as a scrolling vertical list component lazily-loading items as they scroll into view (akin to Android ListView). This is achieved by simply having one-column grid with a ComponentRenderer.
ConfirmationDialog.kt An example of a Yes-No dialog built entirely server-side.
AbstractEditorDialog.kt, CategoryEditorDialog.kt, ReviewEditorDialog.kt Forms editing particular database entities, implemented as a dialogs.
Toolbar.kt An example of a reusable component
backend/ Demonstrates the use of the VoK-ORM framework to represent database rows as objects
RestService.kt/ Demonstrates the possibility of having REST endpoints. See the class sources for details on how to access those endpoints.
DemoData.kt/ Pre-populates the database with some example data.
Category.kt/, Review.kt/ Two entities. Category simply lists a list of beverage categories such as 'Beer'. Review lists reviews made for a particular beverage; it references the beverage category as a foreign key into the Category table.

More Documentation

For Vaadin 14 documentation for Java users, see

For Vaadin-on-Kotlin documentation, head to Vaadin-on-Kotlin.

Development with Intellij IDEA Ultimate

The easiest way (and the recommended way) to develop VoK-based web applications is to use Intellij IDEA Ultimate. It includes support for launching your project in any servlet container (Tomcat is recommended) and allows you to debug the code, modify the code and hot-redeploy the code into the running Tomcat instance, without having to restart Tomcat.

  1. First, download Tomcat and register it into your Intellij IDEA properly:
  2. Then just open this project in Intellij, simply by selecting File / Open... and click on the build.gradle file. When asked, select "Open as Project".
  3. You can then create a launch configuration which will launch the web module as exploded in Tomcat with Intellij: just scroll to the end of this tutorial:
  4. Start your newly created launch configuration in Debug mode. This way, you can modify the code and press Ctrl+F9 to hot-redeploy the code. This only redeploys java code though, to redeploy resources just press Ctrl+F10 and select "Update classes and resources"

Using Intellij IDEA Community

Intellij Community is free and can be used for the development as well. To launch your app in IDEA Community, just click the rightmost Gradle tool button, then navigate to beverage-buddy-vok / Tasks / gretty / appRun, right-click appRun and select the first option "Run beverage-buddy-vok".


Simple Example Web Application for Vaadin Flow



No releases published


No packages published
You can’t perform that action at this time.