Deep DivesNotification
Development
Local development guide for the RawStack Notification component.
Setup
cd services/notification
npm install
cp .env.example .envFill in your Resend and Twilio credentials. Use OVERRIDE_RECIPIENT_EMAIL to redirect all outbound emails to your own address during development.
Build
npm run build # Compile TypeScript → dist/
npm run watch # Watch modeThe compiled Lambda handler is output to dist/index.js.
Adding a new notification
- Create a strategy in
src/strategy/notifications/:
// src/strategy/notifications/MyEvent.ts
import { NotificationStrategy } from '../NotificationStrategy';
import { EmailChannel } from '../../channel/EmailChannel';
export class MyEventNotification implements NotificationStrategy {
channels = [new EmailChannel()];
buildContent(event: MyEvent) {
return {
email: {
to: event.recipientEmail,
subject: 'Subject here',
template: <MyEmailTemplate {...event} />,
},
};
}
}- Register it in
src/strategy/NotificationRegistry.ts:
registry.set('MyEvent', new MyEventNotification());- Create an email template in
src/content/using React Email components.
Testing notifications locally
The Lambda handler can be invoked directly by calling handler(event) with a mock EventBridge event payload. See existing tests for examples.