Agent-skills-standard nestjs-notification
Build dual-write notification services with database persistence and FCM push delivery in NestJS. Use when creating notification entities, sending push via FCM, or implementing in-app notification feeds. (triggers: notification.service.ts, notification.entity.ts, notification, push, fcm, alert, reminder)
install
source · Clone the upstream repo
git clone https://github.com/HoangNguyen0403/agent-skills-standard
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/HoangNguyen0403/agent-skills-standard "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/nestjs/nestjs-notification" ~/.claude/skills/hoangnguyen0403-agent-skills-standard-nestjs-notification && rm -rf "$T"
manifest:
skills/nestjs/nestjs-notification/SKILL.mdsource content
NestJS Notification Architecture
Priority: P0 (Standard)
Implement "Dual-Write" notification system: persist to Database (In-App) and send via FCM (Push).
Workflow: Send Notification
- Save to database — Persist notification entity with type enum and metadata.
- Check FCM token — Verify recipient valid
; skip push if missing.fcmToken - Send push — Call FCM inside
; never let FCM failure block request.try/catch - Serialize data — Convert Dates to ISO strings; keep FCM
payload flat (IDs only).data
Dual-Write Service Example
Structure
Implementation Guidelines
- Use Dual-Write: Save to DB first, then attempt FCM. Catch FCM errors so they don't block logic.
- Define Granular Types: Use
Enum (e.g.,NotificationType
) for frontend icon/color logic.APPOINTMENT_REMINDER - Stringify Metadata: Store routing data (IDs) as JSON string in DB, but Map to string-only Key-Values for FCM
.data - Handle Tokens: Check for
existence before sending. Fail gracefully if missing.fcmToken - Serialize Dates: Convert Dates to ISO strings before sending to FCM.
Anti-Patterns
- No Generic Types: Avoid
. Always use Enum.type: string - No Blocking FCM: Never
FCM withoutawait
. It shouldn't crash request.try/catch - No Complex Data in Push: Keep FCM
payload flat and minimal (IDs only). Fetch details on open.data