Redisc - a tool for Redis discovery A terminal-based Redis key browser with support for SSH tunneling, pattern matching, and full CRUD operations.
# Install dependencies
npm installCreate a .env file in the project root:
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=your_password_here # Optional
REDIS_DB=0
# SSH Tunnel Configuration (optional)
USE_SSH=false
SSH_HOST=your.server.com
SSH_PORT=22
SSH_USERNAME=your_username
SSH_PRIVATE_KEY_PATH=/path/to/private/key
SSH_PASSPHRASE=key_passphrase # Optional
SSH_PASSWORD=ssh_password # Alternative to keyCreate multiple environment files:
.env- Default/development.env.staging- Staging environment.env.production- Production environment
npm startnpm start -- --env staging # Uses .env.staging
npm start -- --env production # Uses .env.productionnpm run test-conn # Test default connection
npm run test-conn -- --env production # Test production connectionnpm run typecheck↑/↓orj/k- Navigate key listEnter- View selected key value- Mouse - Click and scroll anywhere
/- Search keys (filter current list)p- Pattern match (reload with Redis pattern)Esc- Clear search/close dialogs
d- Delete selected key (with confirmation)t- Show TTL for selected keyr- Refresh key listCtrl-tor^t- Toggle tree view mode
Enter/Space- Expand/collapse folder→- Expand selected folder←- Collapse selected folderd- Delete single key OR bulk delete all keys in folder
?- Show helpqorCtrl-C- Quit application
When using the pattern dialog (p key):
*- Match any characters?- Match single characteruser:*- Match keys starting with 'user:'*:session- Match keys ending with ':session'user:?:*- Match 'user:' + 1 char + anything
Examples:
session:*- All session keyscache:user:*- All user cache entriestemp:*:data- All temporary data keys
- Hierarchical Display: Organize keys by their prefixes (
:,/,.,-) - Auto-detect Delimiter: Automatically detects the delimiter used in your keys
- Expandable Folders: Navigate through nested key structures like a file system
- Bulk Operations: Delete entire folders (all keys matching a prefix) with one action
- Toggle Anytime: Press
Ctrl-tto switch between flat list and tree view
- Folder Deletion: In tree view, delete all keys under a folder prefix
- Safety Confirmations: Shows exact pattern and key count before deletion
- Warning for Large Deletes: Red warning displayed when deleting >1000 keys
- Batched Processing: Deletes processed in batches of 500 for reliability
- Progress Display: Real-time progress shown during bulk operations
- Boundary Checking: Prevents partial matches (e.g.,
user:123won't matchuser:1234)
- String - Simple string values
- List - Ordered collections (shows index and value)
- Set - Unordered unique collections
- Sorted Set (ZSet) - Ordered sets with scores
- Hash - Field-value pairs
All key views show TTL information:
- Human-readable format (Xh Ym Zs)
- Raw seconds value
- "No expiration" for persistent keys
Delete operations require typing 'yes' to confirm, preventing accidental data loss.
To connect to Redis through an SSH tunnel:
- Set
USE_SSH=truein your.envfile - Configure SSH credentials (key or password)
- Set
REDIS_HOSTto the Redis host as seen from the SSH server - The tunnel will be established automatically on startup
Example for remote Redis:
USE_SSH=true
SSH_HOST=bastion.example.com
SSH_PORT=22
SSH_USERNAME=admin
SSH_PRIVATE_KEY_PATH=~/.ssh/id_rsa
REDIS_HOST=redis.internal.example.com # Internal address
REDIS_PORT=6379Run the connection test to diagnose issues:
npm run test-connThis will show:
- ✅ SSH tunnel status (if enabled)
- ✅ Redis connection status
- ✅ Redis version and database info
- ❌ Detailed error messages with troubleshooting tips
Can't connect to Redis
- Verify Redis is running:
redis-cli ping - Check host/port in .env file
- Verify firewall allows connection
- Check Redis password if required
SSH tunnel fails
- Verify SSH credentials
- Check SSH host/port
- Ensure private key file exists and has correct permissions (600)
- Test SSH connection manually:
ssh user@host
Keys not loading
- Check Redis database number (REDIS_DB)
- Verify pattern matches your keys
- Ensure you have permission to scan keys
src/
├── config/ # Configuration loading
├── connection/ # Redis & SSH connection management
├── redis/ # Redis operations (keys, values, TTL)
├── ui/ # Terminal UI components and dialogs
└── utils/ # Utility functions
npm run typecheckAll code is written in TypeScript with full type safety.
The original JavaScript version is preserved:
npm run start:old-
Enable tree view:
- Press
Ctrl-tto switch to tree view - Keys are automatically organized by delimiter (
:,/,.,-)
- Press
-
Navigate folders:
- Use arrow keys to move between items
- Press
EnterorSpaceto expand/collapse folders - Press
→to expand,←to collapse
-
View key values:
- Navigate to a key (leaf node, no expand icon)
- Press
Enterto view the key's value
-
Bulk delete a folder:
- Navigate to a folder node (has
▶or▼icon) - Press
dto delete ALL keys under that folder - Confirm the deletion (shows pattern like
user:session:*and key count) - Watch progress as keys are deleted in batches
- Navigate to a folder node (has
E-commerce keys:
user:123:profile
user:123:cart
user:123:orders
user:456:profile
In tree view:
▼ user
▶ 123 (3 keys)
▶ 456 (1 key)
Cache keys:
cache/api/v1/users
cache/api/v1/products
cache/api/v2/users
In tree view:
▼ cache
▼ api
▶ v1 (2 keys)
▶ v2 (1 key)
- Large Databases: Use specific patterns instead of
*to avoid loading too many keys - Pattern Testing: Use
pto test different patterns without restarting - Search vs Pattern:
- Search (
/) filters already loaded keys (fast, client-side) - Pattern (
p) reloads from Redis with new pattern (slower, server-side)
- Search (
- Tree View: Best for exploring unfamiliar databases or managing hierarchical key structures
- Bulk Delete: Always review the pattern and key count carefully before confirming
- SSH Tunnels: Keep tunnel configuration in separate .env files for different environments
- Safety: Always double-check before deleting keys in production
For issues or questions:
- Check the connection test output:
npm run test-conn - Review the error messages in the status bar
- Check the REFACTORING_SUMMARY.md for architecture details
- Review IMPLEMENTATION.md for technical implementation details
- TypeScript: Full type safety with zero compilation errors
- Modules: 22 modular files for maintainability
- Lines of Code: ~2,300 lines (from 816 monolithic lines)
- Dependencies:
redis- Redis clientblessed- Terminal UI frameworktunnel-ssh- SSH tunnel supportdotenv- Environment configuration