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

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

Next steps