Resend

Resend integration for Better Auth.

Installation

Simple Resend configuration.

code-editor
pnpm dlx shadcn@latest add @auth-cn/resend

Example

Simple welcome email on user creation.

code-editor

lib/auth.ts

import { betterAuth } from "better-auth";
// Your email template...
import { WelcomeEmail } from "@/emails/vercel-welcome";
// Checked https://auth.uprizing.me/docs/3rd-party/resend
import { sendEmail } from "@/lib/resend";

export const auth = betterAuth({
  // Your auth configuration...
  databaseHooks: {
    user: {
      create: {
        after: async (user) => {
          sendEmail({
            from: "Acme <onboarding@resend.dev>",
            to: user.email,
            subject: "Welcome to Our Service!",
            // Provide user name and email.
            react: WelcomeEmail({ name: user.name, email: user.email }),
          });
        },
      },
    },
  },
});

Check the Email section to see multiple uses.