Send emails
with TanStack Start

Built for TanStack Start

Resend drops straight into any TanStack Start app. Send emails from a server function with the Node SDK, keeping your API key on the server and safely away from the browser.

import { createServerFn } from '@tanstack/react-start';
import { Resend } from 'resend';
import { EmailTemplate } from '../components/email-template';
const resend = new Resend(process.env.RESEND_API_KEY);
export const sendEmail = createServerFn({ method: 'POST' }).handler(
async () => {
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'Hello world',
react: EmailTemplate({ firstName: 'John' }),
});
if (error) {
throw error;
}
return data;
},
);
import { createFileRoute } from '@tanstack/react-router';
import { Resend } from 'resend';
import { EmailTemplate } from '../../components/email-template';
const resend = new Resend(process.env.RESEND_API_KEY);
export const Route = createFileRoute('/api/send')({
server: {
handlers: {
POST: async () => {
const { data, error } = await resend.emails.send({
from: 'Acme <onboarding@resend.dev>',
to: ['delivered@resend.dev'],
subject: 'Hello world',
react: EmailTemplate({ firstName: 'John' }),
});
if (error) {
return Response.json({ error }, { status: 500 });
}
return Response.json(data);
},
},
},
});

Send from a server route

Prefer a dedicated API endpoint? Define a server route with TanStack Router, handle the request on the server, and return a JSON response your client can consume.

Compose emails with React

Build your emails as React components and pass them straight to Resend with the react option. Reuse the same components you already know across your entire TanStack Start app.

import * as React from 'react';
interface EmailTemplateProps {
firstName: string;
}
export function EmailTemplate({ firstName }: EmailTemplateProps) {
return (
<div>
<h1>Welcome, {firstName}!</h1>
</div>
);
}

All you need to get started

Resources to help you integrate email into your application quickly.

TanStack Start Quickstart

Follow the step-by-step guide and learn how to send your first email using TanStack Start.

TanStack Start example

Clone the example repository to get started quickly with Resend using TanStack Start.

API reference

Understand the REST API endpoints and each of the parameters that can be used.

  • "Our team loves Resend. It makes email sending so easy and reliable. After we switched to Dedicated IPs, our deliverability improved tremendously and we don't hear complaints about emails landing on spam anymore."
    Vlad MatsiiakoCo-founder of Infisical
  • "As a developer I love the approach that the Resend team is taking. Its so refreshing. They are also extremely user-centric and helpful in terms of getting you up and running, sending beautiful emails that deliver."
    Hahnbee LeeCo-Founder at Mintlify
  • "We value tools that feel stable, well thought out, and aligned with the standards we expect across our stack. Resend meets those expectations. It lets our team stay focused on building the larger platform rather than getting pulled into the overhead that typically comes with legacy email infrastructure."
    Bradley GreenwoodVP of Engineering at MrBeast
  • "Our partnership with Resend has been a great experience. They've made sure we can focus on what we do best—building our product and growing our business."
    Sahil LavingiaCEO of Gumroad
  • "Switching over to Resend from SendGrid marked a significant improvement in our email management. We started with a small test - waitlist emails for our iOS and Windows apps. Within 30 minutes, we were done."
    Thomas MannFounder & CEO of Raycast
  • "The simplicity and reliability of Resend allowed our engineers to focus on building features rather than troubleshooting email infrastructure."
    Amadeo PellicceConnectors, Agents and Automations Lead at Replit
  • "We're a small team with a lot on our plates. Email infrastructure is something we don't want to think about, and with Resend we don't have to."
    Peter SuhmOps at Tailwind
  • "The best part about taking Resend into production was that there was no friction at all."
    Tara NagarSoftware Engineer at Braintrust
  • "The flexibility of Resend is what we value most. It allows us to quickly adapt and refine our email communications as our products evolve."
    Glauber CostaFounder and CEO at Turso
  • "Resend is email with simpler APIs, better webhooks, and best-in-class debugging."
    Dan FarrellyCTO and Co-Founder of Inngest
  • "Our team loves Resend. It makes email sending so easy and reliable. After we switched to Dedicated IPs, our deliverability improved tremendously and we don't hear complaints about emails landing on spam anymore."
    Vlad MatsiiakoCo-founder of Infisical
  • "As a developer I love the approach that the Resend team is taking. Its so refreshing. They are also extremely user-centric and helpful in terms of getting you up and running, sending beautiful emails that deliver."
    Hahnbee LeeCo-Founder at Mintlify
  • "We value tools that feel stable, well thought out, and aligned with the standards we expect across our stack. Resend meets those expectations. It lets our team stay focused on building the larger platform rather than getting pulled into the overhead that typically comes with legacy email infrastructure."
    Bradley GreenwoodVP of Engineering at MrBeast
  • "Our partnership with Resend has been a great experience. They've made sure we can focus on what we do best—building our product and growing our business."
    Sahil LavingiaCEO of Gumroad
  • "Switching over to Resend from SendGrid marked a significant improvement in our email management. We started with a small test - waitlist emails for our iOS and Windows apps. Within 30 minutes, we were done."
    Thomas MannFounder & CEO of Raycast
  • "The simplicity and reliability of Resend allowed our engineers to focus on building features rather than troubleshooting email infrastructure."
    Amadeo PellicceConnectors, Agents and Automations Lead at Replit
  • "We're a small team with a lot on our plates. Email infrastructure is something we don't want to think about, and with Resend we don't have to."
    Peter SuhmOps at Tailwind
  • "The best part about taking Resend into production was that there was no friction at all."
    Tara NagarSoftware Engineer at Braintrust
  • "The flexibility of Resend is what we value most. It allows us to quickly adapt and refine our email communications as our products evolve."
    Glauber CostaFounder and CEO at Turso
  • "Resend is email with simpler APIs, better webhooks, and best-in-class debugging."
    Dan FarrellyCTO and Co-Founder of Inngest
  • "Our team loves Resend. It makes email sending so easy and reliable. After we switched to Dedicated IPs, our deliverability improved tremendously and we don't hear complaints about emails landing on spam anymore."
    Vlad MatsiiakoCo-founder of Infisical
  • "As a developer I love the approach that the Resend team is taking. Its so refreshing. They are also extremely user-centric and helpful in terms of getting you up and running, sending beautiful emails that deliver."
    Hahnbee LeeCo-Founder at Mintlify
  • "We value tools that feel stable, well thought out, and aligned with the standards we expect across our stack. Resend meets those expectations. It lets our team stay focused on building the larger platform rather than getting pulled into the overhead that typically comes with legacy email infrastructure."
    Bradley GreenwoodVP of Engineering at MrBeast
  • "Our partnership with Resend has been a great experience. They've made sure we can focus on what we do best—building our product and growing our business."
    Sahil LavingiaCEO of Gumroad
  • "Switching over to Resend from SendGrid marked a significant improvement in our email management. We started with a small test - waitlist emails for our iOS and Windows apps. Within 30 minutes, we were done."
    Thomas MannFounder & CEO of Raycast
  • "The simplicity and reliability of Resend allowed our engineers to focus on building features rather than troubleshooting email infrastructure."
    Amadeo PellicceConnectors, Agents and Automations Lead at Replit
  • "We're a small team with a lot on our plates. Email infrastructure is something we don't want to think about, and with Resend we don't have to."
    Peter SuhmOps at Tailwind
  • "The best part about taking Resend into production was that there was no friction at all."
    Tara NagarSoftware Engineer at Braintrust
  • "The flexibility of Resend is what we value most. It allows us to quickly adapt and refine our email communications as our products evolve."
    Glauber CostaFounder and CEO at Turso
  • "Resend is email with simpler APIs, better webhooks, and best-in-class debugging."
    Dan FarrellyCTO and Co-Founder of Inngest

Start sending in minutes

Resend delivers mission-critical emails for some
of the fastest growing teams.

Sign up for free