Skip to content

Feature/notify creator new fan#97

Merged
elizabetheonoja-art merged 7 commits intoSubStream-Protocol:mainfrom
Skinny001:feature/notify-creator-new-fan
Mar 25, 2026
Merged

Feature/notify creator new fan#97
elizabetheonoja-art merged 7 commits intoSubStream-Protocol:mainfrom
Skinny001:feature/notify-creator-new-fan

Conversation

@Skinny001
Copy link
Copy Markdown
Contributor

This pull request introduces a new subscription event system with in-app and email notifications, as well as a public API for retrieving creator subscriber statistics. It also refactors the main application entry point to support these new features and adds new routes and services for handling subscription events and payouts. The most important changes are grouped below.

Subscription Event Handling and Notification System

  • Added a new SubscriptionService (src/services/subscriptionService.js) to handle subscription events (subscribe, unsubscribe, expire), maintain cached subscriber counts, emit events, and trigger notifications and audit logs.
  • Introduced a NotificationService (src/services/notificationService.js) to manage in-app notifications for creators, with methods to add, list, and mark notifications as read.
  • Implemented an email utility (src/utils/email.js) using nodemailer for sending notification emails to creators when they gain new subscribers.

API and Routing Enhancements

  • Added a new /api/subscription/events webhook endpoint (routes/subscription.js) to receive subscription events, validate secrets, and delegate processing to the SubscriptionService.
  • Added a new /api/creator/:id/stats endpoint to fetch creator statistics, including the cached subscriber count.
  • Added a /api/payouts endpoint to retrieve payout information for a creator.

Main Application Refactor

  • Refactored index.js to initialize and inject the new services (SubscriptionService, NotificationService, email utility), expose subscriptionService on the app for use in routers, and register new routes for subscription events and payouts. [1] [2] [3]
  • Removed redundant/duplicate middleware and route definitions, consolidating the app's entry point to avoid conflicts and improve maintainability.

Testing

  • Added a new test suite (subscription.test.js) to verify subscription event processing and the correctness of the subscriber count API.

Dependency Management

  • Added better-sqlite3 as a new dependency in package.json to support improved database operations.

close #5

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 25, 2026

@Skinny001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@elizabetheonoja-art
Copy link
Copy Markdown
Member

resolve conflicts

@Skinny001
Copy link
Copy Markdown
Contributor Author

resolve conflicts

Done

@elizabetheonoja-art elizabetheonoja-art merged commit c4062b4 into SubStream-Protocol:main Mar 25, 2026
1 check failed
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.

#5 Issue: [Notification] New Subscriber Alert

2 participants