Tool-pair integration pattern
Resend + Next.js integration
Resend + Next.js is the modern indie SaaS transactional-email stack. Resend provides the API and deliverability; Next.js Server Actions or Route Handlers call the API; React Email templates render JSX into HTML emails. Three-line setup once the domain is verified.
Verified · editorial policy
Resend owns (teardown →)
Email delivery infrastructure, deliverability reputation (per-domain), templates-as-React storage, suppressions, bounce + complaint handling, send history.
Next.js owns
Trigger logic (when to send), template composition (React Email components), recipient address (from user data), tracking event side effects (logging to database).
Integration shape
Server-side API call. Next.js server code (Route Handler, Server Action, or webhook handler) calls Resend's SDK with a React Email template + recipient. Resend handles the rest.
Implementation steps
Step 1
Verify your sending domain in Resend
DNS records: SPF, DKIM, DMARC. Verification typically completes in 5-30 minutes after DNS propagation. Send only from verified domains.
Gotcha: Sending from unverified domains lands in spam reliably. The verification step is not optional.
Step 2
Install React Email and set up the templates folder
npm install @react-email/components. Create app/emails/ folder for templates. Each template is a JSX component exporting a function that returns an email body.
Gotcha: Email HTML is its own world — most CSS does not work. React Email components handle the table-based layout and inline styles that survive Gmail/Outlook/Apple Mail.
Step 3
Wire Resend SDK into Server Actions or Route Handlers
Import { Resend } from 'resend'. Initialize with API key from env. Call resend.emails.send({ from, to, subject, react: <Template /> }) from server-side code.
Gotcha: Calling resend.emails.send from client components leaks the API key. Resend calls must be server-side only — Server Actions, Route Handlers, or middleware.
Step 4
Handle send failures gracefully
Resend returns success/error responses. Log failures to your observability system; do not silently swallow. For critical emails (receipts, password resets), retry on transient failures.
Gotcha: Not handling failures means customers occasionally do not receive their receipt or reset link. The support cost of debugging silent failures is higher than the cost of retry logic.
Step 5
Listen to webhooks for bounce + complaint events
Resend webhook events for email.bounced, email.complained, email.delivered. Route to your webhook handler; update the user's subscriptions/preferences to suppress future sends.
Gotcha: Continuing to send to bounced addresses degrades sender reputation. Suppress on first hard bounce.
Step 6
Separate transactional from marketing
Transactional sends (receipts, password resets) should not be in the same domain as marketing sends (newsletters, promos). Resend supports separate domains; use them.
Gotcha: A marketing campaign that hurts reputation should not prevent transactional emails from landing. Domain separation is the firewall.
Common gotchas across the whole integration
- Email previews in React Email's dev tool look different from Gmail rendering. Test in actual clients before production.
- Resend free tier (3,000/month) is enough for early indie SaaS; the pricing jumps make sense once you cross 10k/month.
- DKIM record rotates every 90 days on managed domains. Verify your DNS provider supports the rotation.
- Sending from a no-reply@ address loses replies that customers genuinely send. Use a monitored real address.
When NOT to build this integration
If your email volume is under 100/month or your needs are sequence-heavy (drip campaigns, broadcasts), tools like Loops, Customer.io, or Mailchimp work better than Resend + custom code. Resend shines for transactional + simple broadcasts.
Frequently asked
- Should I use Resend for marketing emails too?
- Resend handles broadcasts but is primarily transactional-focused. For sequence-heavy marketing (drip campaigns, segmentation), Loops or Customer.io has stronger tooling. Many indie SaaS use Resend for transactional + a separate tool for marketing.
- How do I avoid the spam folder on Gmail?
- SPF + DKIM + DMARC alignment, low complaint rate, consistent sending patterns. Resend's deliverability is good out of the box; most spam issues are content (subject line, link density) or list quality (cold list, low engagement).
Other tool-pair integrations
See the stack this integration belongs to
Integration patterns assume the right stack underneath. Use the stack recommendations to pick the right tools first, then the integration to wire them together.