Prompt
I'm building a backend that sends push notifications to iOS and Android
Latest observation
Oct 14, 2026
OpenAI APIWeb search: off
Great—if you’re building a backend for push notifications to both iOS and Android, the usual approach is:
- iOS: Apple Push Notification service (APNs)
- Android: Firebase Cloud Messaging (FCM)
Most backends either:
- Send directly to APNs and FCM themselves, or
- Use a provider like Firebase Admin, OneSignal, AWS SNS, Airship, etc., to simplify delivery and device management.
Typical backend design
1) App registers for push
- The mobile app gets a device token from APNs/FCM.
- The app sends that token to your backend.
- Your backend stores:
- user ID
- platform (
ios/android) - push token
- app/environment info
- last seen / validity status
2) Backend triggers notifications
When an event happens, your backend:
- resolves target users/devices
- builds a notification payload
- sends it through:
- APNs for iOS tokens
- FCM for Android tokens
3) Handle token refresh and invalidation
Tokens can change or become invalid, so your backend should:
- update tokens when the app reports a new one
- remove tokens when APNs/FCM says they’re invalid
- retry carefully on transient failures
Important implementation points
Payload structure
Keep payloads small and platform-specific:
- title
- body
- optional data for app routing
- badge/sound for iOS if needed
Authentication
- APNs: use JWT auth with an Apple key (
.p8) - FCM: use a Firebase service account or Admin SDK
Queuing
For reliability, send notifications asynchronously via a queue:
- BullMQ / Redis
- SQS
- RabbitMQ
- Celery
- Sidekiq
This helps with retries, rate limiting, and spikes.
Environment separation
Use separate configs for:
- iOS dev/sandbox vs production
- Android dev/staging vs production
Recommended backend flow
- User logs in on device
- App sends push token to backend
- Backend stores token
- Notification event is created
- Job queue enqueues push task
- Worker sends to APNs/FCM
- Worker updates delivery status / removes invalid tokens
If you want the simplest route
If you don’t want to manage APNs/FCM directly, a unified provider can save time:
- OneSignal: easiest to integrate
- Firebase: good if you’re already using Firebase
- AWS SNS: works well if you’re on AWS
If you want, I can help with any of these next:
- a database schema for storing push tokens
- sample backend code for Node.js / Python / Go / Java
- a system architecture for reliable delivery
- how to send notifications through APNs + FCM directly