Tutorials

Developer Guide: Building a RedwoodJS Scheduling & Reminder System with AWS SNS & EventBridge

A step-by-step guide to creating a RedwoodJS application for scheduling reminders using AWS SNS for notifications and AWS EventBridge Scheduler for event triggering.

JH
Jacky Hossein
β€’ Principal Telecommunications Architect β€’ Published Nov 2, 2026 β€’ 16 min read

Developer Quick-Start: A step-by-step guide to creating a RedwoodJS application for scheduling reminders using AWS SNS for notifications and AWS EventBridge Scheduler for event triggering. Want to skip 10DLC vetting queues, carrier surcharges, and multi-step SDK boilerplate? You can send the same SMS directly via SMSRoute's REST API with instant no-KYC provisioning.

This guide provides a comprehensive, step-by-step walkthrough for building a production-ready scheduling and reminder application using RedwoodJS, powered by AWS SNS for notifications and AWS EventBridge Scheduler for triggering events. We'll cover everything from initial setup to deployment and monitoring.

Version: 1.0


Project Overview and Goals

What We're Building:

We will build a RedwoodJS application that enables users to schedule reminders. At the scheduled time, the system will automatically send a notification (e.g., email, SMS) via AWS Simple Notification Service (SNS). The scheduling itself will be managed reliably by AWS EventBridge Scheduler, triggering a backend process to dispatch the reminders.

Problems Solved:

  • Automated Reminders: Offload the task of remembering events or tasks from users.
  • Scalable Notifications: Leverage AWS SNS to reliably deliver notifications to potentially large numbers of users across various channels (Email, SMS, Push Notifications).
  • Reliable Scheduling: Utilize AWS EventBridge Scheduler for robust, serverless cron-like job execution, avoiding the complexities of managing self-hosted schedulers.
  • Decoupled Architecture: Separate the core application logic from the notification and scheduling mechanisms, improving maintainability and resilience.

Technologies Used:

  • RedwoodJS: A full-stack JavaScript/TypeScript framework for the web. Provides structure, conventions, a GraphQL API, and ORM integration (Prisma). Chosen for its integrated full-stack experience and developer productivity features.
  • Node.js: The underlying runtime environment for RedwoodJS.
  • PostgreSQL: Our relational database, managed by Prisma via RedwoodJS. (Other SQL databases supported by Prisma can also be used).
  • AWS Simple Notification Service (SNS): A fully managed messaging service for decoupling microservices, distributed systems, and serverless applications. Chosen for its scalability, reliability, and support for multiple endpoint types.
  • AWS EventBridge Scheduler: A serverless scheduler to create, run, and manage scheduled tasks at scale. Chosen for its fine-grained scheduling capabilities (cron expressions), reliability, and native AWS integration.
  • AWS Lambda: A serverless compute service used to run the code triggered by EventBridge Scheduler. It will query the database and publish messages to SNS.
  • AWS SDK for JavaScript v3: Used to interact with AWS services (SNS, potentially others) programmatically from our Lambda function and potentially the RedwoodJS API side.
  • Prisma: The ORM used by RedwoodJS for database access.

System Architecture:

+-------------+       +-----------------+       +-------------------+       +-------------+
| User        |<----->| RedwoodJS Web   |<----->| RedwoodJS API     |<----->| Database    |
| (Browser)   |       | (React Frontend)|       | (GraphQL, Services)|       | (PostgreSQL)|
+-------------+       +-----------------+       +---------+---------+       +------+------+
                                                          |                         |
                                                          | Creates/Updates         | Stores
                                                          | Reminders               | Reminders
                                                          v                         v
+-------------------------+       +-----------------------+       +---------------+       +-----------------+
| AWS EventBridge Scheduler |------>| AWS Lambda Function   |------>| AWS SNS Topic |------>| User Endpoint   |
| (Checks for due       |       | (Queries DB, Formats, |       | (e.g., email) |       | (Email, SMS...) |
| reminders on schedule)  |       | Publishes to SNS)     |       +---------------+       +-----------------+
+-------------------------+       +-----------------------+
       ^ Triggered by Cron                                | Reads Due Reminders
       |                                                  | Updates Status
       +--------------------------------------------------+

Prerequisites:

  • Node.js: Version 20.x recommended (Check RedwoodJS/deployment platform docs for specifics). Use nvm to manage versions.
  • Yarn: Version 1.22.21 or higher.
  • AWS Account: With appropriate permissions to create IAM users/roles, SNS topics, Lambda functions, and EventBridge schedules.
  • AWS CLI: Configured with credentials (aws configure).
  • RedwoodJS CLI: yarn global add redwoodjs-cli (or use npx).
  • Basic Git knowledge.
  • Docker (Optional): For running PostgreSQL locally easily.

Final Outcome:

A functional web application where users can create, view, update, and delete reminders. Scheduled reminders will trigger email notifications (as an example) sent via AWS SNS at the specified time. The system will be robust, scalable, and ready for further feature development.


1. Setting up the Project

Let's initialize our RedwoodJS project and configure the basic environment.

  1. Check Prerequisites:
   node -v
   yarn -v
   aws --version

If Node version is incorrect, use nvm:

   nvm install 20
   nvm use 20

Upgrade Yarn if needed: npm install --global yarn

  1. Create RedwoodJS App: We'll use TypeScript for better type safety. Use single quotes for the commit message to avoid potential shell issues with nested double quotes.
   yarn create redwood-app redwood-sns-scheduler --typescript --git-init --commit-message 'Initial project setup'
   cd redwood-sns-scheduler
  • --typescript: Initializes the project with TypeScript.
  • --git-init: Initializes a Git repository.
  • --commit-message: Sets the initial commit message.
  • yarn install will likely run automatically if using Yarn v1. If not, run yarn install.
  1. Project Structure Overview:
  • api/: Contains the backend code (GraphQL API, services, database schema, functions).
  • web/: Contains the frontend React code (components, pages, layouts).
  • scripts/: For utility scripts (like database seeding).
  • redwood.toml: Project configuration file.
  • package.json: Project dependencies.
  1. Environment Variables (.env): Create a .env file in the project root. This file stores secrets and configuration and should not be committed to Git. Add it to your .gitignore if it's not already there. IMPORTANT: The values below are placeholders. Replace them with your actual credentials and resource identifiers.

.env

   # .env

   # --- Database ---
   # Use Docker or local install. Example for Docker:
   DATABASE_URL=""postgresql://postgres:password@localhost:5432/scheduler_dev?schema=public""

   # --- AWS Credentials (for local development/testing API interactions) ---
   # Obtain these by creating an IAM User with programmatic access (details later)
   # For production, use environment variables provided by your deployment host.
   AWS_ACCESS_KEY_ID=""YOUR_AWS_ACCESS_KEY_ID"" # Replace with your actual key ID
   AWS_SECRET_ACCESS_KEY=""YOUR_AWS_SECRET_ACCESS_KEY"" # Replace with your actual secret key
   AWS_REGION=""us-east-1"" # Replace with your preferred AWS region

   # --- AWS SNS ---
   # Obtain this after creating the SNS topic (details later)
   SNS_TOPIC_ARN=""arn:aws:sns:us-east-1:123456789012:redwood-reminders-topic"" # Replace with actual ARN

   # --- Scheduler Lambda ---
   # We'll define this Lambda later
   SCHEDULER_LAMBDA_ARN=""arn:aws:lambda:us-east-1:123456789012:function:redwood-reminder-scheduler"" # Replace with actual ARN
  • Purpose: DATABASE\_URL connects Prisma to your database. AWS variables allow the SDK to authenticate. SNS\_TOPIC\_ARN tells our code which SNS topic to publish to. SCHEDULER\_LAMBDA\_ARN might be needed if managing EventBridge from the API side (optional).
  1. Database Setup (Local PostgreSQL using Docker): If you have Docker installed, this is the easiest way:
   docker run --name postgres-scheduler -e POSTGRES_PASSWORD=password -e POSTGRES_DB=scheduler_dev -p 5432:5432 -d postgres
  • This starts a PostgreSQL container named postgres-scheduler, sets the password, creates the initial database, maps port 5432, and runs it in the background. Ensure the credentials match your DATABASE\_URL in .env.
  • Alternatively, install PostgreSQL directly on your OS.
  1. Install AWS SDK v3: We'll need the SDK in our API side (potentially) and definitely in our Lambda function later. Let's add it to the API workspace.
   cd api
   yarn add @aws-sdk/client-sns @aws-sdk/client-scheduler @aws-sdk/client-lambda
   cd ..

2. Creating Database Schema and Data Layer

We need a way to store the reminders.

  1. Define Prisma Schema: Edit api/db/schema.prisma. Add a Reminder model.

Prisma

   // api/db/schema.prisma

   datasource db {
     provider = "postgresql"
     url      = env("DATABASE_URL")
   }

   generator client {
     provider      = "prisma-client-js"
     binaryTargets = ["native"]
   }

   // Optional: Add user model if you implement authentication
   // model User {
   //   id         Int       @id @default(autoincrement())
   //   email      String    @unique
   //   // ... other fields
   //   reminders  Reminder[]
   // }

   model Reminder {
     id          Int      @id @default(autoincrement())
     createdAt   DateTime @default(now())
     updatedAt   DateTime @updatedAt
     message     String
     scheduledAt DateTime // Time the reminder should be sent (Store in UTC!)
     status      String   @default("PENDING") // PENDING, SENT, ERROR
     recipient   String   // E.g., email address, phone number, user ID
     // Optional: Link to a user if implementing multi-user support
     // userId      Int?
     // user        User?    @relation(fields: [userId], references: [id])

     @@index([scheduledAt, status]) // Index for efficient querying by the scheduler
   }
  • Explanation: We define fields for the reminder message, the scheduled time (scheduledAt), the recipient identifier (e.g., email), and a status (PENDING, SENT, ERROR). createdAt and updatedAt are standard timestamp fields.
  • scheduledAt: Crucially, store this in UTC. Prisma handles JavaScript Date objects, which are timezone-aware, but ensure consistency.
  • status: Tracks the lifecycle of the reminder.
  • recipient: How we know where to send the notification.
  • @@index: Creates a database index on scheduledAt and status. This is vital for the performance of the Lambda function that queries for pending reminders.
  1. Apply Database Migrations: Create and apply the database migration using Prisma Migrate.
   yarn rw prisma migrate dev --name create_reminders
  • This command generates SQL migration files in api/db/migrations/ and applies them to your database defined in DATABASE\_URL. It will also update your Prisma Client.
  1. Generate Prisma Client: Migrations usually handle this, but you can run it manually if needed:
   yarn rw prisma generate
  1. (Optional) Seed Sample Data: Create api/db/seeds.js to add initial data for testing.
   import { db } from './index'

   const fiveMinutesFromNow = () => {
     const date = new Date()
     date.setMinutes(date.getMinutes() + 5)
     return date.toISOString()
   }

   export default async () => {
     try {
       console.log('Seeding database...')


       await db.reminder.createMany({
         data: [
           {
             message: 'Test Reminder 1 (due in 5 mins)',
             scheduledAt: fiveMinutesFromNow(),
             recipient: 'test@example.com',
             status: 'PENDING',
           },
           {
             message: 'Test Reminder 2 (already sent)',
             scheduledAt: new Date(Date.now() - 3600 * 1000).toISOString(),
             recipient: 'another@example.com',
             status: 'SENT',
           },
           {
             message: 'Test Reminder 3 (due far future)',
             scheduledAt: new Date(Date.now() + 7 * 24 * 3600 * 1000).toISOString(),
             recipient: 'future@example.com',
             status: 'PENDING',
           },
         ],
         skipDuplicates: true,
       })

       console.log('Database seeded successfully!')
     } catch (error) {
       console.error('Error seeding database:', error)
     }
   }

Run the seed script:

   yarn rw exec seed

3. Implementing Core Functionality (Redwood Service)

We need backend logic to manage reminders (Create, Read, Update, Delete). Redwood services are perfect for this.

  1. Generate Reminder Service & SDL: Redwood generators simplify creating the necessary files for a CRUD interface.
   yarn rw g sdl Reminder --crud
  • This command does two things:
  • Creates api/src/services/reminders/reminders.ts: Contains functions (resolvers) to interact with the Reminder model.
  • Creates api/src/graphql/reminders.sdl.ts: Defines the GraphQL schema (types, queries, mutations) for reminders.
  • Updates api/src/directives/requireAuth/requireAuth.ts and api/src/directives/skipAuth/skipAuth.ts (if not already present).
  • Creates basic tests in api/src/services/reminders/reminders.test.ts.
  1. Review Generated Service (api/src/services/reminders/reminders.ts): The generated code provides basic CRUD operations using Prisma.
   import type { QueryResolvers, MutationResolvers, ReminderRelationResolvers } from 'types/graphql'
   import { db } from 'src/lib/db'

   export const reminders: QueryResolvers['reminders'] = () => {

     return db.reminder.findMany()
   }

   export const reminder: QueryResolvers['reminder'] = ({ id }) => {


     return db.reminder.findUnique({
       where: { id },
     })
   }

   export const createReminder: MutationResolvers['createReminder'] = ({ input }) => {



     if (new Date(input.scheduledAt) <= new Date()) {
       throw new Error('Scheduled time must be in the future.')
     }


     return db.reminder.create({
       data: {
         ...input,
         scheduledAt: new Date(input.scheduledAt),
         status: 'PENDING',
       },
     })
   }
  • Key Points:
  • The service functions directly interact with the Prisma client (db).
  • Basic CRUD is provided. You'll likely need to customize this, especially if adding authentication.
  • Input Validation: Added a simple check for scheduledAt being in the future within createReminder. Robust validation (e.g., using Zod) is recommended for production.
  1. Review Generated GraphQL SDL (api/src/graphql/reminders.sdl.ts): This file defines the API shape.
   export const schema = gql`
     type Reminder {
       id: Int!
       createdAt: DateTime!
       updatedAt: DateTime!
       message: String!
       scheduledAt: DateTime!
       status: String!
       recipient: String!


     }

     type Query {
       reminders: [Reminder!]! @requireAuth
       reminder(id: Int!): Reminder @requireAuth
     }

     input CreateReminderInput {
       message: String!
       scheduledAt: DateTime!
       recipient: String!

     }

     input UpdateReminderInput {
       message: String
       scheduledAt: DateTime
       recipient: String
       status: String

     }

     type Mutation {
       createReminder(input: CreateReminderInput!): Reminder! @requireAuth
       updateReminder(id: Int!, input: UpdateReminderInput!): Reminder! @requireAuth
       deleteReminder(id: Int!): Reminder! @requireAuth
     }
   `
  • Key Points:
  • Defines the Reminder type matching the Prisma model.
  • Defines standard CRUD queries and mutations.
  • Uses Redwood's @requireAuth directive by default. You might change this to @skipAuth for public access during development or implement actual authentication.
  1. Test the API: Start the development server:
   yarn rw dev

Navigate to the GraphQL Playground: http://localhost:8911/graphql

  • Create Reminder:
     mutation CreateNewReminder {
       createReminder(input: {
         message: ""Check GraphQL Playground"",
         recipient: ""dev@example.com"",
         scheduledAt: ""2025-04-21T10:00:00.000Z""
       }) {
         id
         message
         scheduledAt
         status
         recipient
       }
     }
  • Query Reminders:
     query GetReminders {
       reminders {
         id
         message
         scheduledAt
         status
       }
     }
  • Experiment with updateReminder and deleteReminder.

4. Setting up AWS Infrastructure (IAM, SNS, Lambda, EventBridge)

This is the core AWS setup for scheduling and notification.

Security First: IAM Setup

We need specific permissions for our different components. Remember to replace placeholders like YOUR_REGION, YOUR_ACCOUNT_ID, and example resource names with your actual values.

  1. IAM User for Local Dev/API (Optional but Recommended):
  • Navigate to IAM in the AWS Console -> Users -> Create user.
  • Username: redwood-scheduler-api-user (or similar).
  • Select Access key - Programmatic access.
  • Attach policies directly or create a group. For simplicity now, attach directly.
  • Click Attach existing policies directly -> Create policy.
  • Go to the JSON tab and paste the following policy (adjust region, account ID, and topic name):
     {
         "Version": "2012-10-17",
         "Statement": [
             {
                 "Sid": "SNSPublishAccessForRemindersTopic",
                 "Effect": "Allow",
                 "Action": "sns:Publish",
                 "Resource": "arn:aws:sns:YOUR_REGION:YOUR_ACCOUNT_ID:redwood-reminders-topic"
             }

         ]
     }
  • Review policy, give it a name (e.g., RedwoodSchedulerAPIPolicy), and create it.
  • Back on the user creation screen, refresh and attach the newly created policy.
  • Complete user creation. Crucially, copy the Access key ID and Secret access key. Add these to your .env file (AWS\_ACCESS\_KEY\_ID, AWS\_SECRET\_ACCESS\_KEY).
  1. IAM Role for Lambda Function: The Lambda function needs permission to access the database (via network/secrets) and publish to SNS.
  • Go to IAM -> Roles -> Create role.
  • Trusted entity type: AWS service.
  • Use case: Lambda.
  • Permissions:
  • Search for and add AWSLambdaBasicExecutionRole (for CloudWatch Logs).
  • Click Create policy. Use the JSON editor:
       {
           "Version": "2012-10-17",
           "Statement": [
               {
                   "Sid": "AllowSNSPublishReminders",
                   "Effect": "Allow",
                   "Action": "sns:Publish",
                   "Resource": "arn:aws:sns:YOUR_REGION:YOUR_ACCOUNT_ID:redwood-reminders-topic"
               }






















           ]
       }
  • Name it RedwoodSchedulerLambdaSNSPolicy (or similar), create it.
  • Back on the role creation screen, attach the new policy (RedwoodSchedulerLambdaSNSPolicy).
  • Give the role a name (e.g., RedwoodSchedulerLambdaRole) and create it. Note the ARN.
  1. IAM Role for EventBridge Scheduler: EventBridge needs permission to invoke our Lambda function.
  • Go to IAM -> Roles -> Create role.
  • Trusted entity type: AWS service.
  • Use case: Scroll down and choose Scheduler.
  • Permissions: Click Create policy. Use the JSON editor:
     {
         "Version": "2012-10-17",
         "Statement": [
             {
                 "Sid": "AllowInvokeReminderLambda",
                 "Effect": "Allow",
                 "Action": "lambda:InvokeFunction",
                 "Resource": "arn:aws:lambda:YOUR_REGION:YOUR_ACCOUNT_ID:function:redwood-reminder-scheduler"
             }
         ]
     }
  • Name it RedwoodEventBridgeInvokeLambdaPolicy, create it.
  • Back on the role creation screen, attach the new policy.
  • Give the role a name (e.g., RedwoodEventBridgeSchedulerRole) and create it. Note the ARN.

SNS Topic Setup

  1. Navigate to Simple Notification Service (SNS) in the AWS Console.
  2. Go to Topics -> Create topic.
  3. Type: Standard.
  4. Name: redwood-reminders-topic.
  5. Leave other settings as default for now (Access policy can be refined later).
  6. Click Create topic.
  7. Note the ARN. Update the SNS\_TOPIC\_ARN value in your .env file (remembering it's a placeholder there).
  8. Create a Subscription for Testing:
  • On the topic page, click Create subscription.
  • Protocol: Email.
  • Endpoint: Enter an email address you can access for testing.
  • Click Create subscription.
  • Check your email inbox for a confirmation message from AWS Notification and click the link to confirm the subscription. The status should change to Confirmed.

Lambda Function Setup

This function will be triggered by EventBridge and will handle sending reminders.

  1. Create Lambda Function Directory: Outside your RedwoodJS project, create a new directory for the Lambda function code. This separates concerns and allows for independent dependency management for the Lambda function.
   mkdir reminder-scheduler-lambda
   cd reminder-scheduler-lambda
   npm init -y
   npm install @aws-sdk/client-sns @prisma/client pg
  • We need the SNS client, Prisma client (to talk to the DB), and the pg driver.
  1. Copy Prisma Schema and Generate Client: The Lambda needs the schema to generate the correct Prisma client. Copy schema.prisma from your Redwood project (api/db/schema.prisma) into the reminder-scheduler-lambda directory.
   cp ../redwood-sns-scheduler/api/db/schema.prisma .

   npx prisma generate --data-proxy
  • Important: Generating the client is crucial. Using --data-proxy connects through Prisma's managed service, avoiding binary compatibility issues but requiring network access and a Prisma Cloud account setup. Using --binary-targets requires specifying the exact Linux architecture and OpenSSL version your Lambda runtime uses (check AWS Lambda documentation) and ensuring these binaries are included in your deployment package. The example code below assumes DATABASE\_URL is directly available, but --data-proxy requires specific connection string format and potentially API key environment variables. Consult Prisma's serverless deployment documentation for details on your chosen strategy. This guide proceeds assuming --data-proxy for simplicity in the example command, but the code uses a standard DATABASE\_URL.
  1. Write Lambda Handler Code (index.js):
   import { PrismaClient } from '@prisma/client'
   import { SNSClient, PublishCommand } from '@aws-sdk/client-sns'

   const prisma = new PrismaClient()
   const snsClient = new SNSClient({ region: process.env.AWS_REGION || 'us-east-1' })

   const SNS_TOPIC_ARN = process.env.SNS_TOPIC_ARN

   export const handler = async (event) => {
     console.log('Scheduler Lambda triggered:', JSON.stringify(event, null, 2))


     if (!SNS_TOPIC_ARN) {
       console.error('SNS_TOPIC_ARN environment variable is not set.')
       return { statusCode: 500, body: 'Internal configuration error (SNS Topic).' }
     }























     const now = new Date()

     const windowStart = new Date(now.getTime() - 60 * 1000)
     const windowEnd = new Date(now.getTime() + 10 * 1000)

     let remindersToSend = []
     try {
       console.log(`Querying for reminders between ${windowStart.toISOString()} and ${windowEnd.toISOString()}`)

       remindersToSend = await prisma.reminder.findMany({
         where: {
           status: 'PENDING',
           scheduledAt: {
             gte: windowStart,
             lte: windowEnd,
           },
         },
         take: 100,
       })
     } catch (dbError) {
       console.error('Error querying database:', dbError)

       return { statusCode: 500, body: 'Database query failed.' }
     }

     if (remindersToSend.length === 0) {
       console.log('No pending reminders found in the current window.')
       return { statusCode: 200, body: 'No reminders to process.' }
     }

     console.log(`Found ${remindersToSend.length} reminders to process.`)

     const publishPromises = []
     const sentReminderIds = []
     const errorReminderIds = []

     for (const reminder of remindersToSend) {
       const messagePayload = {

         default: `Reminder: ${reminder.message}`,
         email: `Subject: Your Reminder!\n\nHi there,\n\nThis is a reminder for: ${reminder.message}\n\nScheduled at: ${reminder.scheduledAt.toISOString()}`,

       }

       const publishParams = {
         TopicArn: SNS_TOPIC_ARN,
         Message: JSON.stringify(messagePayload),
         MessageStructure: 'json',





       }


       publishPromises.push(
         snsClient.send(new PublishCommand(publishParams))
           .then(publishResult => {
             console.log(`Successfully published message for reminder ID ${reminder.id}. Message ID: ${publishResult.MessageId}`)
             sentReminderIds.push(reminder.id)
           })
           .catch(snsError => {
             console.error(`Error publishing message for reminder ID ${reminder.id}:`, snsError)
             errorReminderIds.push(reminder.id)

           })
       )
     }


     await Promise.allSettled(publishPromises)
     console.log(`Finished processing batch. Sent: ${sentReminderIds.length}, Errors: ${errorReminderIds.length}`)


     try {
       if (sentReminderIds.length > 0) {
         console.log(`Updating status to SENT for IDs: ${sentReminderIds.join(', ')}`)

         await prisma.reminder.updateMany({
           where: { id: { in: sentReminderIds } },
           data: { status: 'SENT' },
         })
       }
       if (errorReminderIds.length > 0) {
         console.log(`Updating status to ERROR for IDs: ${errorReminderIds.join(', ')}`)

         await prisma.reminder.updateMany({
           where: { id: { in: errorReminderIds } },
           data: { status: 'ERROR' },
         })
       }
     } catch (updateError) {
       console.error('Error updating reminder statuses in database:', updateError)


       return { statusCode: 500, body: 'Failed to update reminder statuses after sending.' }
     } finally {




     }

     return {
       statusCode: 200,
       body: `Processed batch. Sent: ${sentReminderIds.length}, Errors: ${errorReminderIds.length}`,
     }
   }

You can schedule reminders in a RedwoodJS application by leveraging AWS EventBridge Scheduler to trigger events at specific times, which then activate a backend process to send notifications via AWS SNS. This setup ensures reliable, scalable scheduling and notification delivery. The reminder details are stored in a PostgreSQL database managed by Prisma, RedwoodJS's ORM.

AWS EventBridge Scheduler is used to trigger the reminder notifications. It acts as a serverless cron job system, reliably executing tasks at scheduled times. This removes the need for managing a separate scheduling infrastructure, simplifying the application's architecture.

AWS SNS provides a scalable and reliable way to send notifications across multiple channels, including email, SMS, and push notifications. Its decoupled nature ensures that notification delivery doesn't impact the core application logic, improving resilience and maintainability.

Prisma is RedwoodJS's default ORM and is used throughout the application lifecycle to interact with the PostgreSQL database. It simplifies database operations by providing a type-safe and convenient way to create, read, update, and delete reminder records.

Create a new project by running the command yarn create redwood-app redwood-sns-scheduler --typescript --git-init --commit-message 'Initial project setup'. The --typescript flag initializes a TypeScript project, --git-init creates a Git repository, and --commit-message sets the initial commit message.

The tutorial uses PostgreSQL as the database. It is managed by Prisma, RedwoodJS's built-in Object-Relational Mapper (ORM), enabling easy interaction between the application and the database.

The RedwoodJS application interacts with AWS SNS to send email notifications. The Lambda function, triggered by EventBridge Scheduler, queries the database for due reminders and publishes JSON-formatted messages to an SNS topic. This topic is subscribed to an email endpoint, ensuring delivery to the specified recipient.

The RedwoodJS scheduler uses AWS SNS for sending notifications, EventBridge Scheduler for triggering events, Lambda for running the notification logic, and potentially Secrets Manager for storing database credentials securely. These services provide a serverless architecture for the application.

The Lambda function needs access to the database credentials and permission to publish to the designated SNS topic. An IAM role specifically for the Lambda function is created with these permissions, ensuring secure access to resources.

The status field in the Reminder model tracks the reminder's lifecycle, using values like PENDING, SENT, and ERROR. This allows for efficient management and monitoring of the reminder's delivery status.

Storing scheduledAt as UTC in the database ensures consistency and avoids timezone-related issues, especially when dealing with users across different geographical locations. This guarantees the reminder is triggered at the correct time regardless of the user's local timezone.

Environment variables are stored in a .env file in the project root. This file contains sensitive information like database credentials, AWS access keys, and SNS topic ARNs. For the Lambda function, environment variables are configured through the AWS Lambda console.

You'll need Node.js (v20.x recommended), Yarn (v1.22.21+), an AWS account with necessary permissions, AWS CLI, RedwoodJS CLI, basic Git knowledge, and optionally Docker for local PostgreSQL.

Although not explicitly implemented in the basic tutorial, multi-user support can be added by associating reminders with users in the database schema. This allows filtering reminders based on the current user and enhances data privacy.

Simpler Alternative: Send the Same SMS With SMSRoute (No-KYC, Direct Routes)

If you want to replace legacy aggregator SDK boilerplate, multi-week compliance queues, and opaque carrier surcharges with a single HTTP request, SMSRoute delivers global SMS over direct Tier-1 carrier interconnects with instant API access and transparent per-country pricing.

curl -X POST https://api.sendsmsnokyc.com/messages \
  -H "x-api-key: $SMSROUTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["+14155551234"],
    "channel": ["sms"],
    "body": "Your verification code is 482910"
  }'
  • Instant onboarding: No KYC paperwork or sales queues β€” grab an API key and fund with crypto (BTC/USDT) or card.
  • Direct Tier-1 routes: Verify real handset delivery, DLR latency, and Sender ID preservation before launch via SMSRoute Live Carrier Testing.
  • Transparent global pricing: Compare exact per-country termination rates on our live pricing page.

Ship Global SMS in One API Call

Skip legacy SDK sprawl and carrier bottlenecks. Send OTPs, alerts, and bulk campaigns across 190+ countries with SMSRoute.

Explore SMSRoute Developers β†’