Does Express Work With Resend?
Express and Resend work together seamlessly—Express handles your API routes and Resend sends emails, making it trivial to add email functionality to any Node.js backend.
Quick Facts
How Express Works With Resend
Express and Resend integrate naturally because Resend provides a simple REST API and a Node.js SDK—you just install the SDK and call it from your Express route handlers. There's no special middleware or configuration needed. In a typical setup, you create an Express endpoint (like POST /api/send-email) that receives email data, validates it, and passes it to the Resend SDK. The SDK handles the SMTP details and returns a response you can send back to the client.
The developer experience is frictionless: Resend's SDK is lightweight (~50kb), works with any Node.js runtime (including serverless), and integrates with React Email if you want component-based email templates. You store your Resend API key in environment variables and call `resend.emails.send()` with your email config. Error handling is straightforward since Resend returns typed responses you can catch and log.
For architecture, consider whether you want emails sent synchronously (blocking the response) or queued asynchronously (via Bull, BullMQ, or similar). Most production setups queue email jobs to avoid timeout issues. Express pairs well with background job processors for this pattern.
Best Use Cases
Quick Setup
npm install express resendimport express from 'express';
import { Resend } from 'resend';
const app = express();
const resend = new Resend(process.env.RESEND_API_KEY);
app.use(express.json());
app.post('/api/send-email', async (req, res) => {
const { to, subject, html } = req.body;
try {
const data = await resend.emails.send({
from: 'onboarding@resend.dev',
to,
subject,
html,
});
res.json({ success: true, id: data.id });
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.listen(3000, () => console.log('Server running on port 3000'));Known Issues & Gotchas
Synchronous email sending blocks the response—slow Resend API calls delay HTTP responses
Fix: Queue emails asynchronously using Bull/BullMQ or similar. Respond to the client immediately and send emails in a background worker.
Resend has rate limits (300 emails/day on free tier, per-second limits on paid). No built-in Express middleware to enforce this
Fix: Implement rate limiting middleware (express-rate-limit) and track quota in your database or use Resend's webhook events to monitor deliverability.
React Email components run server-side, requiring Node.js 16+. Some older Express setups may not support this
Fix: Use Resend's HTML templates or render React Email separately if you're on older Node.js versions.
API key exposed in middleware if not properly isolated to environment variables
Fix: Always load Resend API key from process.env.RESEND_API_KEY and never commit .env files to version control.
Alternatives
- •Nodemailer + Express: More control over SMTP providers, steeper learning curve, requires managing SMTP credentials
- •SendGrid + Express: Enterprise-grade email service with higher rate limits, more expensive than Resend for low volume
- •AWS SES + Express: Cost-effective at scale, requires AWS account setup and IAM permissions, more complex configuration
Resources
Related Compatibility Guides
Explore more compatibility guides