{"id":44816,"library":"effect-redis","title":"Effect-Redis","description":"A modern, type-safe Effect-TS wrapper for the official `redis` (node-redis) client (v5). Version 0.0.32 — currently pre-1.0 with frequent breaking changes. Key differentiators: resource-safe connection lifecycle via Scope and Layer.scoped, modular services (Core, Pub/Sub, Streams), shared connection across services, tagged error union (RedisConnectionError, RedisCommandError, RedisGeneralError), and a raw escape hatch via use(). Built for Effect-TS ecosystem; requires TypeScript 5+. Release cadence: weekly releases with breaking changes common.","status":"active","version":"0.0.32","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","typescript"],"install":[{"cmd":"npm install effect-redis","lang":"bash","label":"npm"},{"cmd":"yarn add effect-redis","lang":"bash","label":"yarn"},{"cmd":"pnpm add effect-redis","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for the underlying Redis client; version ^5.1.0 required.","package":"redis","optional":false},{"reason":"Peer dependency for type safety; version ^5 required.","package":"typescript","optional":true}],"imports":[{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const { Redis } = require('effect-redis')","symbol":"Redis","correct":"import { Redis } from 'effect-redis'"},{"note":"All services are exported from the main module, not subpaths.","wrong":"import { RedisLive } from 'effect-redis/RedisLive'","symbol":"RedisLive","correct":"import { RedisLive } from 'effect-redis'"},{"note":"Use named export from root; do not deep-import.","wrong":"import { RedisConnectionOptionsLive } from 'effect-redis/src/RedisConnectionOptionsLive'","symbol":"RedisConnectionOptionsLive","correct":"import { RedisConnectionOptionsLive } from 'effect-redis'"},{"note":"Import from root; no separate module path.","wrong":"","symbol":"RedisPubSub","correct":"import { RedisPubSub } from 'effect-redis'"},{"note":"Streams service is available via same import pattern.","wrong":"","symbol":"RedisStream","correct":"import { RedisStream } from 'effect-redis'"}],"quickstart":{"code":"import { Effect, Layer, Stream } from 'effect';\nimport {\n  RedisConnectionOptionsLive,\n  RedisLive,\n  RedisPubSubLive,\n  Redis,\n  RedisPubSub,\n} from 'effect-redis';\n\nconst program = Effect.gen(function* () {\n  const redis = yield* Redis;\n  const pubsub = yield* RedisPubSub;\n\n  yield* redis.set('user:42', JSON.stringify({ name: 'Ada' }));\n  const val = yield* redis.get('user:42');\n\n  yield* redis.set('counter', '1');\n  yield* redis.incr('counter');\n\n  const subscription = yield* pubsub.subscribe('notifications');\n  yield* Effect.fork(\n    Stream.runForEach(subscription, (msg) =>\n      Effect.log(`Received: ${msg}`)\n    )\n  );\n\n  yield* pubsub.publish('notifications', 'Hello world!');\n});\n\nconst RedisLayer = RedisConnectionOptionsLive({\n  url: process.env.REDIS_URL ?? 'redis://localhost:6379',\n}).pipe(\n  Layer.provideMerge(RedisLive),\n  Layer.provideMerge(RedisPubSubLive)\n);\n\nEffect.runPromise(program.pipe(Effect.provide(RedisLayer)));\n","lang":"typescript","description":"Shows how to connect to Redis, set/get keys, increment a counter, and use pub/sub with Effect-TS layers."},"warnings":[{"fix":"Pin to exact version and test upgrades carefully.","message":"Version 0.x is pre-release; breaking changes can occur at any minor/patch bump.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Avoid relying on raw client if possible; prefer Effect-Redis services.","message":"The 'use()' method provides access to the raw node-redis client but may change or be removed in future versions.","severity":"deprecated","affected_versions":">=0.0.32"},{"fix":"Use RedisPubSub service for pub/sub operations; do not mix with core Redis service on the same client.","message":"Pub/Sub subscriber uses a dedicated connection; do not send commands other than subscribe/unsubscribe on the same client.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always provide RedisConnectionOptionsLive as the first layer.","message":"RedisConnectionOptionsLive must be provided before other layers; otherwise connection defaults may not apply.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use Effect.catchTags to handle specific error types.","message":"Error handling: The package uses tagged errors; ensure you catch 'RedisConnectionError', 'RedisCommandError', or 'RedisGeneralError'.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'-1.0':26 '0.0.32':23 '5':72 'across':49 'break':29,78 'built':64 'cadenc':74 'chang':30,79 'client':20 'common':80 'connect':36,48 'core':44 'current':24 'differenti':32 'ecosystem':69 'effect':2,10,67 'effect-redi':1 'effect-t':9,66 'error':52 'escap':60 'frequent':28 'hatch':61 'javascript':81 'key':31 'layer.scoped':41 'lifecycl':37 'modern':5 'modular':42 'node':18 'node-redi':17 'offici':15 'pre':25 'pub/sub':45 'raw':59 'redi':3,16,19 'rediscommanderror':55 'redisconnectionerror':54 'redisgeneralerror':56 'releas':73,76 'requir':70 'resourc':34 'resource-saf':33 'safe':8,35 'scope':39 'servic':43,50 'share':47 'stream':46 'tag':51 'ts':11,68 'type':7 'type-saf':6 'typescript':71,82 'union':53 'use':63 'v5':21 'version':22 'via':38,62 'week':75 'wrapper':12","created_at":"2026-06-07T12:51:59.184677+00:00","updated_at":"2026-06-07T12:51:59.184677+00:00","problems":[{"fix":"Install effect: npm install effect","cause":"Peer dependency 'effect' not installed.","error":"Module not found: Can't resolve 'effect'"},{"fix":"Use the correct named import: import { Redis } from 'effect-redis' (Redis is a service tag, not a constructor).","cause":"Importing Redis incorrectly as a default import or calling it as a function.","error":"TypeError: (0 , effect_redis__WEBPACK_IMPORTED_MODULE_1__.Redis) is not a function"},{"fix":"Use Effect.provide(layer) or Effect.runPromise(program.pipe(Effect.provide(layer)))","cause":"Layer not provided to the Effect before running.","error":"Uncaught (in promise) EffectUnknown: Layer { _tag: 'Layer', ... }"},{"fix":"Ensure RedisConnectionOptionsLive and RedisLive (or RedisPubSubLive/RedisStreamLive) are composed into a layer and provided to the Effect.","cause":"Connection layer (RedisConnectionLive) not provided or improperly scoped.","error":"Error: The client is closed"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"effect-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}}