Resend + Encore

Transactional email.
From the first deploy.

Resend handles email delivery. Encore handles the infrastructure and observability around it. The email infrastructure most teams build over weeks, you start with it.

$ encore app create --example=ts/resend

What is ?

Encore is an open source TypeScript backend framework. You define your infrastructure (databases, queues, cron jobs, API endpoints) directly in your application code using the Encore SDK.

Encore understands your app's architecture and uses it to run your app locally, provision cloud infrastructure (in your AWS or GCP account), and give you observability like distributed tracing and service catalogs, all without config files or boilerplate.

Learn more about Encore →

What Resend + Encore gives you

The infrastructure you'd eventually build around email (async delivery via Pub/Sub, secrets per environment, preview environments, tracing) already done, in your AWS or GCP account.

Async delivery via Pub/Sub

Define a message topic in TypeScript, publish email events to it, and return immediately. Encore delivers messages in the background with automatic retries.

Deploy to your own AWS or GCP

Start free on Encore Cloud. When you're ready, connect your own AWS or GCP account and Encore deploys there instead. No code changes.

AWSGCP

Trace every request

Every API call and email send gets a visual timeline showing what happened, how long it took, and where it failed.

Preview environments

Every pull request gets a full copy of your backend with its own secrets and message topics. Test email flows before merging.

Scheduled emails

Define cron jobs in TypeScript for digest emails, reminders, and drip campaigns. Encore runs them for you.

Secrets management

Store your Resend API key in Encore instead of .env files. Each environment (local, preview, production) has its own values.

React Email templates

Build email templates with React components. Type-safe, composable, and easy to test locally.

Simple to use

Configure Resend, publish email events, and let Encore handle delivery in the background.

1

Configure the Resend client

Initialize the Resend SDK with your API key stored as an Encore secret. Secrets are encrypted per environment and injected at runtime.

email/resend.ts
import { Resend } from "resend";
import { secret } from "encore.dev/config";

const apiKey = secret("RESEND_API_KEY");

export const resend = new Resend(apiKey());
2

Define a Pub/Sub topic for emails

Encore's Pub/Sub lets you define message topics in TypeScript. Publishing returns instantly so your endpoints stay fast. Encore delivers messages in the background with automatic retries.

email/topic.ts
import { Topic, Subscription } from "encore.dev/pubsub";
import { resend } from "./resend";

export interface EmailEvent {
  to: string;
  subject: string;
  html: string;
  from?: string;
}

export const emailTopic = new Topic<EmailEvent>("emails", {
  deliveryGuarantee: "at-least-once",
});

// Encore processes this in the background
const _ = new Subscription(emailTopic, "send-email", {
  handler: async (event) => {
    const { error } = await resend.emails.send({
      from: event.from ?? "Your App <hello@yourapp.com>",
      to: event.to,
      subject: event.subject,
      html: event.html,
    });

    if (error) throw new Error(error.message);
  },
});
3

Send emails from anywhere

Publish to the topic from any service. The email is delivered asynchronously and every message is automatically traced so you can see exactly what happened, locally and in production.

users/registration.ts
import { api } from "encore.dev/api";
import { emailTopic } from "../email/topic";

interface SignupRequest {
  email: string;
  name: string;
}

export const signup = api(
  { expose: true, method: "POST", path: "/signup" },
  async (req: SignupRequest): Promise<void> => {
    // Create the user...

    // Send welcome email (non-blocking)
    await emailTopic.publish({
      to: req.email,
      subject: "Welcome to our app!",
      html: `<p>Hi ${req.name}, thanks for signing up!</p>`,
    });
  }
);

See every email in the trace viewer

Every Pub/Sub message and API call is traced automatically. See exactly when an email was published, when Resend received it, and whether delivery succeeded, locally and in production. No instrumentation code to write.

Learn more about tracing →

What you don't have to build

The boring, error-prone work that Resend and Encore eliminate.

Email delivery & retriesResend
Bounce & complaint handlingResend
DKIM/SPF/DMARC setupResend
Email analytics & loggingResend
React Email templatesResend
Audience managementResend
Pub/Sub for async deliveryEncore
Secrets & credentialsEncore
CI/CD pipelineEncore
Preview environmentsEncore
TLS certificatesEncore
Distributed tracingEncore
Cron jobs for scheduled emailsEncore
Cloud IAM & networkingEncore
Container orchestrationEncore

You focus on your product. That's it.

Build your Resend + Encore backend with AI

Because Encore defines infrastructure in code and provides built-in distributed tracing, AI coding assistants like Claude and Cursor can build and debug your entire Resend integration end-to-end.

They can read your Encore services to understand email flows and Pub/Sub topics, then inspect traces to diagnose exactly what happened when a Resend email was sent or a delivery failed.

When you're ready for your own cloud

Connect your AWS or GCP account and deploy. Encore provisions the infrastructure directly in your account: databases, load balancers, IAM roles, networking. Same code you've been running on Encore Cloud.

You can see it all in your console. Customer data stays in your infrastructure. Full control when you need it.

Learn how cloud deployment works →

What you get in your own cloud

Declare what you need in TypeScript. Encore provisions it in your AWS or GCP account.

Databases

RDS or Cloud SQL for email logs, templates, and delivery tracking.

Secrets

AWS Secrets Manager or GCP Secret Manager for API keys.

Pub/Sub

SQS or GCP Pub/Sub for async email delivery and retries.

Cron Jobs

CloudWatch or Cloud Scheduler for digest emails and drip campaigns.

Load Balancer & TLS

ALB or Cloud Load Balancing with automatic certificates.

Object Storage

S3 or Cloud Storage for email attachments and templates.

IAM & Networking

Proper IAM roles, VPCs, and security groups by default.

Observability

Distributed tracing, metrics, and logging out of the box.

Trusted by teams at
GrouponPaveBookshop.orgCoinbase

Start sending with Resend + Encore

Production-ready email infrastructure in minutes, not weeks.