Introduction
An overview of the RawStack Notification component.
The Notification service is a serverless AWS Lambda microservice responsible for sending email and SMS notifications. It is event-driven — it receives events from EventBridge (published by the API) and routes them to the appropriate notification channels.
Responsibilities
- Send transactional emails (registration, password reset, email verification) via Resend
- Send SMS messages via Twilio
- Render email templates using React Email
- Map domain events to notification strategies
Architecture
The service uses three layers:
Strategies
Each domain event maps to a strategy (e.g., UserWasCreated, AuthTokenWasCreated). The strategy defines which channels to notify and what content to send.
Channels
Channels abstract the delivery mechanism: EmailChannel, SmsChannel, PushChannel. Each channel delegates to a provider.
Providers Providers are thin wrappers around third-party SDKs:
ResendEmailProvider— sends email via the Resend APITwilioSmsProvider— sends SMS via Twilio
EventBridge Event
│
Lambda Handler
│
NotificationRegistry ── looks up strategy by event type
│
NotificationStrategy ── defines channels + content
│
Channel (Email / SMS)
│
Provider (Resend / Twilio)Email templates
Email templates are built with React Email and @react-email/components. Templates are rendered to HTML at runtime inside the Lambda, so no separate rendering service is needed.