Deep DivesNotification

Tech Specification

Technical specification for the RawStack Notification component.

Runtime

LanguageTypeScript v5.7
RuntimeAWS Lambda (Node.js)
TriggerAmazon EventBridge

Key dependencies

PackagePurpose
resendEmail delivery API
react-emailEmail template framework
@react-email/componentsEmail UI components
twilioSMS delivery API
react / react-domRequired for React Email rendering
dotenvEnvironment variable loading

Supported event types

EventChannels
UserWasCreatedEmail
AuthTokenWasCreatedEmail (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.com

Project 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