Friends of OpenJDK Today

Hilla 1.0: A new Frontend Framework for SpringBoot

March 09, 2022

Author(s)

Hilla Framework

Hilla is a new framework for building reactive web apps on Java backends. It seamlessly integrates a reactive Lit TypeScript frontend with a Spring Boot backend. Hilla is built and supported by Vaadin.

Hilla is designed to be simple enough for small utilities, but robust enough to build complex, enterprise-grade apps.

Automatic Java to TypeScript Code Generation

Automatic TypeScript code generation helps ensure that the frontend always stays in sync with the backend, so you can build apps faster and with greater confidence, even when your team grows bigger. The strong type-safety also means you can explore server endpoint methods and their input and return types right from your IDE as you type.

Server endpoint:

@Endpoint
@AnonymousAllowed
public class PersonEndpoint {
    private PersonRepository repository;

    public PersonEndpoint(PersonRepository repository) {
        this.repository = repository;
    }

    public @Nonnull List<@Nonnull Person> findAll() {
        return repository.findAll();
    }
}

TypeScript View:

import { PersonEndpoint } from 'Frontend/generated/endpoints';
import Person from 'Frontend/generated/com/example/application/Person';

export class PersonView extends View {
  @state() people: Person[] = [];

  async firstUpdated() {
    this.people = await PersonEndpoint.findAll();
  }

  render() {
    return html`
      <vaadin-grid .items=${this.people}>
        <vaadin-grid-column path="firstName"></vaadin-grid-column>
        <vaadin-grid-column path="lastName"></vaadin-grid-column>
      </vaadin-grid>`;
  }
}

Getting started

You can learn more about Hilla and get started on https://hilla.dev/.

Full Release Notes

Features

  • Zero-configuration toolchain for building web applications with Lit TypeScript UI and Java Spring Boot server side
  • Easy and type-safe back end access using TypeScript endpoints and data definitions generated from Java code
  • Form binding with shared data validation on server and client
  • Includes Vaadin web components for building the UI

Versions

Included dependencies:

  • Vaadin Fusion Endpoint (23.0.0)
  • Vaadin Dev Server (23.0.0)

Official add-ons and plugins:

  • Hilla Maven Plugin (1.0.0)
  • Hilla Spring Boot Starter (1.0.0)
  • Vaadin Design System / Web Components (23.0.0)

Supported languages and tools

  • Java 11
  • TypeScript 4.5
  • Node.js 16
  • npm 8.3
Topics:

Related Articles

View All

Author(s)

Comments (0)

Your email address will not be published. Required fields are marked *

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Save my name, email, and website in this browser for the next time I comment.

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard