marcushellberg / hilla-push-notifications

The Unlicense
12 stars 13 forks source link

Example of sending Web Push notifications from Java

This is a full-stack example showing:

Text tutorial: https://dev.to/marcushellberg/how-to-send-web-push-notifications-in-java-21lo Video tutorial: https://youtu.be/M5sbGvW3S4I

Tech stack

The project uses Hilla. It has a Spring Boot backend (Java) and a Lit frontend (TypeScript). It uses the Java WebPush library for sending messages.

Pre-requisites

Running the app

  1. First, generate required a private and public key pair for your server with npx web-push generate-vapid-keys.
  2. Rename .env.template to .env and add your keys to it.
  3. Load the environment file with source .env
  4. Start the Spring Boot application with mvn or by running Application.java.

Navigating the code