Skip to content

CSenshi/redis-kit

Repository files navigation

RedisKit Logo

RedisKit

Production-ready Redis utilities and libraries for Node.js applications

License: MIT TypeScript Node.js Nx

Distributed locking • High performance • Type-safe • Battle-tested

Overview

RedisKit is a collection of production-ready Redis utilities designed for modern Node.js applications. Built with TypeScript and focused on reliability, performance, and developer experience.

Packages

Distributed locking library implementing the Redlock algorithm with automatic lifecycle management.

npm install @redis-kit/lock

Key Features:

  • Fault-tolerant distributed locking across multiple Redis instances
  • Automatic lock extension for long-running operations
  • Full TypeScript support with comprehensive type definitions
  • Production-tested with clock drift compensation and retry logic

Quick Start

import { Redlock } from '@redis-kit/lock';
import { createClient } from 'redis';

// Set up Redis clients
const clients = [
  createClient({ host: 'redis1.example.com' }),
  createClient({ host: 'redis2.example.com' }),
  createClient({ host: 'redis3.example.com' }),
];

await Promise.all(clients.map((client) => client.connect()));

// Create distributed lock
const redlock = new Redlock(clients);

// Use the lock
await redlock.withLock('critical-resource', 30000, async () => {
  // Your critical section here
  await performCriticalOperation();
});

Development

This project uses Nx for monorepo management and build orchestration.

Prerequisites

  • Node.js 18+
  • pnpm (recommended package manager)

Architecture

RedisKit follows these principles:

  • Type Safety: Full TypeScript support with strict typing
  • Production Ready: Battle-tested with comprehensive error handling
  • Developer Experience: Simple APIs with sensible defaults
  • Performance: Optimized for high-throughput applications
  • Reliability: Fault-tolerant designs with proper retry mechanisms

License

MIT - see the LICENSE file for details.

Support

About

🧰 The Redis kit for Node.js — modular, minimal, and TypeScript-first.

Resources

License

Stars

Watchers

Forks

Packages

No packages published