Push notifications

Your project supports browser push notifications (via Web Push / VAPID) and mobile push notifications (via Expo). Notifications are sent for events like new members joining, subscriptions created, and custom notifications.

What happens without push notifications configured?

If PUSH_NOTIFICATIONS_ENABLED is not set to true, push notifications are completely disabled — the browser will not prompt for permission and no push tokens are registered. Email notifications still work independently.

Environment variables

Add these to packages/backend/.env:

PUSH_NOTIFICATIONS_ENABLED=true
VAPID_PUBLIC_KEY=your-vapid-public-key
VAPID_PRIVATE_KEY=your-vapid-private-key
EXPO_ACCESS_TOKEN=your-expo-access-token  # optional, for mobile

Generating VAPID keys (web push)

VAPID keys are required for browser push notifications. Generate a key pair with:

npx web-push generate-vapid-keys

This outputs a public and private key. Copy them into your .env:

VAPID_PUBLIC_KEY=BEl62iUYgU...
VAPID_PRIVATE_KEY=UUxI4o8...

Important: Generate VAPID keys once and reuse them. If you change keys, existing browser subscriptions become invalid and users must re-subscribe.

How web push works

  1. User logs in — the frontend checks if push is enabled and the browser supports it.
  2. The browser asks the user for notification permission (automatic, no UI needed from you).
  3. On approval, a push subscription is created using the VAPID public key and saved to the backend.
  4. When a notification event occurs (e.g., new member), the backend sends a push via the VAPID private key.
  5. The browser shows the notification even if the app tab is closed.

Expo push notifications (mobile)

If your project includes the mobile app package (Expo + React Native), mobile push works automatically when PUSH_NOTIFICATIONS_ENABLED=true. The mobile app requests a push token from Expo and registers it with the backend.

The EXPO_ACCESS_TOKEN is optional but recommended for production — without it, Expo applies rate limits to push sends.

To get a token:

  1. Go to expo.dev and sign in.
  2. Navigate to Account settings → Access tokens.
  3. Create a new token and add it to your .env.