/react-push-notification-demo

A simple push server and client demo

Primary LanguageJavaScript

This is a simple Push Notification demo using NodeJS and React

Server

The server uses Express and web-push libraries.

To configure the server, you need to run npx web-push generate-vapid-keys and add the keys to /server/.env.local.

VAPID_PUBLIC=<vapid public key>
VAPID_PRIVATE=<vapid private key>

Note: The server saves the browser subscriptions in memory based on a very naive identification process. While it makes this demo simpler, it's not suitable for a real application.

Running the server

cd server
npm install
npm start

Client

The client demonstrate how to receive push notification in a Create-React-App application.

cd client
npm install
npm start