How to integrate email templates with React Email
React Email lets you write templates as React components and compile them to email-safe HTML. EmailTemplate adds git-style versioning, rendering through an API and export to Klaviyo, Mailchimp and Resend. This guide covers the full flow: authoring the component, rendering with @react-email/render, storing and versioning it in the API, and sending with your provider.
How do you integrate React Email with EmailTemplate step by step?
-
Install React Email
React Email lives in your project as a dev dependency. You do not need an EmailTemplate SDK: the API is plain REST and is called with fetch.
bashnpm install @react-email/components @react-email/render -
Create the email component
Write the template with React Email primitives. EmailTemplate variables use double-brace syntax and are substituted at render time, not by React.
tsx// src/emails/OrderConfirmation.tsx import * as React from 'react' import { Html, Head, Body, Container, Heading, Text, Button } from '@react-email/components' export function OrderConfirmation(props: { userName: string; orderId: string; orderTotal: string }) { return ( <Html> <Head /> <Body style={{ backgroundColor: '#ffffff', fontFamily: 'system-ui, sans-serif' }}> <Container style={{ margin: '0 auto', padding: '40px 20px', maxWidth: '600px' }}> <Heading style={{ color: '#18181b', fontSize: '24px' }}> Hi {props.userName} </Heading> <Text style={{ color: '#52525b', fontSize: '16px', lineHeight: '24px' }}> Your order {props.orderId} ({props.orderTotal}) is on its way. </Text> <Button href="https://dash.emailtemplate.theboomer.dev" style={{ backgroundColor: '#2563eb', color: '#ffffff', padding: '12px 24px', borderRadius: '6px' }}> View order </Button> </Container> </Body> </Html> ) } -
Render the component to HTML
@react-email/render compiles the component to static HTML. That HTML is what you store in EmailTemplate and what the API renders.
tsimport { render } from '@react-email/render' import { OrderConfirmation } from './emails/OrderConfirmation' const html = render( OrderConfirmation({ userName: 'Ana', orderId: 'A-1024', orderTotal: '89.00 EUR' }) ) // html is a string ready for POST /api/v1/templates or for your ESP -
Store and version the template in the API
Create the template with the rendered HTML. Each later save creates an immutable version with history, diff and rollback.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "name": "Order confirmation", "subject": "Your order {{ order.id }} is on its way", "blocks": [], "html": "<!DOCTYPE html><html><body><h1>Hi {{ user.name }}</h1><p>Order {{ order.id }}</p></body></html>" }' -
Render with variables from the API
In production you do not render locally: you call the render endpoint with real data and the API returns the substituted HTML, text and subject.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates/64f8a1b2c3d4e5f6a7b8c9d1/render \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "variables": { "user.name": "Ana", "order.id": "A-1024" } }' -
Send with your provider
EmailTemplate does not send email. Use the HTML returned by the render endpoint with Klaviyo, Mailchimp or Resend. The resend export adapter even produces ready-to-paste React Email JSX.
bashcurl -s -X POST https://api.emailtemplate.theboomer.dev/api/v1/templates/64f8a1b2c3d4e5f6a7b8c9d1/export \ -H "Content-Type: application/json" \ -H "x-api-key: $EMAIL_TEMPLATE_API_KEY" \ -d '{ "format": "resend" }'
| Item | Free | Pro | Team | Enterprise |
|---|---|---|---|---|
| Monthly price (EUR, VAT excluded) | €0 | €19 | €59 | €149 |
| Renders per month | 500 | 25,000 | 100,000 | 500,000 |
| Concurrent templates | 3 | 25 | Unlimited | Unlimited |
| Users | 1 | 2 | 10 | 25 |
| AI credits per month | 50 | 500 | 2,000 | 10,000 |
| AI operation cost | generate: 10 credits · suggest: 5 credits. Charged to the credit wallet (they do not consume renders) and the same on every plan. Packs: 500 credits / €9, 2,000 / €29, 5,000 / €69, 10,000 / €119. | |||
| Stack provider export | format=resend returns the React Email component as JSX (text/javascript). The same HTML also exports with format=klaviyo (Liquid HTML) and format=mailchimp (JSON). | |||
Subscription prices in USD/month; credit packs are charged in EUR. Product-published data, not estimates.
Frequently asked questions
Does EmailTemplate send my emails?
No. EmailTemplate creates, versions and renders the final HTML. You send it with Klaviyo, Mailchimp, Resend or any other provider that accepts HTML.
Can I keep designing with React Email locally?
Yes. The visual editor generates React Email-compatible HTML and the resend export adapter returns a JSX component you can copy into your repository.
How do I declare the variables of a React template?
Use the {{ name }} syntax in the HTML stored in the API. At render time you pass a variables object; the API also returns usedVariables with what it detected.