Infrastructure / Developer Tools

Relay

A multi-channel notification infrastructure that lets product teams send emails, SMS, push notifications, and in-app messages from a single API.

Full-Stack DeveloperRelay Systems2024 - 2025Team of 4
🔔

Overview

Relay is a notification infrastructure service. Product teams integrate once, then route messages across email, SMS, push, and in-app channels without managing individual provider SDKs. It handles delivery, templating, preference management, and analytics from a single dashboard.

The Problem

Every product eventually needs to send notifications across multiple channels. Teams end up integrating Resend for email, Twilio for SMS, Firebase for push, and building their own in-app notification system. Each provider has its own SDK, templating format, rate limits, and failure modes. The result is fragmented notification logic scattered across the codebase, with no unified view of what a user received across channels.

Approach

Unified API with channel routing

A single API endpoint accepts a notification payload with the message content, recipient, and channel preferences. The routing engine decides which channel to use based on the user's preferences, the message priority, and channel-specific rules. A transactional receipt confirmation goes to email and push. A marketing update goes to in-app only if the user opted out of email.

Provider abstraction layer

Each channel (email, SMS, push, in-app) has a provider interface. Swapping Resend for SendGrid, or Twilio for Vonage, is a config change, not a code change. The abstraction handles retries, rate limiting, and fallback providers automatically. If the primary email provider is down, Relay fails over to the secondary without dropping messages.

Template engine with per-channel rendering

One template, multiple outputs. Authors write content once using a block-based editor. The engine renders it as HTML for email, plain text for SMS, a structured payload for push, and a React component for in-app. Variables and conditionals work across all formats.

Real-time delivery tracking

Every notification is tracked from dispatch to delivery. Webhook listeners on each provider feed delivery events (sent, delivered, opened, bounced, failed) into a unified timeline. The dashboard shows per-user notification history across all channels in one view.

Challenges

Handling provider rate limits without losing messages

SMS providers enforce strict rate limits. Built a queue system with per-provider rate limiting using Redis sorted sets. Messages queue up when the limit is hit and drain at the maximum allowed rate. Priority messages jump the queue. No message is ever dropped, just delayed.

User preference management at scale

Users have different preferences per channel and per notification type. Built a preference matrix that supports granular opt-in/opt-out at the intersection of channel and category. The routing engine evaluates preferences before dispatching, so a user who unsubscribed from marketing emails still gets transactional push notifications.

Results

Relay delivers over 2 million notifications per month across 4 channels for 30+ product teams.

2M+

Notifications delivered per month

99.7%

Delivery success rate across all channels

30+

Product teams using the platform

Tech Stack

Next.jsDashboard UI and API routes for the management console
TypeScriptType-safe provider interfaces and notification payload validation
PostgreSQLNotification logs, user preferences, and template storage
RedisQueue management, rate limiting, and real-time delivery tracking
ResendPrimary email provider with webhook support for delivery events
VitestIntegration tests for the routing engine and provider failover logic