Notifications

Configure push notifications using VAPID (Voluntary Application Server Identification) keys to enable browser-based push notifications for your users.

Push Notifications (VAPID)

Push notifications allow you to send real-time notifications to users even when they're not actively using your application. This is useful for alerts, updates, reminders, and engaging users with timely information.

Generate local keys

You can generate VAPID keys using an online tool or npm package:

npx web-push generate-vapid-keys

Define local subject

Define the URL to your contact form (this will be used as the VAPID subject)

http://localhost:3000/contact

Add to local env

Add the following to your .env file:

/apps/fastack-boilerplate/.env
Optional
VAPID_PUBLIC_KEY=BKxxxxxxxxxxxxxxxxxxxxxxxxxx
VAPID_PRIVATE_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxx
VAPID_SUBJECT=http://localhost:3000/contact

Generate production keys

You can generate VAPID keys using an online tool or npm package:

npx web-push generate-vapid-keys

Define production subject

Define the URL to your contact form (this will be used as the VAPID subject)

https://yourdomain.com/contact

Add to production env

Add the following to your .env.production file:

/apps/fastack-boilerplate/.env.production
Optional
VAPID_PUBLIC_KEY=BKxxxxxxxxxxxxxxxxxxxxxxxxxx
VAPID_PRIVATE_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxx
VAPID_SUBJECT=https://yourdomain.com/contact
Fastack | SaaS codebase your AI can actually understand