FCM Push Notification Sender
Component Detail
Description
Shared infrastructure component responsible for sending push notifications via Firebase Cloud Messaging. Used across certificate expiry notifications, assignment follow-up reminders, and other alert flows. Abstracts FCM device token management, payload formatting, and delivery tracking.
fcm-push-notification-sender
Summaries
The FCM Push Notification Sender is the organization's unified mobile engagement layer, ensuring that time-sensitive alerts — certificate expirations, assignment reminders, and operational follow-ups — reach users instantly on their mobile devices. By centralizing all push delivery through a single hardened component, the organization eliminates the risk of silent failures where critical compliance or coordination messages go undelivered. This directly protects peer mentor program continuity, reduces administrative overhead from missed deadlines, and strengthens coordinator trust in the platform as a reliable operational tool.
This is a shared infrastructure component serving multiple features simultaneously, which makes it a high-priority delivery item with broad blast radius if delayed. Development complexity is medium — FCM integration is well-documented but device token lifecycle management (registration, refresh, removal) requires careful edge-case handling across iOS and Android. Testing must cover token expiry scenarios, batch delivery limits, and retry behavior under network failures. Because certificate expiry notifications, assignment reminders, and pause/resume alerts all depend on this component, it should be delivered and stabilized early in the sprint cycle before dependent features begin integration testing.
Implemented as a backend service that wraps the Firebase Admin SDK, this component exposes a typed interface for both single and batch push dispatch. The `sendPushNotification` method accepts userId-based routing, abstracting the token lookup internally via `getDeviceTokens`. Token lifecycle is managed through `registerDeviceToken` and `removeDeviceToken`, which should write to a device_tokens table keyed on (userId, platform). Batch sending via `sendBatchNotifications` should use FCM's multicast API for efficiency.
Implement exponential backoff for transient FCM errors (503, UNAVAILABLE) and surface delivery receipts for audit logging. Since this is shared across multiple features, ensure no feature-specific payload logic leaks into this layer.
Responsibilities
- Send push notifications to individual devices via FCM
- Manage FCM device token registration and refresh
- Format notification payloads with title, body, and deep-link data
- Handle delivery errors and retry logic
Interfaces
sendPushNotification(userId: String, title: String, body: String, data: Map<String, String>)
sendBatchNotifications(userIds: List<String>, payload: NotificationPayload)
registerDeviceToken(userId: String, token: String, platform: Platform)
removeDeviceToken(userId: String, token: String)
getDeviceTokens(userId: String) -> List<String>
Relationships
Dependents (1)
Components that depend on this component
Used Integrations (1)
External integrations and APIs this component relies on