Deep DivesNotification
Tech Specification
Technical specification for the RawStack Notification component.
Runtime
| Language | TypeScript v5.7 |
| Runtime | AWS Lambda (Node.js) |
| Trigger | Amazon EventBridge |
Key dependencies
| Package | Purpose |
|---|---|
resend | Email delivery API |
react-email | Email template framework |
@react-email/components | Email UI components |
twilio | SMS delivery API |
react / react-dom | Required for React Email rendering |
dotenv | Environment variable loading |
Supported event types
| Event | Channels |
|---|---|
UserWasCreated | |
AuthTokenWasCreated | Email (e.g., magic link / verification email) |
New event types are added by implementing NotificationStrategy and registering it in NotificationRegistry.
Environment variables
# Email
RESEND_API_KEY=re_...
EMAIL_FROM_ADDRESS=noreply@yourdomain.com
OVERRIDE_RECIPIENT_EMAIL= # Redirect all emails (dev/staging only)
# SMS
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
TWILIO_FROM_NUMBER=+1...
# App
WEBSITE_URL=https://example.comProject structure
services/notification/
├── src/
│ ├── index.ts # Lambda handler entry point
│ ├── channel/ # Channel interfaces and implementations
│ ├── provider/
│ │ ├── email/ # ResendEmailProvider
│ │ └── sms/ # TwilioSmsProvider
│ ├── strategy/
│ │ ├── NotificationStrategy.ts
│ │ ├── NotificationRegistry.ts
│ │ └── notifications/ # One file per event type
│ ├── content/ # Content builders and email templates
│ ├── validation/ # Input validation
│ └── exception/ # Custom error types
├── .env.example
└── package.json