React Email
The packages/email workspace provides a React Email development environment for previewing and iterating on email templates.
The packages/email workspace provides a React Email
preview environment for the backend's email templates. It does not hold its
own copy of the templates — each file under emails/ imports the real backend
component and supplies sample props.
Running the Preview Server
bun --cwd packages/email devThis starts the React Email preview server at http://localhost:3003. You can
view and interact with every email in the browser, with live reload as you edit
the backend templates.
Directory Structure
packages/email/
├── emails/ # One preview wrapper per backend template
│ ├── magic-link.tsx # imports backend MagicLinkEmail + sample props
│ ├── email-verification.tsx
│ ├── password-reset.tsx
│ ├── organization-invitation.tsx
│ ├── sensitive-action-verification.tsx
│ ├── subscription-success.tsx
│ └── subscription-error.tsx
├── package.json
└── tsconfig.jsonSingle Source of Templates
| Location | Purpose | Used at runtime |
|---|---|---|
packages/backend/convex/email/templates/ | The templates (single source) | Yes |
packages/email/emails/ | Preview wrappers (sample props only) | No |
There is one copy of each template, in the backend. The preview wrappers import
those components, so what you see at :3003 is exactly what ships. To change an
email's markup, edit the backend template; to change the preview's sample data,
edit the wrapper.
Dependencies
The preview workspace uses:
@react-email/components— email-safe HTML components (Button, Container, Text, etc.)@react-email/tailwind— Tailwind CSS support within emailsreact-email— the dev server and CLI
Available Components
React Email provides email-safe versions of common elements:
| Component | Purpose |
|---|---|
Html, Head, Body | Document structure |
Container | Centered content wrapper |
Text | Paragraphs with email-safe styling |
Button | CTA buttons with inline styles |
Link | Hyperlinks |
Img | Images |
Heading | Headings (h1–h6) |
Hr | Horizontal rules |
Section | Semantic sections |
Preview | Email client preview text |
Tailwind | Tailwind CSS wrapper |
Building
bun --cwd packages/email buildBuilds the email templates for production. This is mainly useful for CI validation.
Next Reads
- Customizing Email Templates — how to create and modify templates.
- Resend — the email delivery service.
Email Overview
Leave Localhost includes a complete transactional email system built on Resend and React Email. Templates live in one place in the backend; the preview workspace renders those same templates in the browser.
Resend
Leave Localhost uses Resend for transactional email delivery, integrated via the @convex-dev/resend Convex component.