Resend
Set up transactional email and marketing campaigns with Resend.
Resend handles transactional emails like welcome messages, password resets, and notifications. It also supports marketing campaigns through Audiences and Broadcasts.
Create a Resend Account
- Go to resend.com and create an account
- Verify your email address
Get Your API Key
- Navigate to API Keys in your Resend dashboard
- Click Create API Key
- Copy the key to
RESEND_API_KEY
Configure Your Domain
For production, you'll want to send from your own domain:
- Go to Domains in Resend
- Click Add Domain
- Add the DNS records to your domain provider
- Wait for verification (usually a few minutes)
- Update
RESEND_FROM_EMAILto use your domain
RESEND_FROM_EMAIL="hello@yourdomain.com"
During development, you can use onboarding@resend.dev as the sender.
Email Templates
VelocityKit includes email utilities in src/lib/resend/client.ts:
import { sendEmail } from "@/lib/resend/client";
// Send a simple email
await sendEmail({
to: "user@example.com",
subject: "Welcome to VelocityKit",
html: "<p>Thanks for signing up!</p>",
});
React Email Templates
For more complex emails, use React components:
import { WelcomeEmail } from "@/emails/welcome";
import { sendEmail } from "@/lib/resend/client";
await sendEmail({
to: "user@example.com",
subject: "Welcome!",
react: WelcomeEmail({ name: "John" }),
});
Common Email Scenarios
Welcome Email
Sent when a user signs up:
await sendEmail({
to: user.email,
subject: `Welcome to ${siteConfig.name}`,
html: `
<h1>Welcome, ${user.name}!</h1>
<p>Thanks for signing up. Here's how to get started...</p>
`,
});
Subscription Confirmation
Sent after a successful payment:
await sendEmail({
to: user.email,
subject: "Your subscription is active",
html: `
<h1>You're all set!</h1>
<p>Your Pro subscription is now active.</p>
`,
});
Development Mode
By default, emails are logged but not sent in development to avoid accidental emails.
To actually send emails in development:
RESEND_ENABLED_IN_DEV=true
Check your terminal logs to see what would have been sent.
Waitlist Mode
VelocityKit includes waitlist functionality using Resend Audiences:
- Create an Audience in Resend
- Add the Audience ID to your environment:
RESEND_WAITLIST_AUDIENCE_ID=aud_xxx
- Use the waitlist action:
import { joinWaitlist } from "@/lib/waitlist/actions";
// In your form
const result = await joinWaitlist(formData);
Emails are stored in your Resend Audience, ready for launch announcements.