Registry /
devops / nest-throttler-storage-redis
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ThrottlerStorageRedisService
✓ import { ThrottlerStorageRedisService } from 'nest-throttler-storage-redis'
✗ const ThrottlerStorageRedisService = require('nest-throttler-storage-redis')
Package is ESM-only.
ThrottlerStorageRedisService (named import with destructuring)
✓ import { ThrottlerStorageRedisService } from 'nest-throttler-storage-redis'
✗ import ThrottlerStorageRedisService from 'nest-throttler-storage-redis'
Only named export is available, no default export.
ThrottlerStorageRedisService in CommonJS
✓ const { ThrottlerStorageRedisService } = require('nest-throttler-storage-redis')
✗ const ThrottlerStorageRedisService = require('nest-throttler-storage-redis')
CommonJS require must use destructuring; direct assignment to the require result will be undefined.
Type import for ThrottlerStorageRedisService
✓ import type { ThrottlerStorageRedisService } from 'nest-throttler-storage-redis'
✗ import { ThrottlerStorageRedisService } from 'nest-throttler-storage-redis'
When using only types, prefer type import to avoid bundling unused code.
Shows how to configure NestJS ThrottlerModule with Redis storage using async module registration and ConfigService.
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { APP_GUARD } from '@nestjs/core';
import { ThrottlerGuard, ThrottlerModule } from '@nestjs/throttler';
import { ThrottlerStorageRedisService } from 'nest-throttler-storage-redis';
@Module({
imports: [
ConfigModule.forRoot(),
ThrottlerModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: async (config: ConfigService) => ({
ttl: 60,
limit: 10,
storage: new ThrottlerStorageRedisService({
socket: {
host: config.get<string>('REDIS_HOST', 'localhost'),
port: config.get<number>('REDIS_PORT', 6379),
},
prefix: 'throttler',
}),
}),
}),
],
controllers: [],
providers: [
{
provide: APP_GUARD,
useClass: ThrottlerGuard,
},
],
})
export class AppModule {}
Errors
Common errors & fixes
Error: Cannot find module 'nest-throttler-storage-redis'
Package not installed
fixnpm install nest-throttler-storage-redis
TypeError: ThrottlerStorageRedisService is not a constructor
CommonJS require without destructuring (wrong import)
fixUse const { ThrottlerStorageRedisService } = require('nest-throttler-storage-redis') Error: The "path" argument must be of type string. Received undefined
Missing redis client or incorrect Redis connection options
fixEnsure redis package is installed and passed valid options (socket.host, socket.port)
Nest cannot find ThrottlerStorageRedisService (appears in providers but not exported)
Import path incorrect or package not exporting correctly
fixVerify import: import { ThrottlerStorageRedisService } from 'nest-throttler-storage-redis' Audit
Dependencies
redisrequiredPeer dependency for Redis client required at runtime
@nestjs/throttlerrequiredPeer dependency for ThrottlerModule and ThrottlerGuard