Resend
Nuxtbe uses Resend for sending transactional emails in two key areas:
- Server Routes: For payment-related transactional emails in:
- LemonSqueezy webhook (
/api/webhook/lemonsqueezy
) - Stripe webhook (
/api/webhook/stripe
)
- LemonSqueezy webhook (
- Supabase Edge Functions: For authentication-related emails:
- Welcome emails
- Password reset
- Email verification
- Magic link authentication
This guide will help you set up and configure Resend for both use cases.
You'll need to configure the Resend API key in both your Nuxt environment and Supabase Edge Functions secrets.
You may ommit configuring you own provider for testing, in that case you'll have to comment all the places where you use emailServerClient
in your code and to not configure custom SMTP in Supabase.
Setup
Create Resend Account
- Sign up for a Resend account.
- Complete your account verification.
Generate API Key
- Navigate to the API Keys section in your Resend Dashboard.
- Click "Create API Key".
- Give your key a descriptive name (e.g., "Nuxtbe Production").
- Copy the generated API key.
- Store it in your
.env
file:
Never commit your Resend API key to version control or share it publicly.
Add Sending Domain
- Go to the Domains section in your Resend Dashboard.
- Click "Add Domain".
- Follow the DNS verification steps.
- Wait for domain verification (usually takes a few minutes).
Configure Contact Email
Update your app.config.ts
with your contact email:
Configure API Keys
- Navigate to the API Keys section in your Resend Dashboard.
- Create two API keys:
- One for your Nuxt application
- One for Supabase Edge Functions
- Store the Nuxt API key in your
.env
:
- Add the Supabase Edge Functions API key to your Edge Function Secrets:
Never commit your Resend API keys to version control or share them publicly.
Usage
Send Email
Nuxtbe ships emailServerClient
utility to configure the email client in your server routes and send emails from there.
Add Contact to Audience
Email Templates
Nuxtbe includes pre-built email templates powered by React Email for:
- Welcome emails
- Password reset
- Email verification
- One-time login link
These templates are used within Supabase Edge Functions to send transactional emails. They are located in the supabase/functions/send-email-mail-hook/_templates
directory and can be customized using React Email components to match your branding. React Mail has been chosen because of smaller bundle size and better performance. In future, it can be replaced by Vue Mail.
Testing Emails
- Use the Resend Dashboard to monitor sent emails.
- Check the delivery status and open rates.
- View rendered email content and debug issues.
Best Practices
- Always verify your sending domain
- Implement proper error handling:
- Monitor email deliverability in the Resend dashboard
- Keep email templates mobile-responsive
- Follow anti-spam guidelines