Documentation

Push Notifications

OneSignal for web and mobile notifications

Push Notifications

OneSignal handles notifications for both platforms.

Setup

  1. Create OneSignal account
  2. Get App IDs for web and mobile
  3. Add to config:
// packages/config/index.ts
platforms: {
  web: {
    notifications: {
      oneSignal: { appId: "your-web-app-id" }
    }
  },
  native: {
    notifications: {
      oneSignal: { appId: "your-mobile-app-id" }
    }
  }
}

Usage

Web:

import { initOneSignal } from '@repo/onesignal';
await initOneSignal();

Mobile:

import { initOneSignal } from '@repo/onesignal';
await initOneSignal();

Same API for both platforms!

Sending Notifications

// Server-side
await sendNotification({
  title: "Hello",
  message: "New update available",
  userIds: ["user123"]
});

That's it - OneSignal handles the rest.