Hype StackHypeStack

Mailing

Transactional email uses Resend and React Email templates that live next to the feature that sends them. The free template wires the Resend client; packs add the templates and call sites.

Client

ts
// apps/backend/src/libs/email/resend.ts
import { Resend } from "resend";

export const resend = new Resend(process.env.RESEND_API_KEY);

The From address is built from RESEND_FROM_DOMAIN (see app constants). Without RESEND_API_KEY, optional send paths (billing receipts, some notification channels) skip email instead of failing the request. Auth and invitation flows that require email will not work until the key is set.

Environment variables

VariablePurpose
RESEND_API_KEYResend API key
RESEND_FROM_DOMAINDomain used for the From address

Template locations

Templates are React Email components colocated under feature modules, for example:

EmailTypical path
Password reset / changedfeatures/auth/modules/*/emails/*.tsx
Organization invitationfeatures/organizations/modules/send-organization-invitation/emails/
Billing receiptfeatures/billing/modules/send-receipt/emails/receipt.tsx
Admin notificationfeatures/notifications/.../emails/admin-notification.tsx

Send sites call resend.emails.send({ from, to, subject, react }) (or HTML) directly from the module. There is no separate email microservice.

Trigger points

FlowWhen it sends
AuthPassword reset, email verification (starter-dependent)
OrganizationsInvitation email on send / resend
BillingReceipt after successful payment when Resend is configured
NotificationsOptional email channel when admins target specific users

Frontend links inside emails should use the frontendUrl() helper so paths and query params stay typed against FRONTEND_URL.

Adding a template

  1. Create a React Email component next to the module that will send it
  2. Call resend.emails.send from that module with the component as react
  3. Keep provider-specific HTTP details in libs/email
  4. Document any new env needs in .env.example
Sponsor open source

Every purchase and sponsorship funds my 8+ years of work on open source given freely to the community. It keeps the lights on, funds new packs, and keeps the ecosystem alive. Even a small tier means a lot. Thank you!

Sponsor on GitHub