
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
@voiceflow/nestjs-rate-limit
Advanced tools
HTTP request rate limiting for NestJS.
yarn add @voiceflow/nestjs-rate-limit
This package also requires you to have @voiceflow/nestjs-redis installed since RateLimitModule uses RedisModule as a dependency.
The redis module can be setup in a couple different ways using forRootAsync:
RateLimitOptions object can be provided via useValue.useFactory function can be provided to return a RateLimitOptions object (or a promise for one!).RateLimitOptions can be provided using useClass.import { RateLimitModule, RateLimitService, RateLimitOptions } from '@voiceflow/nestjs-rate-limit';
@Module({
imports: [
RateLimitModule.forRootAsync({
imports: [],
// Union field, one of `useValue`, `useFactory`, or `useClass`:
useValue: {
serviceName: 'my-service',
points: 5,
duration: 60,
},
useFactory: () => getRateLimitConfig(),
useClass: RateLimitConfigService,
}),
],
})
export class AppModule {}
If you have an existing rate limit options object that you'd like to reuse, you can provide that in forRoot.
const rateLimitOptions = { ... };
@Module({
imports: [
RateLimitModule.forRoot(rateLimitOptions),
],
})
export class AppModule {}
Once the RateLimitModule is globally registered, RateLimitService can be injected in other providers without having to import RateLimitModule again.
RateLimitGuardBy default no routes will be rate limited.
To apply rate limiting to a route or controller use RateLimitGuard:
import { Controller, UseGuards } from '@nestjs/common';
import { RateLimitGuard } from '@voiceflow/nestjs-rate-limit';
@Controller()
@UseGuards(RateLimitGuard)
export class MyController {
/* ... */
}
The default token extractor will extract the user's token from the request headers or cookies.
For using cookies you must install cookie-parser and configure it per the NestJS documentation.
FAQs
HTTP request rate-limiting for NestJS.
The npm package @voiceflow/nestjs-rate-limit receives a total of 0 weekly downloads. As such, @voiceflow/nestjs-rate-limit popularity was classified as not popular.
We found that @voiceflow/nestjs-rate-limit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 27 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.