Registry / database / strapi-redis

strapi-redis

JSON →
library3.0.0-alpha.4.3jsnpmunverified

Redis hook for Strapi CMS that provides Redis integration for caching and session management. Current version is 3.0.0-alpha.4.3, targeting Strapi v3 alpha. This is an alpha release with active development. Key differentiator: official hook from the Strapi team, offering tight integration with Strapi's lifecycle hooks and configuration system. It allows developers to use Redis as a cache backend or session store with minimal setup.

npm install strapi-redis
INSTALL
IMPORT
SIG · STRAPI-REDIS
S
strapi-redis
databasejavascriptv3.0.0-alpha.4.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

strapi
strapi.redis
require('strapi-redis')
The hook is accessed via the global `strapi` object after loading. Not a direct module import.
config
module.exports = ({ env }) => ({ /* config */ })
module.exports = { /* config */ }
Strapi hooks require a function that returns the config object. This is a common mistake.

Shows enabling the Redis hook via config/hooks.js, configuring a default connection, and using ioredis methods via strapi.redis.

// 1. Install: npm install strapi-redis // 2. Create or update file: config/hooks.js with: module.exports = { redis: { enabled: true, config: { connections: { default: { connection: { host: '127.0.0.1', port: 6379, db: 0, }, }, }, }, }, }; // 3. Access Redis in your service: // In a service or controller: module.exports = { async example(ctx) { const redis = strapi.redis; await redis.set('key', 'value'); const value = await redis.get('key'); return value; }, };
Debug
Known issues
breakingThis is an alpha release for Strapi v3. API may change. Not for production.
fix
Wait for stable release or use strapi-redis v1.x for Strapi v1/v2.
affects: 3.0.0-alpha.x
deprecatedThe hook uses ioredis v4, which is deprecated. ioredis v5 has breaking changes.
fix
Upgrade to newer alpha or stable versions when available.
affects: >=3.0.0-alpha.0
gotchaThe hook is enabled via config/hooks.js, but config/hook.js (singular) may be used instead. Ensure correct file name.
fix
Use config/hooks.js (plural) with the correct structure.
affects: >=3.0.0-alpha.0
breakingConnection configuration must be nested under 'connections.default.connection', not flat. Incorrect config will silently fail.
fix
Use the exact nested structure shown in documentation.
affects: >=3.0.0-alpha.0
Errors
Common errors & fixes
Error: Cannot find module 'strapi-redis'
Missing npm install or not added as a hook in config/hooks.js
fix
Run 'npm install strapi-redis' and ensure the hook is enabled in config/hooks.js
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
Redis server not running or connection config incorrect
fix
Start Redis server or update host/port in config/hooks.js
Redis config not loaded
Config file missing or malformed
fix
Create config/hooks.js with exports as a function returning object with 'redis' key
Upgrade
Version history
3.0.0-alpha.4.3latest on npm
Audit
Dependencies
ioredisrequiredRedis client dependency required for Redis connections
Agent activity
32 hits · last 30 days
node
30
Meta
1
Resources
strapi-redis — npm install strapi-redis · libregistry