Resend Integration
Resend is an email API designed specifically for developers that simplifies the process of sending, tracking, and managing transactional emails. It helps developers focus on building applications without delving into the complexities of email infrastructure.
In the Nexty boilerplate, we use Resend to implement these two features:
- Email subscription and notifications
- Payment failure email notifications
You can easily use the code from these two features to send emails using the Resend API in other logic.
Besides sending emails through the API, Resend also offers a Broadcast feature in the dashboard for sending marketing emails. If you registered for Nexty.dev's waitlist early, you definitely received the early bird discount email sent from Broadcast on April 29th.
Next, I'll introduce the integration process of Resend in the Nexty.dev boilerplate.
Registration and Basic Configuration
-
Visit Resend and register an account with your email
-
Go to the API Keys page and create an API Key


-
Add the API Key to your project's environment variable
RESEND_API_KEY
-
Next, open the Domains page and add your domain


- Add DNS records

The best practice for configuring the _dmarc
record is as follows:
- Initial Phase (Early Monitoring): Start with
v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; pct=100
and monitor the reports. This allows you to view your email sending situation and identify issues that might cause email failures without affecting email delivery. Analyze aggregate reports to understand which emails failed SPF and DKIM validation. - Intermediate Phase (Mid-term Quarantine): After you're confident about your email sending situation, change the policy to
v=DMARC1; p=quarantine; rua=mailto:[email protected]; ruf=mailto:[email protected]; pct=100
. This will quarantine emails that fail validation into the spam folder. - Final Phase (Final Rejection): Once you're completely certain your email sending configuration is correct, change the policy to
v=DMARC1; p=reject; rua=mailto:[email protected]; ruf=mailto:[email protected]; pct=100
. This will reject emails that fail validation. This is the most secure setting that provides maximum protection for your domain.
rua
and ruf
need to be replaced with your email address, which will receive email sending reports.
The main purpose of configuring _dmarc
is to prevent external attacks and stop attackers from impersonating your domain to send phishing emails, malware, or spam.
After all DNS records pass verification, the Status will show Verified
.

Good to know:
If the Status doesn't update for a long time, you can try clicking
Restart
.
- Now go to the Audiences page and copy the Audience ID to the environment variable
RESEND_AUDIENCE_ID

If you don't see the Audience ID
, first click on API
, then copy the audienceId
.


Verification
Now you can try submitting an email subscription in the page Footer and perform the following verification:
- Check the Emails page in the Resend dashboard to review email sending status
- Check the Audiences page in the Resend dashboard to review Audience additions
- Check the Logs page in the Resend dashboard to review email sending logs
- Check the submitted email address to see if you received the notification email sent by the API
In the Nexty.dev boilerplate, I've also built in a rate limiter implemented with Upstash Redis, and provided usage examples in the email subscription feature. In the next chapter, we'll complete the Upstash configuration to make the rate limiter effective.