Skip to content

Installation

Install Benni and the Redis client used by the Node.js adapter:

Terminal window
pnpm add benni redis

Benni 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:

Terminal window
bun add benni

Benni has four optional peer dependencies, all opt-in; install one only when you import the subpath that needs it:

PeerNeeded byVersion
redisbenni/node^6.1.0
ioredisbenni/ioredis^5.0.0
honobenni/hono>=4.0.0
zodbenni/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:

Terminal window
pnpm add benni ioredis

Deno 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.

CI runs the integration suite against Redis 8 and an Upstash-REST-compatible endpoint. The other rows are verified manually against the same suite:

ServerCoverage
Redis 8Full surface.
Redis 7.4Everything except hsetex/hgetex/hgetdel (Redis 8 commands).
Redis 7.2Additionally no hash field TTLs (hexpire/httl/…, introduced in 7.4).
Valkey 8Same profile as Redis 7.2 (Valkey forked pre-7.4).
DragonflyThe 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:

Terminal window
pnpm redis:build
pnpm redis:run

Then point Benni at Redis:

const client = await node({
url: process.env.REDIS_URL ?? "redis://127.0.0.1:6379"
});