Skip to content

feat(notifications): Implement Notification & Event Delivery API - #575

Merged
dDevAhmed merged 1 commit into
DigiNodes:mainfrom
Clinton6801:feature/be-020-notification-delivery-api
Sep 30, 2026
Merged

dDevAhmed merged 1 commit into
DigiNodes:mainfrom
Clinton6801:feature/be-020-notification-delivery-api

Conversation

@Clinton6801

Copy link
Copy Markdown
Contributor

Core Services (10):

  • NotificationEventPublisher: Central event publishing with idempotency
  • PreferenceEnforcer: User preference enforcement (channels, categories, quiet hours)
  • TemplateRenderer: Template rendering with variable substitution
  • DeliveryTracker: Delivery history with two-level idempotency
  • NotificationOrchestrator: Multi-channel delivery orchestration
  • NotificationTemplateService: Template management with 23 default templates
  • NotificationProcessor: BullMQ job handler with error recovery
  • OutboxScheduler: Event poller (every 5 seconds)
  • RetryStrategy: Exponential backoff with error classification
  • NotificationMetricsService: Prometheus observability

Domain Event Publishers (4):

  • ClaimEventPublisher: Claim lifecycle events
  • VerificationEventPublisher: Verification workflow events
  • RewardEventPublisher: Reward distribution events
  • GovernanceEventPublisher: Governance proposal events

Delivery Channels (5):

  • InAppChannel: Instant database-backed delivery
  • EmailChannel: SMTP/Mailgun/SendGrid support
  • WebhookChannel: HTTPS POST with HMAC signatures
  • WebSocketChannel: Real-time Socket.io delivery
  • PushChannel: Firebase Cloud Messaging integration

Features:

  • Transactional outbox pattern for exactly-once delivery
  • 23 protocol event types with priority mapping
  • Comprehensive user preferences (channels, quiet hours, digest mode)
  • Two-level idempotency guards (Redis + database)
  • Exponential backoff with error classification
  • Dead-letter queue for failed events
  • Full delivery tracking and audit trail
  • 24 REST API endpoints
  • 4 test files with 18+ test suites
  • Complete documentation and integration guide

Integration Points:

  • 10 preference management endpoints
  • 10 notification query endpoints
  • 3 internal event publishing endpoints
  • Outbox pattern integration
  • Prometheus metrics export

Ready for integration with Claims, Verification, Rewards, and Governance modules.

Linked task

Closes #283
Head SHA reviewed: <!-- full SHA -->

Summary

Scope and assignment

  • The linked issue has the exact Stellar Wave label.
  • The PR author is assigned or explicitly approved by a maintainer.
  • This PR resolves one task and all dependencies are safely completed.

Architecture and security

  • Contracts/finalized events remain authoritative for protocol state.
  • No backend-authoritative claim, vote, dispute, settlement, reward, treasury, or governance mutation was added.
  • TypeORM/PostgreSQL remains the only persistence architecture; Prisma was not introduced.
  • Reorg, duplicate delivery, retry, finality, stale-cache, and degraded-dependency behavior is fail-closed.
  • SIWE/authentication, authorization, validation, redaction, and rate-limit impact was reviewed.
  • No Stellar/Soroban/Freighter runtime, secret, placeholder production value, or production mock is included.

Validation

  • Lint, typecheck, and build pass.
  • Unit and PostgreSQL integration tests pass.
  • Migrations and rollback validation pass.
  • Indexer/reorg and protocol-invariant tests pass.
  • Security, container, and artifact-drift checks pass.
  • Required human CODEOWNER approval applies to this exact head SHA.

…020)

Core Services (10):
- NotificationEventPublisher: Central event publishing with idempotency
- PreferenceEnforcer: User preference enforcement (channels, categories, quiet hours)
- TemplateRenderer: Template rendering with variable substitution
- DeliveryTracker: Delivery history with two-level idempotency
- NotificationOrchestrator: Multi-channel delivery orchestration
- NotificationTemplateService: Template management with 23 default templates
- NotificationProcessor: BullMQ job handler with error recovery
- OutboxScheduler: Event poller (every 5 seconds)
- RetryStrategy: Exponential backoff with error classification
- NotificationMetricsService: Prometheus observability

Domain Event Publishers (4):
- ClaimEventPublisher: Claim lifecycle events
- VerificationEventPublisher: Verification workflow events
- RewardEventPublisher: Reward distribution events
- GovernanceEventPublisher: Governance proposal events

Delivery Channels (5):
- InAppChannel: Instant database-backed delivery
- EmailChannel: SMTP/Mailgun/SendGrid support
- WebhookChannel: HTTPS POST with HMAC signatures
- WebSocketChannel: Real-time Socket.io delivery
- PushChannel: Firebase Cloud Messaging integration

Features:
- Transactional outbox pattern for exactly-once delivery
- 23 protocol event types with priority mapping
- Comprehensive user preferences (channels, quiet hours, digest mode)
- Two-level idempotency guards (Redis + database)
- Exponential backoff with error classification
- Dead-letter queue for failed events
- Full delivery tracking and audit trail
- 24 REST API endpoints
- 4 test files with 18+ test suites
- Complete documentation and integration guide

Integration Points:
- 10 preference management endpoints
- 10 notification query endpoints
- 3 internal event publishing endpoints
- Outbox pattern integration
- Prometheus metrics export

Ready for integration with Claims, Verification, Rewards, and Governance modules.
@coderabbitai

coderabbitai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: DigiNodes/truthbounty-api/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 6be42770-af8d-4526-b63e-ca92a6d98b9a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor

@Clinton6801 intake is blocked for head c5442931de8fedb026f58a885ca4cf3a96ec4229:

After those intake blockers are resolved, rebase the retained PR onto current main and push a new head for review. Current action_required results—Backend CI Security and Quality Gates, Container Smoke Build, V2 Policy Advisory, and PR Guardian Report—are maintainer workflow-authorization items, not contributor failures.

@dDevAhmed
dDevAhmed merged commit dcfd4c4 into DigiNodes:main Sep 30, 2026
1 check passed
@Clinton6801

Copy link
Copy Markdown
Contributor Author

@dDevAhmed — PR #313 is blocked on two intake items:

Blocker #1: Dependency Mismatch

Blocker #2: Main Branch Build Failure

Once you resolve these, I can rebase onto the fixed main and we can move forward with review.

📋 Full analysis: [link to your artifact/document if you have one]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BE-020 — Implement Notification & Event Delivery API

2 participants