npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nestplatform/redis

v1.1.0

Published

Nestjs Redis library

Downloads

21

Readme

@nestplatform/redis

A flexible NestJS module for managing Redis connections, supporting both standalone and cluster modes via ioredis.

Features

  • 🔌 Standalone & Cluster: First-class support for single-node and cluster deployments.
  • 🔒 TLS/SSL: Built-in TLS configuration for secure connections.
  • 🏷️ Custom Tokens: Register multiple Redis connections with custom injection tokens.
  • Async Config: Factory-based registration for runtime configuration (e.g., from ConfigService).
  • 💉 Decorator Support: @InjectRedis() for clean dependency injection.
  • 📝 Logging: Optional connection lifecycle logging.

Installation

npm install @nestplatform/redis ioredis

Usage

1. Register the module

Synchronous

import { RedisModule } from '@nestplatform/redis';

@Module({
  imports: [
    RedisModule.register({
      mode: 'standalone',
      host: 'localhost',
      port: 6379,
      logging: true,
    }),
  ],
})
export class AppModule {}

Asynchronous (with ConfigService)

import { RedisModule } from '@nestplatform/redis';
import { ConfigService } from '@nestjs/config';

@Module({
  imports: [
    RedisModule.registerAsync({
      inject: [ConfigService],
      useFactory: (config: ConfigService) => ({
        mode: 'standalone',
        host: config.get('REDIS_HOST'),
        port: config.get('REDIS_PORT'),
        password: config.get('REDIS_PASSWORD'),
      }),
      logging: true,
    }),
  ],
})
export class AppModule {}

2. Inject the client

import { Injectable } from '@nestjs/common';
import { InjectRedis, RedisClient } from '@nestplatform/redis';

@Injectable()
export class CacheService {
  constructor(@InjectRedis() private readonly redis: RedisClient) {}

  async get(key: string): Promise<string | null> {
    return this.redis.get(key);
  }

  async set(key: string, value: string, ttl?: number): Promise<void> {
    if (ttl) {
      await this.redis.set(key, value, 'PX', ttl);
    } else {
      await this.redis.set(key, value);
    }
  }
}

3. Multiple connections

Register multiple Redis instances with custom injection tokens:

@Module({
  imports: [
    RedisModule.register({
      mode: 'standalone',
      host: 'cache-host',
      port: 6379,
      injectionToken: 'CACHE_REDIS',
    }),
    RedisModule.register({
      mode: 'standalone',
      host: 'session-host',
      port: 6379,
      injectionToken: 'SESSION_REDIS',
    }),
  ],
})
export class AppModule {}

@Injectable()
export class SessionService {
  constructor(@InjectRedis('SESSION_REDIS') private readonly redis: RedisClient) {}
}

Cluster Mode

RedisModule.register({
  mode: 'cluster',
  nodes: [
    { host: 'node1.redis.example.com', port: 6379 },
    { host: 'node2.redis.example.com', port: 6379 },
    { host: 'node3.redis.example.com', port: 6379 },
  ],
  options: {
    redisOptions: { password: 'secret' },
  },
  logging: true,
})

TLS Configuration

RedisModule.register({
  mode: 'standalone',
  host: 'secure.redis.example.com',
  port: 6380,
  tls: {
    ca: fs.readFileSync('/path/to/ca.pem'),
    rejectUnauthorized: true,
  },
})

API Reference

| Export | Description | |--------|-------------| | RedisModule | Dynamic NestJS module with register() and registerAsync() | | InjectRedis(token?) | Parameter decorator for injecting the Redis client | | createRedisClient(config, logging?) | Utility to manually create an ioredis client | | RedisClient | Type alias for Redis \| Cluster from ioredis | | RedisConfig | Discriminated union of standalone and cluster configs | | REDIS_CLIENT | Default injection token for the client | | REDIS_CONFIG | Injection token for the config object |

Changelog

1.0.0

  • Initial release with standalone and cluster support.

License

MIT