{"id":46186,"library":"redis-url-plus","title":"redis-url-plus","description":"A Redis connection string parser that supports standalone, cluster, sentinel, and Unix socket URLs, aligning with Redis-CLI command formats. Current stable version is 1.2.1. The library handles multiple Redis URL syntaxes in a single call, returning structured objects with host, port, db, password, and cluster node arrays. It supports Node 10+. Key differentiators: built-in cluster detection (redis-cluster://) and sentinel support (redis-sentinel://) with master name parsing, unlike simpler parsers.","status":"active","version":"1.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/rickyes/redis-url-plus","tags":["javascript","redis-url","redis","redis-connect-url","redis-cli","redis-cluster-url"],"install":[{"cmd":"npm install redis-url-plus","lang":"bash","label":"npm"},{"cmd":"yarn add redis-url-plus","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-url-plus","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS require works as shown in README, but ESM users should use default import (the module uses module.exports = function, so ESM default import is correct).","wrong":"const RedisUrlParser = require('redis-url-plus').default","symbol":"RedisUrlParser","correct":"import RedisUrlParser from 'redis-url-plus'"},{"note":"The module exports a single function directly via module.exports. Named destructuring will result in undefined.","wrong":"const { parse } = require('redis-url-plus')","symbol":"default export","correct":"const parse = require('redis-url-plus')"},{"note":"TypeScript definitions are included in the package; avoid manually typing the result. The library exports union types for standalone/cluster/sentinel/socket results.","wrong":"const result: any = RedisUrlParser(...)","symbol":"type inferrence (TypeScript)","correct":"import RedisUrlParser from 'redis-url-plus';\nconst result = RedisUrlParser('redis://localhost:6379/0');\n// result is automatically inferred as RedisUrlResult | RedisClusterResult | ..."}],"quickstart":{"code":"import RedisUrlParser from 'redis-url-plus';\n\nconst standaloneUrl = 'redis://user:pass@localhost:6379/0';\nconst result = RedisUrlParser(standaloneUrl);\nconsole.log(result);\n// {\n//   password: 'pass',\n//   db: 0,\n//   port: 6379,\n//   host: 'localhost'\n// }\n\nconst clusterUrl = 'redis-cluster://localhost:6379,localhost:6380';\nconst clusterResult = RedisUrlParser(clusterUrl);\nconsole.log(clusterResult);\n// {\n//   cluster: true,\n//   nodes: [\n//     { host: 'localhost', port: 6379 },\n//     { host: 'localhost', port: 6380 }\n//   ]\n// }\n\nconst sentinelUrl = 'redis-sentinel://sentinel:26379/mymaster/0';\nconst sentinelResult = RedisUrlParser(sentinelUrl);\nconsole.log(sentinelResult);\n// {\n//   db: 0,\n//   name: 'mymaster',\n//   sentinels: [{ host: 'sentinel', port: 26379 }]\n// }\n\nconst socketUrl = 'socket://tmp/redis.sock';\nconst socketResult = RedisUrlParser(socketUrl);\nconsole.log(socketResult);\n// { path: '/tmp/redis.sock' }","lang":"typescript","description":"Demonstrates parsing standalone, cluster, sentinel, and Unix socket Redis URLs using redis-url-plus."},"warnings":[{"fix":"Ensure you use the correct scheme: 'redis://' for standalone or multiple standalone nodes (no cluster flag), 'redis-cluster://' for explicit cluster mode. When using 'redis://' with multiple hosts separated by comma, the library will return a result with cluster: true and nodes array (undocumented but observed).","message":"The parser treats URLs with multiple comma-separated hosts as cluster nodes only if the scheme is 'redis-cluster://'. For 'redis://' with multiple hosts, it also returns a cluster object with nodes array. Mixing schemes (e.g., 'redis://...' and 'redis-cluster://...') is undefined.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always include the master name in the sentinel URL: redis-sentinel://host:port/master_name/db","message":"Sentinel URLs (redis-sentinel://) must include a master name as first path segment after host:port. Omitting it results in undefined behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Update Node.js to version 14 or later.","message":"Node.js 10 and 12 are no longer officially supported by the Node.js project. This library may still work, but it is recommended to use Node 14+.","severity":"deprecated","affected_versions":">=1.2.1"},{"fix":"Use standard Redis URL format: redis://user:pass@host:port/db. Do not rely on query parameters.","message":"The library parses the URL query string? No query string support is documented. All parameters must be in the URL path or userinfo.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.2.1':30 '10':57 'align':19 'array':53 'built':61 'built-in':60 'call':41 'cli':23,92 'cluster':13,51,63,67,95 'command':24 'connect':7,88 'current':26 'db':48 'detect':64 'differenti':59 'format':25 'handl':33 'host':46 'javascript':81 'key':58 'librari':32 'master':75 'multipl':34 'name':76 'node':52,56 'object':44 'pars':77 'parser':9,80 'password':49 'plus':4 'port':47 'redi':2,6,22,35,66,72,83,85,87,91,94 'redis-c':21,90 'redis-clust':65 'redis-cluster-url':93 'redis-connect-url':86 'redis-sentinel':71 'redis-url':82 'redis-url-plus':1 'return':42 'sentinel':14,69,73 'simpler':79 'singl':40 'socket':17 'stabl':27 'standalon':12 'string':8 'structur':43 'support':11,55,70 'syntax':37 'unix':16 'unlik':78 'url':3,18,36,84,89,96 'version':28","created_at":"2026-06-07T12:58:41.899390+00:00","updated_at":"2026-06-07T12:58:41.899390+00:00","problems":[{"fix":"Run `npm install redis-url-plus` or `yarn add redis-url-plus`. Ensure the package is in node_modules.","cause":"The package is not installed, or the import path is incorrect.","error":"Cannot find module 'redis-url-plus'"},{"fix":"Use default import: `import RedisUrlParser from 'redis-url-plus'` or CommonJS require: `const RedisUrlParser = require('redis-url-plus')`.","cause":"Using ES import syntax incorrectly when the module uses CommonJS export.","error":"TypeError: RedisUrlParser is not a function"},{"fix":"Ensure the URL is valid: use one of the supported formats (redis://, redis-cluster://, redis-sentinel://, socket://). Check for typos.","cause":"Parsing a malformed URL that does not match any known pattern, returning an unexpected object shape.","error":"undefined is not an object (evaluating 'result.host')"},{"fix":"Use type guard: `if ('cluster' in result && result.cluster) { ... }` or cast appropriately.","cause":"TypeScript type narrowing not applied; the result type is a union and TypeScript can't narrow without explicit check.","error":"Property 'cluster' does not exist on type '...' (TypeScript)"}],"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/rickyes/redis-url-plus#readme","github":"https://github.com/rickyes/redis-url-plus","docs":null,"changelog":null,"pypi":null,"npm":"redis-url-plus","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}}