{"id":46607,"library":"then-redis","title":"then-redis","description":"Promise-based Redis client for Node.js, version 2.0.1. Built on top of node_redis, it provides a promise-based API for all Redis commands, automatic pipelining, and support for transactions and pub/sub. Requires Node >=4 and peer dependencies redis and redis-commands. Differentiates from ioredis by being lighter and directly wrapping node_redis; less active development.","status":"active","version":"2.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/mjackson/then-redis","tags":["javascript","redis","then","promise","promises"],"install":[{"cmd":"npm install then-redis","lang":"bash","label":"npm"},{"cmd":"yarn add then-redis","lang":"bash","label":"yarn"},{"cmd":"pnpm add then-redis","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"createClient is a named export, not a default export.","wrong":"import createClient from 'then-redis'","symbol":"createClient","correct":"import { createClient } from 'then-redis'"},{"note":"The default export is an object, not a function. Use destructured require.","wrong":"const createClient = require('then-redis')","symbol":"createClient (CommonJS)","correct":"const { createClient } = require('then-redis')"},{"note":"The Client class is exported for type usage; typical use is via createClient which returns a Client instance.","wrong":null,"symbol":"Client","correct":"import { Client } from 'then-redis' or type Client = ReturnType<typeof createClient>"}],"quickstart":{"code":"import { createClient } from 'then-redis';\n\nconst client = createClient();\n\nclient.set('foo', 'bar')\n  .then(() => client.get('foo'))\n  .then(value => {\n    console.log(value); // 'bar'\n  })\n  .catch(err => {\n    console.error(err);\n  });","lang":"typescript","description":"Basic set and get operations with promise chaining."},"warnings":[{"fix":"Update Redis server to 2.6+ or avoid HGETALL on older Redis versions.","message":"Redis server version 2.6 or above required for promise-based HGETALL. Older versions may return different types.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Run 'npm install redis redis-commands' alongside then-redis.","message":"Peer dependencies redis and redis-commands must be installed manually. Missing them will cause runtime errors.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Check for null before accessing properties: const hash = await client.hgetall('key'); if (hash) { ... }","message":"Commands that return objects (e.g., HGETALL) may return null for empty results, not an empty object.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use client.quit() to close connection gracefully.","message":"The callback API via .end() is deprecated in node_redis; use .quit() instead.","severity":"deprecated","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'2.0.1':12 '4':40 'activ':61 'api':25 'automat':30 'base':6,24 'built':13 'client':8 'command':29,48 'depend':43 'develop':62 'differenti':49 'direct':56 'ioredi':51 'javascript':63 'less':60 'lighter':54 'node':17,39,58 'node.js':10 'peer':42 'pipelin':31 'promis':5,23,66,67 'promise-bas':4,22 'provid':20 'pub/sub':37 'redi':3,7,18,28,44,47,59,64 'redis-command':46 'requir':38 'support':33 'then-redi':1 'top':15 'transact':35 'version':11 'wrap':57","created_at":"2026-06-07T13:00:45.312012+00:00","updated_at":"2026-06-07T13:00:45.312012+00:00","problems":[{"fix":"Install peer dependencies: npm install redis redis-commands","cause":"Missing peer dependency redis when using then-redis.","error":"Error: Cannot find module 'redis'"},{"fix":"Use named import: import { createClient } from 'then-redis' or const { createClient } = require('then-redis')","cause":"Default import of then-redis returns an object, not the function directly.","error":"TypeError: createClient is not a function"},{"fix":"Await createClient() or use a promise for connection readiness (e.g., client.on('connect', ...)).","cause":"Using then-redis before Redis is ready (e.g., not awaiting connection).","error":"TypeError: db.hgetall(...).then is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mjackson/then-redis#readme","github":"https://github.com/mjackson/then-redis","docs":null,"changelog":null,"pypi":null,"npm":"then-redis","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}