NestJS

Inject Resent into NestJS services and controllers.

Inject Resent into NestJS services and controllers.

Install

npm i resent.one

Set RESENT_API_KEY in your server environment. Keep the key off the client.

Send an email

// email.service.ts
import { Injectable } from "@nestjs/common";
import { Resent } from "resent.one";
@Injectable()
export class EmailService {
private resent = new Resent(process.env.RESENT_API_KEY);
sendWelcome(to: string) {
return this.resent.emails.send({
from: "Acme <noreply@yourdomain.com>",
to,
subject: "Hello from NestJS",
html: "<strong>It works!</strong>",
});
}
}

Next steps