Docs
Quickstart: Next.js
A route handler, a server action, and nothing exposed to the client — the key stays server-side, and the sandbox keeps development safe.
Facts verified 2026-07-17 — corrections: hello@emailfast.dev
1. Install & configure
npm install @email-fast/nodejs# .env.local
EMAILFAST_API_KEY=ef_sandbox_... # swap to ef_live_… at launch2. A route handler
// app/api/welcome/route.ts
import { EmailFast } from "@email-fast/nodejs";
import { NextResponse } from "next/server";
const ef = new EmailFast({ apiKey: process.env.EMAILFAST_API_KEY!, baseUrl: "https://api.emailfast.dev" });
export async function POST(req: Request) {
const { email, name } = await req.json();
const { id } = await ef.send({
to: email,
subject: "Welcome!",
html: "<h1>Hi {{name}}</h1>",
data: { name },
idempotency_key: `welcome-${email}`, // a double-submit can't double-send
});
return NextResponse.json({ id });
}3. Or a server action
// app/actions.ts
"use server";
import { EmailFast } from "@email-fast/nodejs";
const ef = new EmailFast({ apiKey: process.env.EMAILFAST_API_KEY!, baseUrl: "https://api.emailfast.dev" });
export async function sendWelcome(formData: FormData) {
await ef.send({
to: String(formData.get("email")),
subject: "Welcome!",
html: "<p>You're in.</p>",
});
}Frontend-only instead?
If you have no server at all (static export, marketing page), don't ship a secret to the browser — use the browser SDK with a public key: a browser SDK with EmailJS-compatible endpoints — the recipient always comes from the server-stored template, never from the request, so a public key in your frontend can't be abused to spam arbitrary addresses.