BE-024 — Implement Notification Delivery Service - #318
Merged
dDevAhmed merged 3 commits intoJul 29, 2026
Conversation
- Add TypeORM entities: Notification, NotificationDelivery, UserNotificationPreference, NotificationTemplate - Implement BullMQ-backed notification queue with exponential backoff retry - Add 5 delivery channels: in-app, email, webhook, push, SMS - Build template engine with locale fallback and variable substitution - Create full REST API: CRUD, preferences, scheduling, cancel, metrics - Enforce user preferences: channels, quiet hours, frequency, categories - Expose monitoring metrics endpoint - 41 passing unit/integration tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the centralized Notification Delivery Service (BE-024) as the communication backbone for the TruthBounty ecosystem. All outbound user notifications now pass through this service instead of individual modules sending independently.
Closes #293
What was done
Core Architecture
Notification,NotificationDelivery,UserNotificationPreference,NotificationTemplate— covering delivery tracking, retries, user config, and versioned templatesnotifications-queue) with exponential backoff, configurable max retries, and delayed/scheduled delivery support{{variable}}substitution, locale fallback, and multi-format rendering (plain text, HTML, markdown)API Endpoints
/notifications/notifications/:userId/notifications/:userId/unread-count/notifications/:notificationId/read/notifications/:userId/read-all/notifications/:notificationId/deliveries/notifications/schedule/notifications/:notificationId/cancel/notifications/preferences/:userId/notifications/admin/metrics/notifications/admin/seed-templatesUser Preference Enforcement
Delivery Tracking & Retry
Monitoring
Testing
notification.service.spec.ts— 19 tests: creation, delivery, retry, preferences, scheduling, metricstemplate.service.spec.ts— 9 tests: rendering, locale fallback, substitutiondelivery-channels.spec.ts— 9 tests: all 5 channels, failure modesnotification.processor.spec.ts— 4 tests: job dispatch, unknown job, concurrencyDependencies
SMTP_HOST,SMTP_PORT,SMTP_USER,SMTP_PASS,SMTP_FROM,NOTIFICATION_QUEUE_DELAY,NOTIFICATION_MAX_RETRIES,NOTIFICATION_RETRY_DELAYFiles Changed
.env.example— Added SMTP and notification queue configurationsrc/app.module.ts— RegisteredNotificationModulesrc/notifications/interfaces/notification-payload.interface.ts— Fixed incompleteDeliveryResultinterfacesrc/notifications/— 27 new files (entities, DTOs, services, controller, processor, module, tests)Verification
Blocks