Sendery
Sendery

Framework Integrations

Nuxt integration

Send transactional email from your Nuxt server with the Sendery JavaScript SDK.

Install
npm install @sendery/sdk
Source code

Requirements

Use the JavaScript SDK in a Node.js 22.12+ server runtime. Publish a welcome template with name and action_url, and create a project API key.

Configure a private key

Add senderyApiKey to runtimeConfig, outside runtimeConfig.public.

nuxt.config.ts
// nuxt.config.ts
export default defineNuxtConfig({
  runtimeConfig: { senderyApiKey: '' },
});

Set the environment variable

Set NUXT_SENDERY_API_KEY in your server environment. Nuxt maps it to runtimeConfig.senderyApiKey.

Environment
NUXT_SENDERY_API_KEY=your_project_api_key

Send from the server

Call await sendWelcome(event, user, eventKey) from your authenticated server handler. Read the recipient, name, and URL from trusted application data. Preserve those values and the event key when retrying.

TypeScript
// server/utils/sendWelcome.ts
import { Sendery } from '@sendery/sdk';
import type { H3Event } from 'h3';

type Welcome = { email: string; name: string; actionUrl: string };

export async function sendWelcome(event: H3Event, user: Welcome, eventKey: string) {
  const config = useRuntimeConfig(event);
  const sendery = new Sendery(config.senderyApiKey);
  return sendery.prepare({
    to: user.email,
    template: 'welcome',
    data: { name: user.name, action_url: user.actionUrl },
  }, eventKey).retry().send();
}