Redis
The Redis driver enables deploying scalable Rivet Actors using Redis as the backend for state management and inter-actor communication.
The Redis driver is currently in preview. We do not recommend shipping production applications with the Redis driver yet.
If you want to take Redis to production, contact us so we can help validate your setup is production ready and help resolve issues promptly.
Feature Support
Feature | Supported |
---|---|
Horizontal scaling | Yes |
WebSockets | Yes |
SSE | Yes |
Edge | No |
Scheduling | Not yet |
Setup
Install packages
Install the required packages:
Configure the driver
Configure your application using environment variables:
Available Environment Variables:
REDIS_HOST
- Redis server hostname (default:localhost
)REDIS_PORT
- Redis server port (default:6379
)REDIS_PASSWORD
- Redis password (optional)REDIS_KEY_PREFIX
- Key prefix for isolation when running multiple projects (optional)
Then start your server:
To prevent data loss, ensure AOF (Append Only File) persistence is enabled on your Redis server. See the Redis Persistence Documentation for setup instructions.
Deploy
Deploy your Redis-powered actors on these hosting providers:
Examples
Redis + Hono
Example using Redis driver with Hono web framework.
Redis Basic
Basic Redis driver setup and configuration example.
Advanced
Driver Context
The Redis driver provides access to the underlying Redis connection through the driver context in createVars
.
The Redis driver context type is exported as DriverContext
from @rivetkit/redis
:
While you have access to the Redis client, be cautious when directly modifying keys under the keyPrefix
, as this may interfere with RivetKit's internal operations and potentially break actor functionality.