> Markdown version of [Project Setup](https://vaadin.com/docs/v23/tutorial/project-setup). Section index: [llms.txt](https://vaadin.com/docs/v23/tutorial/llms.txt)

# Vaadin Flow Project Setup

This chapter covers:

- Downloading a Vaadin application starter.

- Importing a Vaadin Maven project in IntelliJ.

- Configuring IntelliJ for productive development.

## <a id="downloading-a-vaadin-application-starter"></a>Downloading a Vaadin Application Starter

This tutorial uses a preconfigured starter from Vaadin Start. The starter application includes:

- A JPA data model consisting of `Contact`, `Company`, and `Status` JPA entities.

- Spring Data repositories for persisting and retrieving the entities from an embedded H2 database.

- `data.sql` file containing some test data

- A single, empty view.

- A Dockerfile.

Download the starter application (zip file) below:

[Download starter](https://start.vaadin.com/dl?preset=flow-crm-tutorial\&preset=partial-latest)

## <a id="importing-a-maven-project-into-intellij"></a>Importing a Maven Project into IntelliJ

1. Unzip the downloaded archive to a file location of your choice. Avoid unzipping to the download folder, as you could unintentionally delete your project when clearing out old downloads.

2. In IntelliJ, select **Open** in the Welcome screen or **File** menu.

   [Image: IntelliJ import screen]

3. Find the extracted folder, and select the `pom.xml` file.

   [Image: open pom.xml file]

4. Select **Open as Project**. This imports a project based on the `pom.xml` file.

   [Image: open as project]

5. IntelliJ imports the project and downloads all necessary dependencies. This can take several minutes, depending on your internet connection speed.

When the import is complete, your project structure looks like this:

- Java source files are in the `src/main/java` folder.

[Image: project file hierarchy]

## <a id="running-a-spring-boot-project-in-intellij"></a>Running a Spring Boot Project in IntelliJ

Spring Boot makes it easier to run a Java web application, because it takes care of starting and configuring the server.

To run your application, run the Application class that contains the `main()` method that starts Spring Boot. IntelliJ automatically detects that you have a class with a `main()` method and displays it in the **run configurations** drop-down.

To start your application:

- Open `Application.java` and click the play button next to the code line containing the `main()` method.

- After you have run the application once from the `main()` method, it shows up in the **run configurations** drop-down in the main toolbar. On subsequent runs, you can run the application from there.

[Image: run button locations]

The first time you start a Vaadin application, it downloads frontend dependencies and builds a JavaScript bundle.

> **Note:** After starting the application for the first time, IntelliJ indexes all the added dependencies. This can take anywhere from a few seconds to several minutes, depending on your computer. This happens only once.

You’ll know that your application has started when you see the following output in the console:

```
Started Vite. Time: 3113ms
```

You can now open `localhost:8080` in your browser. You’ll see a content placeholder and image.

[Image: Running application view]

## <a id="enabling-auto-import-in-intellij"></a>Enabling Auto Import in IntelliJ

You can configure IntelliJ to automatically resolve imports for Java classes. This makes it easier to copy code from this tutorial into your IDE.

To enable auto import in IntelliJ:

1. Open the **Preferences/Settings** window and navigate to **Editor > General > Auto Import**.

2. Enable the following two options:

   - **Add unambiguous imports on the fly**.

   - **Optimize imports on the fly**.

     [Image: automatic import settings]

     Vaadin shares many class names (like Button) with Swing, Java Abstract Window Toolkit (AWT), and JavaFX.

3. If you don’t use Swing, AWT, or JavaFX in other projects, add the following packages to the **Exclude from import and completion** list to help IntelliJ select the correct classes automatically.

   - `com.sun`

   - `java.awt`

   - `javafx.scene`

   - `javax.swing`

   - `jdk.internal`

   - `sun.plugin`

Now that you have a working development environment, you are ready to start building a web application.

[Image: migration assistance]

**Download free e-book.**\
The complete guide is also available in an easy-to-follow PDF format.

https\://pages.vaadin.com/en/build-a-modern-web-app-with-spring-boot-vaadin-pdf

`render-banner.ts`

```html
export class RenderBanner extends HTMLElement {
  connectedCallback() {
    this.renderBanner();
  }

  renderBanner() {
    let bannerWrapper = document.getElementById('tocBanner');

    if (bannerWrapper) {
      return;
    }

    let tocEl = document.getElementById('toc');

    // Add an empty ToC div in case page doesn't have one.
    if (!tocEl) {
      const pageTitle = document.querySelector(
        'main > article > header[class^=PageHeader-module--pageHeader]'
      );
      tocEl = document.createElement('div');
      tocEl.classList.add('toc');

      pageTitle?.insertAdjacentElement('afterend', tocEl);
    }

    // Prepare banner container
    bannerWrapper = document.createElement('div');
    bannerWrapper.id = 'tocBanner';
    tocEl?.appendChild(bannerWrapper);

    // Banner elements
    const text = document.querySelector('.toc-banner-source-text')?.innerHTML;
    const link = document.querySelector('.toc-banner-source-link')?.textContent;

    const bannerHtml = `<div class='toc-banner'>
          <a href='${link}'>
            <div class="toc-banner--img"></div>
            <div class='toc-banner--content'>${text}</div>
          </a>
        </div>`;

    bannerWrapper.innerHTML = bannerHtml;

    // Add banner image
    const imgSource = document.querySelector('.toc-banner-source .image');
    const imgTarget = bannerWrapper.querySelector('.toc-banner--img');

    if (imgSource && imgTarget) {
      imgTarget.appendChild(imgSource);
    }
  }
}
```

`3C607714-1A52-49F0-9CB6-809F7A59F608`
