upstash-redis-js
Build serverless Redis applications with the Upstash Redis TypeScript/JavaScript SDK. Handles caching, session storage, rate limiting, leaderboards, and full-text search with automatic serialization of native JavaScript types. Includes support for all Redis data structures and Lua scripting.
Upstash Redis JS enables serverless Redis operations for caching, sessions, and real-time data structures via REST.
AI-generated summary based on this skill's SKILL.md
Install
upstash/skills/upstash-redis-js · repository language: JavaScript
git clone https://github.com/upstash/skills
cp -r skills/skills/upstash-redis-js ~/.claude/skills/upstash-redis-jsnpx skillfed install upstash/skills/upstash-redis-jsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I cache data with upstash-redis-js?
upstash-redis-js provides serverless Redis caching through the Upstash Redis TypeScript/JavaScript SDK. Set cached values using standard Redis commands with automatic serialization of JavaScript types. Configure TTL expiration to manage cache lifecycle, and leverage the REST API for stateless operations in serverless environments. The SDK handles connection pooling and request batching automatically.
Can upstash-redis-js implement rate limiting and leaderboards?
upstash-redis-js supports both rate limiting and leaderboard features through Redis data structures. Use sorted sets for leaderboards to track scores and rankings efficiently. Implement rate limiting by tracking request counts with TTL expiration, or use Lua scripting for atomic operations. The SDK's pipeline batching enables efficient multi-command execution for high-throughput scenarios.
What Redis data structures does upstash-redis-js support?
upstash-redis-js works with all Redis data structures including strings, lists, sets, sorted sets, hashes, and streams. The SDK provides full-text search and aggregation query capabilities, plus support for Redis JSON queries. Automatic serialization handles native JavaScript types transparently, and Lua scripting enables custom atomic operations across multiple keys.
How do I set up serverless Redis caching with upstash-redis-js?
upstash-redis-js simplifies serverless Redis setup through the Upstash REST API with zero connection management. Install the SDK, configure your Upstash endpoint and token, and start using Redis commands immediately. Auto-serialization converts JavaScript objects to Redis-compatible formats automatically. The stateless design works seamlessly with AWS Lambda, Vercel, and other serverless platforms.
Does upstash-redis-js support session storage and distributed locks?
upstash-redis-js enables session storage by persisting session data with configurable TTL expiration. Implement distributed locks using Lua scripting for atomic compare-and-set operations across serverless instances. The SDK's pipeline batching reduces latency for multi-step operations, making it suitable for session management in distributed applications.
What's included in upstash-redis-js for TypeScript development?
upstash-redis-js is built for TypeScript with full type safety and includes the complete Upstash Redis SDK. Features auto-serialization for JavaScript types, support for Redis Lua scripting, sorted sets for leaderboards, and stream operations. The MIT license permits commercial use, and the SDK integrates seamlessly with Node.js and edge runtime environments.
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/upstash-redis-js/SKILL.md
skills/upstash-redis-js/advanced-features/auto-pipeline.md
skills/upstash-redis-js/advanced-features/pipeline-and-transactions.md
skills/upstash-redis-js/advanced-features/scripting.md
skills/upstash-redis-js/data-structures/hashes.md
skills/upstash-redis-js/data-structures/json.md
skills/upstash-redis-js/data-structures/lists.md
skills/upstash-redis-js/data-structures/sets.md
skills/upstash-redis-js/data-structures/sorted-sets.md
skills/upstash-redis-js/data-structures/streams.md
skills/upstash-redis-js/data-structures/strings.md
skills/upstash-redis-js/migrations/from-ioredis.md
skills/upstash-redis-js/migrations/from-redis-node.md
skills/upstash-redis-js/patterns/caching.md
skills/upstash-redis-js/patterns/distributed-locks.md