skillfed

redis-js

redis-js is an HTTP-based Redis client for JavaScript and TypeScript that works with Upstash's serverless infrastructure. It handles caching, session storage, rate limiting, and full-text search while automatically serializing and deserializing JavaScript types—no manual JSON conversion needed. The SDK supports all Redis data structures and includes patterns for leaderboards, distributed locks, and performance optimization.

redis-js lets you cache data and manage sessions with Upstash's serverless Redis SDK for JavaScript and TypeScript.

AI-generated summary based on this skill's SKILL.md

959 91 MIT updated by upstash

Install

upstash/redis-js/skills · repository language: TypeScript

git clone https://github.com/upstash/redis-js
cp -r redis-js/skills ~/.claude/skills/skills
npx skillfed install upstash/redis-js/skills

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What is redis-js and how does it work with serverless Redis?

redis-js is an HTTP-based Redis client for JavaScript and TypeScript designed for Upstash's serverless infrastructure. It handles caching, session storage, rate limiting, and full-text search while automatically serializing and deserializing JavaScript types—eliminating manual JSON conversion. The SDK supports all Redis data structures and is distributed under the MIT license.

Can redis-js be used for redis caching and session storage?

Yes, redis-js excels at caching and session storage in serverless environments. It provides straightforward APIs for storing and retrieving cached data with automatic type serialization, making it ideal for managing user sessions, temporary data, and frequently accessed information without the overhead of traditional Redis setup.

How do I implement rate limiting and leaderboards with redis-js?

redis-js supports rate limiting and leaderboards through sorted sets and atomic operations. You can use sorted sets to track user scores for leaderboards and implement rate limiting by maintaining counters with TTL expiration. The SDK's automatic serialization simplifies working with these data structures compared to manual approaches.

Does redis-js support full-text search and data aggregation?

redis-js enables querying and aggregating data with full-text search capabilities. It works with Redis's search functionality to index and retrieve complex data patterns, supporting nested object queries and advanced filtering—all while maintaining automatic serialization of JavaScript types.

What performance optimizations does redis-js provide?

redis-js optimizes performance through pipelines and batching, allowing you to group multiple operations into single requests. This reduces network overhead in serverless environments and improves throughput when executing related commands sequentially or in parallel.

Can I migrate from ioredis or node-redis to redis-js?

Yes, redis-js is designed as a migration path from traditional Redis libraries like ioredis and node-redis. While the API differs due to its HTTP-based nature, redis-js provides equivalent functionality for caching, data structures, and session management with the added benefit of serverless compatibility and automatic type handling.

SKILL.md

rendered from the published skill — quoted content, verbatim

Upstash Redis SDK - Complete Skills Guide

This directory contains comprehensive guides for using the @upstash/redis SDK. These skill files are designed to help developers and AI assistants understand and use the SDK effectively.

Installation

npm install @upstash/redis

Quick Start

Basic Initialization
import { Redis } from "@upstash/redis";

// Initialize with explicit credentials
const redis = new Redis({
  url: "UPSTASH_REDIS_REST_URL",
  token: "UPSTASH_REDIS_REST_TOKEN",
});

// Or initialize from environment variables
const redis = Redis.fromEnv();
Environment Variables

Set these in your .env

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 15 files
skills/SKILL.md
skills/advanced-features/auto-pipeline.md
skills/advanced-features/pipeline-and-transactions.md
skills/advanced-features/scripting.md
skills/data-structures/hashes.md
skills/data-structures/json.md
skills/data-structures/lists.md
skills/data-structures/sets.md
skills/data-structures/sorted-sets.md
skills/data-structures/streams.md
skills/data-structures/strings.md
skills/migrations/from-ioredis.md
skills/migrations/from-redis-node.md
skills/patterns/caching.md
skills/patterns/distributed-locks.md

Related skills

Tags

serverless-database in-memory-cache key-value-store real-time-features type-serialization rest-api-client distributed-systems performance-optimization schema-search