Skip to main content

Redis Adapter

Package: @nauth-toolkit/storage-redis Type: Storage Adapter (Production)

High-performance Redis storage for transient authentication state.

npm install @nauth-toolkit/storage-redis redis

Usage

import { createClient } from 'redis';
import { RedisStorageAdapter } from '@nauth-toolkit/storage-redis';

const redisClient = createClient({ url: 'redis://localhost:6379' });
await redisClient.connect();

AuthModule.forRoot({
storageAdapter: new RedisStorageAdapter(redisClient),
})

Or with factory:

import { createRedisStorageAdapter } from '@nauth-toolkit/nestjs';

AuthModule.forRoot({
storageAdapter: createRedisStorageAdapter('redis://localhost:6379'),
})

Features

  • Automatic key prefixing (nauth_)
  • Native TTL support
  • Multi-server compatible
  • High performance