> nestjs-notification
Standards for Notification Types, Service Architecture, and FCM Integration. Use when building notification services or integrating FCM in NestJS. (triggers: notification.service.ts, notification.entity.ts, notification, push, fcm, alert, reminder)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/nestjs-notification?format=md"NestJS Notification Architecture
Priority: P0 (Standard)
Implement a "Dual-Write" notification system: persist to Database (In-App) and send via FCM (Push).
Structure
src/modules/notification/
├── notification.service.ts # Logic: DB Save + FCM Send
├── entities/
│ └── notification.entity.ts # DB Schema + NotificationType Enum
└── types/
└── notification.types.ts # Interfaces for Payloads/Metadata
Implementation Guidelines
- Use Dual-Write: Save to DB first, then attempt FCM. Catch FCM errors so they don't block the logic.
- Define Granular Types: Use
NotificationTypeEnum (e.g.,APPOINTMENT_REMINDER) for frontend icon/color logic. - 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
fcmTokenexistence before sending. Fail gracefully if missing. - Serialize Dates: Convert Dates to ISO strings before sending to FCM.
Anti-Patterns
- No Generic Types: Avoid
type: string. Always use the Enum. - No Blocking FCM: Never
awaitFCM without atry/catch. It shouldn't crash the request. - No Complex Data in Push: Keep FCM
datapayload flat and minimal (IDs only). Fetch details on open.
Reference & Examples
- Service Pattern (Dual-Write): references/service.md
- Type Definitions: references/types.md
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)