Prerequisites: you need to have Node.js installed. Go to the Node.js download page to install it on your development machine (macOS, Windows or Linux-compatible). You can run the following command to verify if Node is already installed:
The Vaadin CLI can only be used to create new projects at the moment, but we are planning to develop it further. What new features would you like to see?
You can also go to start.vaadin.com to configure and download a Vaadin project without using the Vaadin CLI.
Install the Vaadin CLI
After verifying that you have Node.js installed, open a terminal window and enter and execute the following command:
npm i -g @vaadin/cli
Use the Vaadin CLI
Open a new terminal window in the folder where you wish to create a new project, and run the command below. Replace
my-project with the application name.
vaadin init my-project
You can see the project being built in your terminal:
mikael@MacBook-Pro Example app folder % vaadin init my-project
Creating application 'my-project'
Project 'my-project' created
You can also create a Vaadin Fusion project by adding the
vaadin init --fusion my-project
The command creates a new subdirectory to the folder, containing the newly created Flow app. Start the project by running the following commands in the terminal window:
The app should automatically open in a new tab/window in your default browser. If not, watch the app being built and manually navigate to http://localhost:8080/ to view it.
Figure 1. View of the created example app.
You can use the CLI to test the latest Vaadin pre-release version by adding the
--pre annotation to the command. And, as previously mentioned, replace
my-project with the desired name of your app
vaadin init --pre my-project
You can also build applications with different presets. Replace
<preset> with the desired preset:
vaadin init --preset <preset> my-project
You can add Collaboration Engine to your project with the
collaboration preset You can also use the
empty preset for a project with no menu and an empty view.
What other presets would you like to see included?
We’d like to hear it from you. We’re planning to make the CLI more feature-rich by adding convenience functions to it, such as a Vaadin version updater, migration/conversion scripts, the ability to add views to a project (similar to start.vaadin.com), utilities for theme management, license installation for Vaadin Pro/Prime commercial features, and more.
However, we’re also asking for input from our users.
Do you use the CLI? What do you think of it? What’s missing? Let us know by commenting below or discussing it in our Discord community!