π― TRUE DROP-IN REPLACEMENT powered by Valkey GLIDE's high-performance Rust core
Production-Ready Core Features - BullMQ, Socket.IO, Express Sessions, JSON module fully validated
A production-ready ioredis replacement that seamlessly integrates Valkey GLIDE's high-performance Rust core with your existing Node.js applications. Zero code changes required for core functionality - simply change your import statement and gain the benefits of GLIDE's resilient, high-performance architecture while maintaining API compatibility.
This project uses exclusively Valkey GLIDE - a high-performance, language-independent Valkey client library with a Rust core and Node.js wrapper.
Component | Status | Test Coverage | Production Use |
---|---|---|---|
Valkey Data Types | β Production Ready | String (37), Hash (13), List (16), Set (19), ZSet (14) | Core operations validated |
ValkeyJSON Module | β Production Ready | 29 commands tested | Document storage ready |
Bull/BullMQ Integration | β Production Ready | 10/10 integration tests | Job queues validated |
Express Sessions | β Production Ready | 10/10 session tests | Web apps validated |
Socket.IO | β Production Ready | 7/7 real-time tests | Live apps validated |
Connection Management | β Production Ready | 24 pipeline tests | Enterprise ready |
Cluster Support | π§ Minor Issues | Core functionality works | TypeScript edge cases |
- All Valkey Data Types: String, Hash, List, Set, ZSet operations - fully functional
- Bull/BullMQ Job Queues: Complete integration - production ready
- Express Sessions: Session storage with connect-redis - production ready
- Socket.IO Real-time: Cross-instance messaging - production ready
- JSON Document Storage: 29 ValkeyJSON commands - production ready
- Cluster Operations: Core functionality works, some TypeScript edge cases
- Complex Lua Scripts: Basic scripts work, some advanced patterns need refinement
- Enhanced ZSET Operations: Some WITHSCORES result formatting edge cases
- Pure GLIDE Architecture: Built exclusively on Valkey GLIDE APIs (no ioredis dependency)
- High Performance: Leverages GLIDE's Rust core for optimal performance
- TypeScript Ready: Full type safety with comprehensive interfaces
- Zero Migration: Change import statement only - your existing code works
Complete compatibility with job queue libraries - no code changes required:
import { Redis } from 'valkey-glide-ioredis-adapter';
import Bull from 'bull';
// BullMQ compatibility with createClient factory
const redis = Redis.createClient('client', { host: 'localhost', port: 6379 });
// Works with Bull directly
const queue = new Bull('email', {
redis: { host: 'localhost', port: 6379 }
});
// Custom Lua scripts work via defineCommand
redis.defineCommand('customLua', {
lua: 'return redis.call("set", KEYS[1], ARGV[1])',
numberOfKeys: 1
});
// Blocking operations for job processing
const job = await redis.brpop('job:queue', 10);
npm install valkey-glide-ioredis-adapter
Requirements:
- Node.js 18+ (ES2022 support)
- Valkey 6.0+ or Redis 6.0+ server
- TypeScript 4.5+ (for TypeScript projects)
import { Redis } from 'valkey-glide-ioredis-adapter';
// Create Redis client (ioredis-compatible)
const redis = new Redis({
host: 'localhost',
port: 6379
});
// Use ioredis API with Valkey GLIDE backend
await redis.set('key', 'value');
const value = await redis.get('key');
// ZSET operations with proper result translation
const members = await redis.zrange('myset', 0, -1, 'WITHSCORES');
// Stream operations using native GLIDE methods
await redis.xadd('mystream', '*', 'field', 'value');
const messages = await redis.xread('STREAMS', 'mystream', '0');
// Works with all ioredis constructors
const redis1 = new Redis(6379); // port only
const redis2 = new Redis(6379, 'localhost'); // port, host
const redis3 = new Redis('redis://localhost:6379'); // URL
Store and query JSON documents natively with full RedisJSON v2 compatibility:
import { Redis } from 'valkey-glide-ioredis-adapter';
const redis = new Redis({ host: 'localhost', port: 6379 });
// Store JSON documents
await redis.jsonSet('user:123', '$', {
name: 'John Doe',
age: 30,
address: {
city: 'San Francisco',
country: 'USA'
},
hobbies: ['programming', 'gaming']
});
// Query with JSONPath
const name = await redis.jsonGet('user:123', '$.name');
const city = await redis.jsonGet('user:123', '$.address.city');
// Update specific paths
await redis.jsonNumIncrBy('user:123', '$.age', 1);
await redis.jsonArrAppend('user:123', '$.hobbies', 'reading');
// Array operations
const hobbyCount = await redis.jsonArrLen('user:123', '$.hobbies');
const removedHobby = await redis.jsonArrPop('user:123', '$.hobbies', 0);
29 JSON Commands Available: Complete ValkeyJSON/RedisJSON v2 compatibility with jsonSet
, jsonGet
, jsonDel
, jsonType
, jsonNumIncrBy
, jsonArrAppend
, jsonObjKeys
, jsonToggle
, and more!
Use valkey-bundle for testing JSON functionality:
# Start valkey-bundle with JSON module
docker-compose -f docker-compose.valkey-bundle.yml up -d
# Test JSON functionality
npm test tests/unit/json-commands.test.mjs
# Clean up
docker-compose -f docker-compose.valkey-bundle.yml down
See TESTING-VALKEY-MODULES.md for complete testing guide.
We've validated our adapter against 19 real-world usage patterns found in production applications across GitHub and Stack Overflow. All tests pass, proving true drop-in compatibility:
Pattern Category | Examples | Status |
---|---|---|
Basic Operations | String operations, complex operations with WITHSCORES |
β Validated |
Hash Operations | Object-based hset , individual operations, analytics |
β Validated |
Bull Queue Integration | Job serialization, configuration patterns | β Validated |
Session Store | Express sessions with TTL, user data storage | β Validated |
Caching Patterns | JSON serialization, cache miss/hit patterns | β Validated |
Analytics & Counters | Page views, user activity tracking | β Validated |
Task Queues | List-based queues with lpush /rpop |
β Validated |
Rate Limiting | Sliding window with sorted sets | β Validated |
Pub/Sub | Channel subscriptions and publishing | β Validated |
Error Handling | Connection resilience, type mismatches | β Validated |
// All these real-world patterns work without any code changes:
// 1. Bull Queue Pattern (from production configs)
const redis = new Redis({ host: 'localhost', port: 6379 });
// Works with Bull without any modifications
// 2. Express Session Pattern
await redis.setex('sess:abc123', 1800, JSON.stringify(sessionData));
// 3. Complex Operations (from ioredis examples)
await redis.zadd('sortedSet', 1, 'one', 2, 'dos');
const result = await redis.zrange('sortedSet', 0, 2, 'WITHSCORES'); // β
Works perfectly
// 4. Caching Pattern with JSON
await redis.setex(cacheKey, 3600, JSON.stringify(userData));
const cached = JSON.parse(await redis.get(cacheKey));
// 5. Rate Limiting Pattern
await redis.zadd(`rate_limit:${userId}`, Date.now(), `req:${Date.now()}`);
await redis.zremrangebyscore(key, 0, Date.now() - 60000);
π Patterns Sourced From:
- GitHub repositories with 1000+ stars
- Stack Overflow top-voted solutions
- Production applications from major companies
- Popular Redis library documentation examples
π§ͺ Run Validation Tests:
npm test tests/integration/real-world-patterns.test.ts
- Native GLIDE Methods: Uses GLIDE's optimized implementations instead of generic Redis commands
- Result Translation: Efficient conversion between GLIDE's structured responses and ioredis formats
- Type Safety: Leverages GLIDE's TypeScript interfaces for better development experience
- Rust Core: Benefits from GLIDE's high-performance Rust implementation
- π Migration Guide: Zero-code migration from ioredis
- π Compatibility Matrix: Complete compatibility validation results
- Pub/Sub Guide: Comprehensive guide to both pub/sub patterns
- Development Rules: Pure GLIDE development principles
- API Migration: Detailed mapping from ioredis to GLIDE
# Core Valkey Operations (All Pass)
npm test tests/unit/string-commands.test.mjs # String ops: 37 tests β
npm test tests/unit/hash-commands.test.mjs # Hash ops: 13 tests β
npm test tests/unit/list-commands.test.mjs # List ops: 16 tests β
npm test tests/unit/set-commands.test.mjs # Set ops: 19 tests β
npm test tests/unit/zset-commands.test.mjs # ZSet ops: 14 tests β
# Advanced Modules (All Pass)
npm test tests/unit/json-commands.test.mjs # JSON documents: 29 tests β
npm test tests/unit/stream-commands.test.mjs # Stream ops: 15 tests β
npm test tests/unit/script-commands.test.mjs # Lua scripts: 12 tests β
npm test tests/unit/transaction-commands.test.mjs # Transactions: 3 tests β
# Real-World Integrations (All Pass)
npm test tests/integration/bullmq/ # Job queues: Bull/BullMQ β
npm test tests/integration/socketio/ # Real-time: Socket.IO β
npm test tests/integration/session-store/ # Sessions: Express/connect-redis β
What This Means for You:
- β Immediate Use: Drop-in replacement for most common ioredis use cases
- β Battle Tested: Major server libraries (Bull, Socket.IO, sessions) validated
- β Enterprise Ready: Connection management, transactions, pipelines work
- π§ Minor Gaps: Some advanced edge cases being refined (non-blocking)
# Test your specific use case
npm test -- --testNamePattern="your-pattern" # Run targeted tests
npm test tests/integration/ # Test all integrations
// Before (ioredis)
import Redis from 'ioredis';
const redis = new Redis({ host: 'localhost', port: 6379 });
// After (GLIDE adapter) - Just change the import!
import { Redis } from 'valkey-glide-ioredis-adapter';
const redis = new Redis({ host: 'localhost', port: 6379 });
// All your existing code works without changes:
await redis.set('key', 'value');
await redis.hset('hash', 'field', 'value');
await redis.zadd('zset', 1, 'member');
const results = await redis.zrange('zset', 0, -1, 'WITHSCORES');
// Bull queues work without changes:
const queue = new Bull('email', { redis: { host: 'localhost', port: 6379 } });
// Express sessions work without changes:
app.use(session({
store: new RedisStore({ client: redis }),
// ... other options
}));
import { Cluster } from 'valkey-glide-ioredis-adapter';
// Cluster client (ioredis-compatible constructor)
const cluster = new Cluster([
{ host: '127.0.0.1', port: 7000 },
{ host: '127.0.0.1', port: 7001 },
{ host: '127.0.0.1', port: 7002 }
], {
// Cluster options
redirection: 'follow',
retryDelayOnFailover: 100
});
// Works with Bull cluster
const clusterQueue = new Bull('cluster-jobs', {
createClient: (type) => Cluster.createClient(type, {
nodes: [/* cluster nodes */]
})
});
Application Code
β
ioredis API
β
Parameter Translation
β
Native GLIDE Methods
β
Result Translation
β
ioredis Results
src/
βββ BaseClient.ts # Core GLIDE client wrapper
βββ Redis.ts # ioredis-compatible Redis class
βββ Cluster.ts # ioredis-compatible Cluster class
βββ StandaloneClient.ts # Standalone-specific implementation
βββ ClusterClient.ts # Cluster-specific implementation
βββ utils/ # Translation and utility functions
This project follows pure GLIDE principles:
- Use only GLIDE APIs
- Implement custom logic when needed
- Maintain ioredis compatibility through translation
- Comprehensive testing required
Apache-2.0 License - see LICENSE file for details.
- Valkey GLIDE - The underlying high-performance Rust-based client that powers this adapter
- ioredis - The original Redis client whose API we maintain full compatibility with
- Bull - Redis-based queue for Node.js, fully compatible
- BullMQ - Modern Redis-based queue with advanced features
- Bee Queue - Simple, fast, robust job/task queue for Node.js
- connect-redis - Redis session store for Express/Connect
- express-rate-limit - Rate limiting middleware for Express
- socket.io-redis-adapter - Socket.IO adapter for horizontal scaling
- ValkeyJSON - JSON document storage and manipulation module
- Valkey - High-performance server with module support