https://github.com/domfarolino/push-notifications
Progressive Web App demonstrating push notifications with encrypted payload
https://github.com/domfarolino/push-notifications
encrypted-payloads nodejs notifications push-notifications web-push
Last synced: 9 months ago
JSON representation
Progressive Web App demonstrating push notifications with encrypted payload
- Host: GitHub
- URL: https://github.com/domfarolino/push-notifications
- Owner: domfarolino
- Created: 2016-05-09T00:37:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-02-06T04:39:55.000Z (11 months ago)
- Last Synced: 2025-03-27T09:21:25.747Z (10 months ago)
- Topics: encrypted-payloads, nodejs, notifications, push-notifications, web-push
- Language: JavaScript
- Homepage: https://domfarolino.com/push-notifications
- Size: 382 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# push-notifications
[](http://opensource.org/licenses/MIT)
This app demonstrates the [web-push-libs/web-push](https://github.com/web-push-libs/web-push) NodeJS
library which facilitates sending web push notifications with encrypted payloads via a custom backend.
# Demo
Demo the live application [here](https://domfarolino.com/push-notifications)
# Getting started
## Client
The client-side app is a simple static site rooted at [`docs/`](./docs). The
reason the site lives in the `docs/` folder is because GitHub pages only allows
you to serve static pages from the root or `docs/` folder — custom folders like
`frontend/` or `client/` are not supported.
## Server
```sh
git clone git@github.com:domfarolino/push-notifications.git
cp .env.example .env # Copy environment variable structure
npm install
npm start # Run the server
```
To run the *server* locally you must export the necessary environment variables.
Environment variables should appear in the `.env` file, and below is an
explanation of what each variables is used for:
- `PORT`: Defines the port on which the server will run.
- `VAPID_PUBLIC_KEY`: Defines the public key generated via `node web-push generate-vapid-keys`
- `VAPID_PRIVATE_KEY`: Defines the private key generated via `node web-push generate-vapid-keys`
- `MONGO_URL`: Push notification credentials generated by the client are persisted in MongoDB. Use your mongo URL to save client-generated credentials.
- `API_KEY`: Used to secure some routes local to this application, such as `/credentials`.
When running the server locally, be sure to update `this.backendURL` in
[`docs/js/main.js`](docs/js/main.js) to point to your local server.
# Push Notification Screenshots
## Chrome

## Firefox
