notification-system

Implements database-backed in-app notifications with WebSocket broadcast fallbacks and admin send endpoints.

Updated Dec 24, 2025
One-click install
npx skills add https://github.com/JoyJoin-Tech-Limited/JoyJoin_app_v0.1 --skill notification-system-joyjoin-tech-limited
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: notification-system
Source: https://github.com/JoyJoin-Tech-Limited/JoyJoin_app_v0.1/tree/main/.github/skills/notification-system
Command: npx skills add https://github.com/JoyJoin-Tech-Limited/JoyJoin_app_v0.1 --skill notification-system-joyjoin-tech-limited

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? It ensures users reliably receive in-app notifications by persisting every notification to the database first, treating WebSocket delivery as a best-effort enhancement, and providing unread-count polling as a guaranteed fallback. ## Core Features & Use Cases - Database-first notification triggers: Create persisted notification rows via notificationsRepo.createNotification() for event status changes, matches, and admin actions. - Unread counts and mark-read semantics: Per-category unread counts (discover, activities, chat) served from /api/notifications/counts with batch mark-read operations. - Admin broadcast and single-send: Operator-gated endpoints for broadcasting to multiple users or sending to one user, with recipient/read statistics. - Use Case: When an event is cancelled, participants automatically receive a persisted system_alert notification through eventBroadcast.ts, and the badge count updates even if the WebSocket is down thanks to 30-second polling. ## Quick Start Ask the AI to add a new notification trigger for pool registration reminders using the notification-system skill.

Frequently Asked Questions about notification-system

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new notification trigger in an Express app?▼

Add a call to notificationsRepo.createNotification() in the relevant flow so the row is persisted to the notifications table, then optionally call wsService.broadcastToUser() for real-time delivery. For event lifecycle changes, use the existing helpers in eventBroadcast.ts instead of ad-hoc repo calls.

How do I implement unread notification counts per category?▼

Compute counts from the database by grouping notifications where isRead is false by category (discover, activities, chat). Expose them via GET /api/notifications/counts and have clients poll every 30 seconds as a fallback to WebSocket updates.

Why is the notification badge not updating after marking as read?▼

The mark-read mutation succeeded but the count query was not invalidated. Ensure the useMarkNotificationsAsRead hook calls invalidateQueries for the count query key so the badge refetches fresh database counts.

Does this notification system support push notifications or SMS?▼

No. Push notifications (APNs, FCM), SMS, and WeChat template messages are explicitly out of scope and not yet implemented. The system covers only in-app, database-backed notifications with WebSocket delivery.

Why does an admin broadcast show wrong recipient statistics?▼

getNotificationStats groups rows by title, message, sent_by, and created_at. If the message varies per recipient, the grouping breaks. Ensure all broadcast rows share identical values for these fields.