Notification Microservice (learnway-notification-service/)
The LearnWay Notification Microservice (learnway-notification-service/) coordinates multi-channel message delivery: push notifications to mobile/web clients, in-app notification center inbox synchronization, and transactional emails.
Architecture & Queue Processing
Key Responsibilities
1. Push Notification Pipeline (FCM)
- Device Token Management: Manages device tokens per user across iOS (APNs via FCM), Android (FCM), and Web push.
- Token Rotation & Pruning: Automatically purges invalidated or unregistered tokens returned by FCM error payloads.
- Notification Types:
- Streak Reminders (βDonβt lose your 5-day streak! Complete 1 lesson today π₯β)
- Quiz Battle Match Found & Opponent Turn Alerts
- Weekly Contest Announcements & Prize Distributions
- NFT Minting and Certificate confirmations
2. Transactional Email Pipeline (Resend)
- High-deliverability transactional emails with responsive HTML templates:
- 6-digit Email Authentication OTPs
- Password Reset & Wallet PIN verification codes
- Course Completion Certificates (with attached PDF / IPFS badge links)
- Weekly Learning Digest & Leaderboard Recap
3. In-App Notification Center
- Persists read/unread notifications in the PostgreSQL notification database.
- Exposes read-receipt APIs (
PATCH /api/v2/notifications/:id/read) and bulk read triggers. - Emits real-time badge increments to active mobile WebSocket sessions.