@feathers-baas/plugin-notifications 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +99 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @feathers-baas/plugin-notifications
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add README for each package, update AGENTS.md template, fix MongoDB auth entityId, and add timestamp hooks for consistent createdAt/updatedAt across all databases
|
|
8
|
+
|
|
3
9
|
## 0.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @feathers-baas/plugin-notifications
|
|
2
|
+
|
|
3
|
+
Notification plugin for [feathers-baas](https://github.com/anthropics/feathers-baas) — BullMQ-backed email delivery with SMTP, Resend, SendGrid, and Brevo drivers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @feathers-baas/plugin-notifications
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## How it works
|
|
12
|
+
|
|
13
|
+
Auth events (verify email, reset password, etc.) are routed through the notification system. Two delivery modes:
|
|
14
|
+
|
|
15
|
+
- **Direct mode** (no Redis) — drivers called synchronously in the request path. Suitable for development and API-based drivers.
|
|
16
|
+
- **Queue mode** (with Redis) — jobs enqueued in BullMQ with automatic retries and exponential backoff. Best for production.
|
|
17
|
+
|
|
18
|
+
If no driver env vars are configured, auth events are logged to console.
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
Add driver env vars to `.env`:
|
|
23
|
+
|
|
24
|
+
```env
|
|
25
|
+
# Pick one (or more):
|
|
26
|
+
|
|
27
|
+
# SMTP
|
|
28
|
+
SMTP_URL=smtp://user:pass@localhost:1025
|
|
29
|
+
SMTP_FROM_NAME=My App
|
|
30
|
+
SMTP_FROM_ADDRESS=no-reply@example.com
|
|
31
|
+
|
|
32
|
+
# Resend
|
|
33
|
+
RESEND_API_KEY=re_xxxxxxxxxxxx
|
|
34
|
+
RESEND_FROM_NAME=My App
|
|
35
|
+
RESEND_FROM_ADDRESS=no-reply@yourdomain.com
|
|
36
|
+
|
|
37
|
+
# SendGrid
|
|
38
|
+
SENDGRID_API_KEY=SG.xxxxxxxxxxxx
|
|
39
|
+
SENDGRID_FROM_NAME=My App
|
|
40
|
+
SENDGRID_FROM_ADDRESS=no-reply@yourdomain.com
|
|
41
|
+
|
|
42
|
+
# Brevo
|
|
43
|
+
BREVO_API_KEY=xkeysib-xxxxxxxxxxxx
|
|
44
|
+
BREVO_FROM_NAME=My App
|
|
45
|
+
BREVO_FROM_ADDRESS=no-reply@yourdomain.com
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For queue mode, add Redis:
|
|
49
|
+
|
|
50
|
+
```env
|
|
51
|
+
REDIS_URL=redis://localhost:6379
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
No code changes needed — `@feathers-baas/core` auto-configures drivers from env vars.
|
|
55
|
+
|
|
56
|
+
## Email drivers
|
|
57
|
+
|
|
58
|
+
| Driver | Class | Env var | Use case |
|
|
59
|
+
|----------|-----------------|--------------------|-----------------------------------|
|
|
60
|
+
| SMTP | `SMTPDriver` | `SMTP_URL` | Self-hosted SMTP, Mailtrap |
|
|
61
|
+
| Resend | `ResendDriver` | `RESEND_API_KEY` | Managed transactional email |
|
|
62
|
+
| SendGrid | `SendGridDriver`| `SENDGRID_API_KEY` | Twilio SendGrid |
|
|
63
|
+
| Brevo | `BrevoDriver` | `BREVO_API_KEY` | Brevo (formerly Sendinblue) |
|
|
64
|
+
|
|
65
|
+
All configured drivers are active simultaneously.
|
|
66
|
+
|
|
67
|
+
## Auth events handled automatically
|
|
68
|
+
|
|
69
|
+
| Event | Trigger |
|
|
70
|
+
|--------------------|----------------------------|
|
|
71
|
+
| Verify email | User registers |
|
|
72
|
+
| Resend verification| User requests re-send |
|
|
73
|
+
| Reset password | User requests reset |
|
|
74
|
+
| Password changed | After successful reset |
|
|
75
|
+
| Email change | Identity change request |
|
|
76
|
+
|
|
77
|
+
## Exports
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
// Drivers
|
|
81
|
+
import { SMTPDriver, ResendDriver, SendGridDriver, BrevoDriver } from '@feathers-baas/plugin-notifications'
|
|
82
|
+
|
|
83
|
+
// Driver registry
|
|
84
|
+
import { DriverRegistry } from '@feathers-baas/plugin-notifications'
|
|
85
|
+
|
|
86
|
+
// Notifier factories
|
|
87
|
+
import { createBullMQNotifier, createDirectNotifier } from '@feathers-baas/plugin-notifications'
|
|
88
|
+
|
|
89
|
+
// Queue utilities
|
|
90
|
+
import { createNotificationQueue, createNotificationWorker } from '@feathers-baas/plugin-notifications'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Plugin interface
|
|
94
|
+
|
|
95
|
+
This package exports a `FeathersBaasPlugin` default export and is auto-discovered by `@feathers-baas/core` when listed as a dependency. Drivers are configured automatically from env vars by core's `configureNotifications()`.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
MIT
|
package/package.json
CHANGED