https://github.com/pragmaticivan/nest-resend
Injectable Resend client for your nestjs projects
https://github.com/pragmaticivan/nest-resend
resend resend-email
Last synced: about 1 month ago
JSON representation
Injectable Resend client for your nestjs projects
- Host: GitHub
- URL: https://github.com/pragmaticivan/nest-resend
- Owner: pragmaticivan
- License: apache-2.0
- Created: 2023-10-20T03:24:37.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-27T15:08:07.000Z (about 1 month ago)
- Last Synced: 2025-04-27T16:20:52.057Z (about 1 month ago)
- Topics: resend, resend-email
- Language: TypeScript
- Homepage:
- Size: 888 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README

## 🐕 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: '[email protected]',
to: '[email protected]',
subject: 'Howdy!',
html: 'YAY!',
});
}
}
```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).