← Upstash RedisCONTENT HISTORY

Update to Upstash Redis

Snapshot Sep 30, 2026 · 23:07 UTC · version 1.2.1

Collection source: not recorded for this historical snapshot.

WHAT CHANGED · RULE-BASED ANALYSIS

First saved snapshot

No earlier snapshot is available to establish a change.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "name": "upstash-redis-js",
  "description": "Work with the @upstash/redis TypeScript/JavaScript SDK, a serverless HTTP-based Redis client for Next.js, Vercel, Cloudflare Workers, edge runtimes, and Node.js. Use when adding a cache (cache-aside, write-through, TTL and expiration strategies), session storage and user sessions, a key-value store, leaderboards and rankings with sorted sets, counters, distributed locks, queues with lists, streams and consumer groups, JSON documents, pipelines and MULTI/EXEC transactions, Lua scripting, read replicas, or full-text search, typo-tolerant search, facets, and aggregations with Upstash Redis Search (different from regular FT.SEARCH; also available for TCP clients via @upstash/search-redis and @upstash/search-ioredis). Also use when migrating from ioredis or node-redis, when a Redis connection is needed from a serverless function without connection pooling, when integrating @upstash/ratelimit, or when the user says Redis cache, KV store, session store, serverless Redis, or Upstash Redis. Supports automatic serialization/deserialization of JavaScript types.",
  "included_files": [
    {
      "relative_path": "advanced-features/auto-pipeline.md",
      "size_in_bytes": 1376
    },
    {
      "relative_path": "advanced-features/pipeline-and-transactions.md",
      "size_in_bytes": 2533
    },
    {
      "relative_path": "advanced-features/scripting.md",
      "size_in_bytes": 2864
    },
    {
      "relative_path": "data-structures/hashes.md",
      "size_in_bytes": 1851
    },
    {
      "relative_path": "data-structures/json.md",
      "size_in_bytes": 3660
    },
    {
      "relative_path": "data-structures/lists.md",
      "size_in_bytes": 2155
    },
    {
      "relative_path": "data-structures/sets.md",
      "size_in_bytes": 2918
    },
    {
      "relative_path": "data-structures/sorted-sets.md",
      "size_in_bytes": 3972
    },
    {
      "relative_path": "data-structures/streams.md",
      "size_in_bytes": 5096
    },
    {
      "relative_path": "data-structures/strings.md",
      "size_in_bytes": 2172
    },
    {
      "relative_path": "migrations/from-ioredis.md",
      "size_in_bytes": 3663
    },
    {
      "relative_path": "migrations/from-redis-node.md",
      "size_in_bytes": 4290
    },
    {
      "relative_path": "patterns/caching.md",
      "size_in_bytes": 1350
    },
    {
      "relative_path": "patterns/distributed-locks.md",
      "size_in_bytes": 3676
    },
    {
      "relative_path": "patterns/leaderboard.md",
      "size_in_bytes": 4195
    },
    {
      "relative_path": "patterns/rate-limiting.md",
      "size_in_bytes": 4844
    },
    {
      "relative_path": "patterns/session-management.md",
      "size_in_bytes": 5124
    },
    {
      "relative_path": "performance/batching-operations.md",
      "size_in_bytes": 2054
    },
    {
      "relative_path": "performance/data-serialization.md",
      "size_in_bytes": 3480
    },
    {
      "relative_path": "performance/error-handling.md",
      "size_in_bytes": 3919
    },
    {
      "relative_path": "performance/pipeline-optimization.md",
      "size_in_bytes": 2433
    },
    {
      "relative_path": "performance/redis-replicas.md",
      "size_in_bytes": 484
    },
    {
      "relative_path": "performance/ttl-expiration.md",
      "size_in_bytes": 775
    },
    {
      "relative_path": "search/adapters.md",
      "size_in_bytes": 2901
    },
    {
      "relative_path": "search/commands/aggregating.md",
      "size_in_bytes": 5979
    },
    {
      "relative_path": "search/commands/aliases.md",
      "size_in_bytes": 2191
    },
    {
      "relative_path": "search/commands/index-management.md",
      "size_in_bytes": 3180
    },
    {
      "relative_path": "search/commands/querying.md",
      "size_in_bytes": 6774
    },
    {
      "relative_path": "search/overview.md",
      "size_in_bytes": 6438
    }
  ],
  "skill_md_contents": "---\nname: upstash-redis-js\ndescription: Work with the @upstash/redis TypeScript/JavaScript SDK, a serverless HTTP-based Redis client for Next.js, Vercel, Cloudflare Workers, edge runtimes, and Node.js. Use when adding a cache (cache-aside, write-through, TTL and expiration strategies), session storage and user sessions, a key-value store, leaderboards and rankings with sorted sets, counters, distributed locks, queues with lists, streams and consumer groups, JSON documents, pipelines and MULTI/EXEC transactions, Lua scripting, read replicas, or full-text search, typo-tolerant search, facets, and aggregations with Upstash Redis Search (different from regular FT.SEARCH; also available for TCP clients via @upstash/search-redis and @upstash/search-ioredis). Also use when migrating from ioredis or node-redis, when a Redis connection is needed from a serverless function without connection pooling, when integrating @upstash/ratelimit, or when the user says Redis cache, KV store, session store, serverless Redis, or Upstash Redis. Supports automatic serialization/deserialization of JavaScript types.\nlicense: MIT\nmetadata:\n  author: Upstash\n  homepage: https://upstash.com\n---\n\n# Upstash Redis SDK - Complete Skills Guide\n\nThis 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.\n\n## Installation\n\n```bash\nnpm install @upstash/redis\n```\n\n## Quick Start\n\n### Basic Initialization\n\n```typescript\nimport { Redis } from \"@upstash/redis\";\n\n// Initialize with explicit credentials\nconst redis = new Redis({\n  url: \"UPSTASH_REDIS_REST_URL\",\n  token: \"UPSTASH_REDIS_REST_TOKEN\",\n});\n\n// Or initialize from environment variables\nconst redis = Redis.fromEnv();\n```\n\n### Environment Variables\n\nSet these in your `.env` file:\n\n```bash\nUPSTASH_REDIS_REST_URL=https://your-redis.upstash.io\nUPSTASH_REDIS_REST_TOKEN=your-token-here\n```\n\n> **No credentials yet?** If you're an agent that needs scratch Redis and the user hasn't provided a database, you can mint a temporary one with a single POST to `https://upstash.com/start-redis` (3-day TTL, no signup).\n\n## Skill Files Overview\n\n### Data Structures (data-structures/)\n\nRedis data types with auto-serialization examples:\n\n- **strings.md** - GET, SET, INCR, DECR, APPEND with automatic type handling\n- **hashes.md** - HSET, HGET, HMGET with object serialization\n- **lists.md** - LPUSH, RPUSH, LRANGE with array handling\n- **sets.md** - SADD, SMEMBERS, set operations\n- **sorted-sets.md** - ZADD, ZRANGE, ZRANK, leaderboard patterns\n- **json.md** - JSON.SET, JSON.GET, JSONPath queries for nested objects\n- **streams.md** - XADD, XREAD, XGROUP, consumer groups\n\n### Advanced Features (advanced-features/)\n\nComplex operations and optimizations:\n\n- **auto-pipeline.md** - Automatic request batching, performance optimization\n- **pipeline-and-transactions.md** - Manual pipelines, MULTI/EXEC for atomic operations\n- **scripting.md** - Lua scripts, EVAL, EVALSHA for server-side logic\n\n### Patterns (patterns/)\n\nCommon use cases and architectural patterns:\n\n- **caching.md** - Cache-aside, write-through, TTL strategies\n- **rate-limiting.md** - Integration with @upstash/ratelimit package\n- **session-management.md** - Session storage and user state management\n- **distributed-locks.md** - Lock implementations, deadlock prevention\n- **leaderboard.md** - Sorted set leaderboards, real-time rankings\n\n### Performance (performance/)\n\nOptimization techniques and best practices:\n\n- **batching-operations.md** - MGET, MSET, batch operations\n- **pipeline-optimization.md** - When to use pipelines, performance tips\n- **ttl-expiration.md** - Key expiration strategies, memory management\n- **data-serialization.md** - Deep dive into auto serialization, custom serializers, edge cases\n- **error-handling.md** - Error types, retry strategies, timeout handling, debugging tips\n- **redis-replicas.md** - Global database setup, read replicas, read-your-writes consistency\n\n### Search (search/)\n\nFull-text search, filtering, and aggregation extension for Redis:\n\n- **overview.md** - Schema definition, field types, pitfalls, package overview\n- **commands/querying.md** - Query and count with filters, pagination, sorting, highlighting\n- **commands/aggregating.md** - Metric aggregations ($avg, $sum, $stats), bucket aggregations ($terms, $range, $histogram, $facet)\n- **commands/index-management.md** - Create, describe, drop indexes, waitIndexing\n- **commands/aliases.md** - Index aliases for zero-downtime reindexing\n- **adapters.md** - Using search with node-redis and ioredis via @upstash/search-redis and @upstash/search-ioredis\n\n### Migrations (migrations/)\n\nMigration guides from other libraries:\n\n- **from-ioredis.md** - Migration from ioredis, key differences, serialization changes\n- **from-redis-node.md** - Migration from node-redis, API differences\n\n## Common Mistakes (Especially for LLMs)\n\n### ❌ Mistake 1: Treating Everything as Strings\n\n```typescript\n// ❌ WRONG - Don't do this with @upstash/redis\nawait redis.set(\"count\", \"42\"); // Stored as string \"42\"\nconst count = await redis.get(\"count\");\nconst incremented = parseInt(count) + 1; // Manual parsing needed\n\n// ✅ CORRECT - Let the SDK handle it\nawait redis.set(\"count\", 42); // Stored as number\nconst count = await redis.get(\"count\");\nconst incremented = count + 1; // Just use it\n```\n\n### ❌ Mistake 2: Manual JSON Serialization\n\n```typescript\n// ❌ WRONG - Unnecessary with @upstash/redis\nawait redis.set(\"user\", JSON.stringify({ name: \"Alice\" }));\nconst user = JSON.parse(await redis.get(\"user\"));\n\n// ✅ CORRECT - Automatic handling\nawait redis.set(\"user\", { name: \"Alice\" });\nconst user = await redis.get(\"user\");\n```\n\n## Quick Command Reference\n\n```typescript\n// Strings\nawait redis.set(\"key\", \"value\");\nawait redis.get(\"key\");\nawait redis.incr(\"counter\");\nawait redis.decr(\"counter\");\n\n// Hashes\nawait redis.hset(\"user:1\", { name: \"Alice\", age: 30 });\nawait redis.hget(\"user:1\", \"name\");\nawait redis.hgetall(\"user:1\");\n\n// Lists\nawait redis.lpush(\"tasks\", \"task1\", \"task2\");\nawait redis.rpush(\"tasks\", \"task3\");\nawait redis.lrange(\"tasks\", 0, -1);\n\n// Sets\nawait redis.sadd(\"tags\", \"javascript\", \"redis\");\nawait redis.smembers(\"tags\");\n\n// Sorted Sets\nawait redis.zadd(\"leaderboard\", { score: 100, member: \"player1\" });\nawait redis.zrange(\"leaderboard\", 0, -1);\n\n// JSON\nawait redis.json.set(\"user:1\", \"$\", { name: \"Alice\", address: { city: \"NYC\" } });\nawait redis.json.get(\"user:1\");\n\n// Expiration\nawait redis.setex(\"session\", 3600, { userId: \"123\" });\nawait redis.expire(\"key\", 60);\nawait redis.ttl(\"key\");\n```\n\n## Best Practices\n\n1. **Use environment variables** for credentials, never hardcode\n2. **Leverage auto-serialization** - pass native JavaScript types\n3. **Use TypeScript types** for better type safety\n4. **Set appropriate TTLs** to manage memory\n5. **Use pipelines** for multiple operations\n6. **Namespace your keys** (e.g., `user:123`, `session:abc`)\n\n## Resources\n\n- [Official Documentation](https://upstash.com/docs/redis)\n- [GitHub Repository](https://github.com/upstash/redis-js)\n- [API Reference](https://upstash.com/docs/redis/sdks/ts/overview)\n- [Examples](https://github.com/upstash/redis-js/tree/main/examples)\n\n## Getting Help\n\nFor detailed information on specific topics, refer to the individual skill files in the `skills/` directory. Each file contains comprehensive examples, use cases, and best practices for its topic.\n"
}

SHA-256: ee3039ba0cce424b6f31e03ac6f5154f4acbac054b64e982c893182112a4cf9a