Better-Notify for NestJS
Use Better-Notify as a NestJS service. Inject the typed client into controllers, services, or guards — notification routes stay type-safe across your entire dependency tree.
Why it fits
- Works as an injectable service
- Type-safe across the DI container
- Use with NestJS guards and interceptors
- Pairs with NestJS Bull queues for async delivery
Example
notifications.service.ts
import { Injectable } from '@nestjs/common';
import { mail } from './notifications.client';
@Injectable()
export class NotificationsService {
async sendWelcome(email: string, name: string) {
return mail.welcome.send({
to: email,
input: { name },
});
}
}