# nest-resend

> NestJS Resend Library

Latest version **3.1.0** (published 2025-02-01) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install nest-resend
pnpm add nest-resend
yarn add nest-resend
bun add nest-resend
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.1.0 |
| Published | 2025-02-01 |
| First published | 2023-10-20 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 31.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 5 |
| Author | pragmaticivan@gmail.com |
| Maintainers | pragmaticivan |
| Keywords | nestjs, resend |

## Links

- npm: https://www.npmjs.com/package/nest-resend
- Repository: https://github.com/pragmaticivan/nest-resend
- Homepage: https://github.com/pragmaticivan/nest-resend#readme
- Issues: https://github.com/pragmaticivan/nest-resend/issues
- npm.io page: https://npm.io/package/nest-resend

## Recent versions

- 3.1.0 (latest) — 2025-02-01
- 3.0.0 — 2024-07-05
- 2.0.0 — 2023-11-26
- 1.0.0 — 2023-10-21
- 0.0.1 — 2023-10-20

## README

![nest-resend](https://github.com/pragmaticivan/nest-resend/assets/301291/3018c210-3e74-41cd-93a2-891e313c7dbe)

## 🐕 About

`nest-resend` implements a module, `ResendModule`, which when imported into
your nestjs project provides a Resend client to any class that injects it. This
lets Resend be worked into your dependency injection workflow without having to
do any extra work outside of the initial setup.

## 🤖 Installation

```bash
npm install --save nest-resend
```

## 🎇 Getting Started

The simplest way to use `nest-resend` is to use `ResendModule.forRoot`

```typescript
import { Module } from '@nestjs-common';
import { ResendModule } from 'nest-resend';

@Module({
  imports: [
    ResendModule.forRoot({
      apiKey: 're_secret_key'
    }),
  ],
})
export class AppModule {}
```

You can then inject the Resend client into any of your injectables by using a
custom decorator

```typescript
import { Injectable } from '@nestjs/common';
import { InjectResend } from 'nest-resend';
import { Resend } from 'resend';

@Injectable()
export class AppService {
  public constructor(@InjectResend() private readonly resendClient: Resend) {}

  sendEmail() {
    return this.resendClient.emails.send({
      from: 'you@nestjs.com',
      to: 'user@nestjs.com',
      subject: 'Howdy!',
      html: '<strong>YAY!</strong>',
    });
  }
}
```

Asynchronous setup is also supported

```typescript
import { Module } from '@nestjs-common';
import { ResendModule } from 'nest-resend';

@Module({
  imports: [
    ResendModule.forRootAsync({
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => ({
        apiKey: configService.get('resend_key')
      }),
    }),
  ],
})
export class AppModule {}
```

## 🥷 Contributing

I would greatly appreciate any contributions to make this project better. Please
make sure to follow the below guidelines before getting your hands dirty.

1. Fork the repository
2. Create your branch (`git checkout -b my-branch`)
3. Commit any changes to your branch
4. Push your changes to your remote branch
5. Open a pull request


## 👏 Acknowledgements

- [nestjs](https://nestjs.com)
- [nestjs-otel](https://github.com/pragmaticivan/nestjs-otel)
- [nestjs-stripe](https://github.com/dhaspden/nestjs-stripe)

## 📝 License

The code is available under the [Apache 2 license](https://github.com/pragmaticivan/nestjs-resend/blob/main/LICENSE).

---
_Source: https://npm.io/package/nest-resend · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
