React (Vite)

Call Resent from your Vite + React backend or BFF — never expose the API key in the browser.

Call Resent from your Vite + React backend or BFF — never expose the API key in the browser.

Install

$npm i resent.one

Set RESENT_API_KEY in your server environment. Keep the key off the client.

Send an email

1// server/send.ts (Vite backend / BFF — never call from the browser)
2import { Resent } from "resent.one";
3
4export async function sendWelcome(to: string) {
5 const resent = new Resent(process.env.RESENT_API_KEY);
6 return resent.emails.send({
7 from: "Acme <noreply@yourdomain.com>",
8 to,
9 subject: "Hello from React",
10 html: "<strong>It works!</strong>",
11 });
12}

Next steps