Skip to main content
Resend is the email service provider used in PC Fix for sending transactional emails including order confirmations, status updates, password resets, and customer notifications.

Overview

PC Fix uses Resend to send:
  • Order Updates: Status changes, shipping notifications
  • Customer Support: Contact confirmations, inquiry replies
  • Authentication: Welcome emails, password resets
  • Marketing: Abandoned cart reminders, stock alerts, price drops

Configuration

1

Create a Resend Account

Sign up for an account at resend.com. The free tier includes 100 emails per day.
2

Generate an API Key

Go to API Keys in your Resend dashboard and create a new API key with send permissions.
3

Verify Your Domain (Optional)

For production use, verify your sending domain in Resend to improve deliverability and remove “via resend.com” from emails.
4

Set Environment Variables

Add these variables to your .env file in the packages/api directory:
Keep your RESEND_API_KEY secret. Never expose it in client-side code or commit it to version control.

Email Service Implementation

The EmailService class is located at packages/api/src/shared/services/EmailService.ts:

Available Email Templates

The EmailService provides pre-built templates for common scenarios:

Order & Payment Emails

Authentication Emails

Customer Support

Marketing Emails

Email Template Structure

All email templates follow a consistent HTML structure:
Email templates use inline CSS for maximum compatibility across email clients.

Usage Example

Here’s how to use the email service in your controllers:
sales.controller.ts

Order Status Messages

The sendStatusUpdate method automatically generates appropriate messages for each status:

Environment Variables

string
required
Your Resend API key from the dashboard
string
default:"PCFIX <noreply@pcfixbaru.com.ar>"
The sender email address and name
string
default:"pcfixbaru@gmail.com"
Reply-to email address for customer responses
string
Admin email for receiving notifications about new inquiries and receipts
string
default:"http://localhost:4321"
Frontend URL for generating links in emails

Testing Emails

Resend provides a test mode for development:

Deliverability Tips

Add SPF, DKIM, and DMARC records to your domain to improve deliverability and remove “via resend.com” from emails.
Use a recognizable sender name like “PCFIX” rather than just an email address.
Check your Resend dashboard regularly for bounced emails and remove invalid addresses.

Error Handling

The email service includes error handling:
Always check the return value when sending critical emails:

Rate Limits

  • Free Tier: 100 emails per day
  • Paid Plans: Higher limits based on plan
Implement rate limiting or queueing for high-volume scenarios to avoid hitting API limits.