Summary
Add Firebase Cloud Messaging (FCM) to deliver push notifications to Android and web clients from the Go backend.
Scope
Backend (Go)
Web (Next.js)
Add firebase JS SDK (shared with Firebase Auth feat: add Firebase Authentication across all app layers #15 )
Request notification permission and obtain an FCM registration token on the client
Register a service worker (public/firebase-messaging-sw.js) to handle background messages
Send the registration token to the backend so it can be stored per-user
Handle foreground messages via onMessage()
Mobile (Android / Jetpack Compose)
Add com.google.firebase:firebase-messaging via version catalog
Extend FirebaseMessagingService to handle foreground and background messages
On token refresh, send the new FCM token to the backend
Display notifications using NotificationCompat for background delivery; handle foreground in-app
Backend storage
Migration: add fcm_tokens table (user_id, token, platform, created_at) so the backend can fan-out to all of a user's devices
Acceptance criteria
Dependencies
Summary
Add Firebase Cloud Messaging (FCM) to deliver push notifications to Android and web clients from the Go backend.
Scope
Backend (Go)
firebase.google.com/go/v4Admin SDK (shared with the Firebase Auth integration from feat: add Firebase Authentication across all app layers #15)usecase/with aSendNotificationinterfaceinfrastructure/using the FCM HTTP v1 API via the Admin SDKFIREBASE_SERVICE_ACCOUNT_JSON(or path to the key file) in env — document inbackend/.env.exampleWeb (Next.js)
firebaseJS SDK (shared with Firebase Auth feat: add Firebase Authentication across all app layers #15)public/firebase-messaging-sw.js) to handle background messagesonMessage()Mobile (Android / Jetpack Compose)
com.google.firebase:firebase-messagingvia version catalogFirebaseMessagingServiceto handle foreground and background messagesNotificationCompatfor background delivery; handle foreground in-appBackend storage
fcm_tokenstable (user_id,token,platform,created_at) so the backend can fan-out to all of a user's devicesAcceptance criteria
FIREBASE_SERVICE_ACCOUNT_JSONadded tobackend/.env.examplewith a placeholder and commentfcm_tokenstablebackend/docs/fcm.md,web/docs/fcm.md, andmobile/docs/fcm.mdDependencies