Installation
Install Benni and the Redis client used by the Node.js adapter:
pnpm add benni redisBenni is an ESM package. The primary imports are:
import { benni } from "benni";import { node } from "benni/node";import { hash, json, kv, number, string } from "benni/schema";The Node.js adapter uses the redis package (node-redis, the officially recommended Node client). Benni declares it as an optional peer dependency, so you install it alongside Benni only when you use benni/node. That keeps the install tiny for other runtimes. Bun is supported through Bun’s built-in Redis client and needs no extra package:
bun add benniBenni has four optional peer dependencies, all opt-in; install one only when you import the subpath that needs it:
| Peer | Needed by | Version |
|---|---|---|
redis | benni/node | ^6.1.0 |
ioredis | benni/ioredis | ^5.0.0 |
hono | benni/hono | >=4.0.0 |
zod | benni/zod | ^4.1.0 |
Already running ioredis? benni/ioredis gives the same
typed API and can adopt the client you already have, so adopting Benni is not a
client migration:
pnpm add benni ioredisDeno needs no separate adapter: it runs node-redis directly through npm compatibility, so Deno users import the Node adapter (npm:benni/node) and npm:redis. There is no benni/deno entrypoint: Benni ships one runtime-agnostic core plus thin client adapters, not per-runtime builds.
Server Compatibility
Section titled “Server Compatibility”CI runs the integration suite against Redis 8 and an Upstash-REST-compatible endpoint. The other rows are verified manually against the same suite:
| Server | Coverage |
|---|---|
| Redis 8 | Full surface. |
| Redis 7.4 | Everything except hsetex/hgetex/hgetdel (Redis 8 commands). |
| Redis 7.2 | Additionally no hash field TTLs (hexpire/httl/…, introduced in 7.4). |
| Valkey 8 | Same profile as Redis 7.2 (Valkey forked pre-7.4). |
| Dragonfly | The common surface works (kv, hashes, sets, lists, sorted sets, streams, geo, HyperLogLog, bitmaps, Pub/Sub, transactions, scripts); LCS, GEOSEARCHSTORE, and hash field TTLs are not implemented by Dragonfly. |
Everything else (streams, sorted sets, lmpop, sintercard, geo, bitfields) works from Redis 7.2 up.
Upstash and other serverless endpoints are covered through the HTTP adapter.
For local development, run Redis with Docker:
pnpm redis:buildpnpm redis:runThen point Benni at Redis:
const client = await node({ url: process.env.REDIS_URL ?? "redis://127.0.0.1:6379"});