nestjs ratelimit

// app.module.ts
import { Module } from '@nestjs/common';
import { APP_GUARD } from '@nestjs/core';
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';

@Module({
  imports: [
    ThrottlerModule.forRoot({
   	  ttl: 60, // Time to live, in seconds
      limit: 10, // Requests within the TTL
    }) 
  ],
  providers: [
    {
      provide: APP_GUARD,
      useClass: ThrottlerGuard,
    } // To guard globally
  ]
})
export class AppModule {}
Embarrassed Earthworm