{"id":46169,"library":"redis-stream-kit","title":"redis-stream-kit","description":"Tiny TypeScript wrapper over Redis Streams providing typed Producer and Consumer classes with an injected Redis client. Current version 0.1.4 supports Node >=18 and Redis >=6.2 for XAUTOCLAIM. Differentiators: fully typed, manual ack control, configurable concurrency, auto-claim for stale recovery, and ESM-only design. Release cadence is irregular; API is stable for basic usage but breaking changes may occur before 1.0.","status":"active","version":"0.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/amirofy2002/redis-stream-kit","tags":["javascript","redis","streams","producer","consumer","typescript","xadd","xreadgroup"],"install":[{"cmd":"npm install redis-stream-kit","lang":"bash","label":"npm"},{"cmd":"yarn add redis-stream-kit","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-stream-kit","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to create Redis client instance used by Producer and Consumer","package":"ioredis","optional":true}],"imports":[{"note":"ESM-only package; CJS require will not work with named exports in some bundlers","wrong":"const Producer = require('redis-stream-kit').Producer","symbol":"Producer","correct":"import { Producer } from 'redis-stream-kit'"},{"note":"Consumer is a named export, not default","wrong":"import Consumer from 'redis-stream-kit'","symbol":"Consumer","correct":"import { Consumer } from 'redis-stream-kit'"},{"note":"All exports are from the package root, no subpaths","wrong":"import { Producer, Consumer } from 'redis-stream-kit/stream'","symbol":"Producer and Consumer together","correct":"import { Producer, Consumer } from 'redis-stream-kit'"}],"quickstart":{"code":"import Redis from 'ioredis';\nimport { Producer, Consumer } from 'redis-stream-kit';\n\nconst client = new Redis({ host: 'localhost', port: 6379 });\n\ntype Event = {\n  userId: string;\n  action: string;\n};\n\nconst producer = new Producer<Event>(client, 'events', { maxLen: 10000 });\nawait producer.start();\nawait producer.emit({ userId: 'u1', action: 'login' });\n\nconst consumer = new Consumer<Event>(client, 'events', 'workers', async (data, meta) => {\n  console.log(meta.id, data.userId, data.action);\n  // XACK automatically on success\n}, {\n  concurrency: 4,\n  onError: (err, data, meta) => console.error('handler failed', meta.id, err),\n  autoClaim: { idleMs: 60_000, intervalMs: 30_000 },\n});\nawait consumer.start();\n\n// Graceful shutdown after some work...\nawait consumer.stop();\nawait producer.stop();\nclient.disconnect();","lang":"typescript","description":"Demonstrates creating Producer and Consumer with typed events, emitting a message, handling it with auto-claim, and graceful shutdown."},"warnings":[{"fix":"Implement onError to log or dead-letter; ensure handler logic does not throw unexpectedly.","message":"Handler errors or decode failures do NOT ack the message. The message stays pending and can be recovered via autoClaim or manual processing.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set createIfMissing: false if stream is already managed externally.","message":"Consumer options createIfMissing (default true) may create the stream and consumer group automatically. If the stream has existing data with different schema, the consumer will attempt to decode all pending messages, potentially causing errors.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Keep an eye on releases; no immediate action needed.","message":"The 'autoClaim' option currently exists but may be reworked in future versions. Check changelog for breaking changes.","severity":"deprecated","affected_versions":"<1.0.0"},{"fix":"Ensure all payload values are JSON-serializable; use a wrapper type if needed.","message":"Each top-level field of the payload is JSON-encoded into a separate Redis stream field. Fields with non-JSON-serializable values (e.g., BigInt, undefined) will cause encode failure at emit time.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update constructor calls to match new signature: new Producer(client, stream, options?) and new Consumer(client, stream, group, handler, options?).","message":"Version 0.1.0 changed the constructor signature: options parameter moved from second to third position. Old code using positional args will fail.","severity":"breaking","affected_versions":"<0.1.0"}],"env_vars":null,"search_vec":"'0.1.4':24 '1.0':68 '18':27 '6.2':30 'ack':37 'api':56 'auto':42 'auto-claim':41 'basic':60 'break':63 'cadenc':53 'chang':64 'claim':43 'class':16 'client':21 'concurr':40 'configur':39 'consum':15,73 'control':38 'current':22 'design':51 'differenti':33 'esm':49 'esm-on':48 'fulli':34 'inject':19 'irregular':55 'javascript':69 'kit':4 'manual':36 'may':65 'node':26 'occur':66 'produc':13,72 'provid':11 'recoveri':46 'redi':2,9,20,29,70 'redis-stream-kit':1 'releas':52 'stabl':58 'stale':45 'stream':3,10,71 'support':25 'tini':5 'type':12,35 'typescript':6,74 'usag':61 'version':23 'wrapper':7 'xadd':75 'xautoclaim':32 'xreadgroup':76","created_at":"2026-06-07T12:58:37.194886+00:00","updated_at":"2026-06-07T12:58:37.194886+00:00","problems":[{"fix":"Run 'npm install redis-stream-kit' and ensure import is 'redis-stream-kit' (no subpath).","cause":"Package not installed or import path incorrect.","error":"Error: Cannot find module 'redis-stream-kit'"},{"fix":"Use 'import { Consumer } from 'redis-stream-kit' and instantiate with 'new Consumer(...)'.","cause":"Consumer constructor called without 'new' or imported incorrectly (e.g., default import instead of named).","error":"TypeError: consumer.start is not a function"},{"fix":"Ensure emit receives a plain object and producer is started (call await producer.start()).","cause":"Producer.emit called with non-object or after producer.stop().","error":"Error: ERR wrong number of arguments for 'xadd' command"},{"fix":"Set createIfMissing: true (default) or manually create stream and group via Redis CLI.","cause":"Stream or consumer group does not exist and createIfMissing is false.","error":"Error: NOGROUP No such key 'stream' or consumer group 'group'"},{"fix":"Verify Redis is running and client configuration is correct: new Redis({ host: 'localhost', port: 6379 }).","cause":"Redis client not connected or wrong host/port.","error":"Error: Unhandled 'error' event on Redis client – connection refused"}],"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/amirofy2002/redis-stream-kit#readme","github":"https://github.com/amirofy2002/redis-stream-kit","docs":null,"changelog":null,"pypi":null,"npm":"redis-stream-kit","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}}