Skip to content

Reference

Complete API reference for NestJS RedisX core module and plugins.

Core Module

@nestjs-redisx/core is the foundation package that provides:

  • RedisModule — NestJS module for Redis integration
  • RedisService — High-level Redis operations wrapper
  • Driver Abstraction — Switch between ioredis and node-redis
  • Multi-Client Support — Manage multiple Redis connections
  • Connection Types — Single, Cluster, and Sentinel configurations
  • Health Monitoring — Automatic reconnection and health checks
  • Plugin System — Extensible architecture for plugins

Installation

bash
npm install @nestjs-redisx/core ioredis
bash
npm install @nestjs-redisx/core redis

Quick Start

typescript
import { Module } from '@nestjs/common';
import { RedisModule } from '@nestjs-redisx/core';

@Module({
  imports: [
    RedisModule.forRoot({
      clients: {
        host: 'localhost',
        port: 6379,
      },
    }),
  ],
})
export class AppModule {}

Core Documentation

SectionDescription
ConfigurationComplete configuration reference
RedisServiceService API documentation
Multiple ClientsNamed client management
Connection TypesSingle, Cluster, Sentinel
Health MonitoringHealth checks and reconnection
Decorators@InjectRedis usage
Driver Abstractionioredis vs node-redis
TroubleshootingCommon issues and solutions

Plugins

Self-contained feature modules for common Redis use cases.

PluginDescription
CacheTwo-tier caching with L1 memory and L2 Redis
LocksDistributed locking with auto-renewal
Rate LimitMultiple algorithms for API protection
IdempotencyRequest deduplication with response replay
StreamsRedis Streams with consumer groups
MetricsPrometheus metrics export
TracingOpenTelemetry distributed tracing

Architecture

Released under the MIT License.