Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

upstash-redis-js

БесплатноБез исполняемых скриптовНе проверен

Work with the @upstash/redis TypeScript/JavaScript SDK, a serverless HTTP-based Redis client for Next.js, Vercel, Cloudflare Workers, edge runtimes, and…

upstashот upstash★ 37 звёзд на GitHub

Об этом скилле

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.

Bundled docs and source

Before writing or debugging SDK code, check node_modules/@upstash/redis/docs/ for bundled docs and node_modules/@upstash/redis/src/ for readable TypeScript source. Read and search the relevant files when present; otherwise use the references in this skill.

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 file:

UPSTASH_REDIS_REST_URL=https://your-redis.upstash.io
UPSTASH_REDIS_REST_TOKEN=your-token-here

Redis.fromEnv() also reads KV_REST_API_URL and KV_REST_API_TOKEN as a fallback.

Other Runtimes

// Cloudflare Workers: pass the env binding
import { Redis } from "@upstash/redis/cloudflare";
const redis = Redis.fromEnv(env);

// Fastly Compute: needs the name of a backend defined on the service
import { Redis } from "@upstash/redis/fastly";
const redis = new Redis({ url: "<URL>", token: "<TOKEN>", backend: "upstash-db" });

Client Options

Defaults shown; all are optional.

const redis = new Redis({
  url: "<URL>",
  token: "<TOKEN>",
  automaticDeserialization: true, // performance/data-serialization.md
  responseEncoding: false, // or "base64", performance/data-serialization.md
  enableAutoPipelining: true, // advanced-features/auto-pipeline.md
  readYourWrites: true, // performance/redis-replicas.md
  retry: { retries: 5 }, // or false, performance/error-handling.md
  cache: "no-store", // fetch cache setting
  keepAlive: true,
  latencyLogging: false, // true logs the latency of every command
  // signal: () => AbortSignal.timeout(5000), performance/error-handling.md
});

Branches: test against a copy of real data

A branch is a point-in-time copy of a database with its own endpoint and token. Later changes on either side stay separate, and a branch cannot be merged back. The SDK has no call that creates one: a branch is created on the account, then used like any other database.

  • MCP (when Upstash MCP tools are in the session): call redis_create_branch with databaseId and name, then poll redis_get_database with the returned database_id until state is active. Leave include_credentials off: with it, the REST token comes back into the conversation. The response has the endpoint; for the token, use the CLI below if it is installed, or ask the user to copy the branch's REST token from the console into the env file.
  • CLI (no MCP): upstash redis create-branch --db-id <id> --name <branch-name>, then upstash redis get --db-id <branch database_id> --hide-credentials until state is active. Run redis get without --hide-credentials only to pipe endpoint and rest_token through jq into the app's env file, so the token never shows in your output.

Neither writes the credentials anywhere, so point the client at the branch yourself, preferably by setting UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN in the env file to the branch's values, or explicitly:

const redis = new Redis({
  url: "https://<branch endpoint>",
  token: "<branch rest_token>",
});

A branch is billed as pay-as-you-go whatever the source's plan, so tell the user before copying a large database. The account needs a payment method and the source must be a global database on a pay-as-you-go, fixed or enterprise plan (free databases are refused). Delete a branch like a database: redis_delete_database, or upstash redis delete --db-id <id>. Delete only branches you created for the task, and check the id with the user first, since the same call deletes a production database.

Skill Files Overview

Data Structures (data-structures/)

Redis data types with auto-serialization examples:

  • strings.md - GET, SET, INCR, DECR, APPEND with automatic type handling
  • hashes.md - HSET, HGET, HMGET with object serialization, per-field expiration (HEXPIRE, HTTL)
  • lists.md - LPUSH, RPUSH, LRANGE with array handling
  • sets.md - SADD, SMEMBERS, set operations
  • sorted-sets.md - ZADD, ZRANGE, ZRANK, leaderboard patterns
  • json.md - JSON.SET, JSON.GET, JSONPath queries for nested objects
  • streams.md - XADD, XREAD, XGROUP, consumer groups
  • arrays.md - ARSET, ARINSERT, ARSCAN, ARGREP, AROP, ring buffers with ARRING on sparse index-addressed arrays
  • vector-indexes.md - VECTOR.CREATE, VECTOR.ADD, VECTOR.QUERY nearest-neighbour search inside Redis via redis.vect
Полный SKILL.md на GitHub

Установить upstash-redis-js в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

advanced-features/auto-pipeline.mdadvanced-features/pipeline-and-transactions.mdadvanced-features/pubsub.mdadvanced-features/scripting.mddata-structures/arrays.mddata-structures/hashes.mddata-structures/json.mddata-structures/lists.mddata-structures/sets.mddata-structures/sorted-sets.mddata-structures/streams.mddata-structures/strings.mddata-structures/vector-indexes.mdmigrations/from-ioredis.mdmigrations/from-redis-node.mdmigrations/from-upstash-search.mdpatterns/caching.mdpatterns/distributed-locks.mdpatterns/leaderboard.mdpatterns/rate-limiting.mdpatterns/session-management.mdperformance/batching-operations.mdperformance/data-serialization.mdperformance/error-handling.mdperformance/pipeline-optimization.mdperformance/redis-replicas.mdperformance/ttl-expiration.mdsearch/adapters.mdsearch/commands/aggregating.mdsearch/commands/aliases.mdsearch/commands/index-management.mdsearch/commands/querying.mdsearch/overview.md

FAQ

Что делает скилл upstash-redis-js?

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, TTL strategies), session storage, a key-value store, leaderboards with sorted sets, counters, distributed locks, queues, streams and consumer groups, ring buffers and sparse arrays (ARSET, ARRING), vector search inside Redis (redis.vector), JSON documents, pipelines and transactions, Lua scripting, read replicas, or full-text and hybrid search, facets and aggregations with Upstash Redis Search (not FT.SEARCH; TCP clients use @upstash/search-redis or @upstash/search-ioredis). Also use when migrating from ioredis or node-redis, connecting from serverless without pooling, building AI agents with Upstash AgentKit (agent memory, chat history, RAG tools, resumable streams) for the Vercel AI SDK, TanStack AI, or Vercel Eve, or when the user says Redis cache, KV store, session store, serverless Redis, or Upstash Redis.

Как установить скилл upstash-redis-js?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл upstash-redis-js запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить upstash-redis-js с