Skip to main content

Built and signed on GitHub Actions

Fast, lightweight Redis client built upon the Web Streams API.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
4 weeks ago (1.1.1)

@iuioiua/redis

JSR CI

Minimal Redis client for all major JavaScript runtimes, including the browser. Fast, lightweight and built upon the Streams API.

import { RedisClient } from "@iuioiua/redis";
import { assertEquals } from "@std/assert/equals";

const redisConn = await Deno.connect({ port: 6379 });
const redisClient = new RedisClient(redisConn);

const reply1 = await redisClient.sendCommand(["SET", "hello", "world"]);
assertEquals(reply1, "OK");

const reply2 = await redisClient.sendCommand(["GET", "hello"]);
assertEquals(reply2, "world");

Features

  • Capable of handling 1000s of requests per second.
  • More than 12x smaller than the next major Redis client in Deno.
  • Supports RESPv2, RESP3, raw data, pipelining, pub/sub, transactions and Lua scripts.
  • Compatible with all major JavaScript runtimes including Bun, Cloudflare Workers, Deno, Node.js and the browser!
  • Cleanly written to be easily understood and debugged.
  • Compatible with timeouts and retries.
  • Encourages the use of actual Redis commands without intermediate abstractions, resulting in fewer moving parts.

Resources

Known issues

Replies containing CRLF

This package currently doesn't correctly read replies that contain CRLF (\r\n) within the message. For example, if a bulk string contains a CRLF, it'll only return the message, up to that CLRF. The simple workaround for this is to use LF (\n) for delimiting newlines, instead of CRLF.

If this issue affects you, please open a new issue. Otherwise, this issue is a "won't fix".

Design

Like Italian cooking, the design of this package is defined by what it doesn't do rather than what it does do, and relies upon high-quality building blocks. It doesn't extend the functionality of a TCP connection. It doesn't implement a method for each Redis command, of which there are hundreds. Instead, the Redis client consumes a TCP connection, lets the user write Redis commands, and returns the parsed result according to the RESP data type. The result is a design with fewer moving parts, fewer bugs, less maintenance, and a smaller footprint than other JavaScript implementations of Redis clients.

Module Size (KB) Dependencies
jsr:@iuioiua/redis 17.51 3
jsr:@db/redis 214.31 34
npm:ioredis 894.69 10
npm:redis 951.12 9

Note: Results were produced const deno info <module> on March 9, 2025.

Built and signed on
GitHub Actions
View transparency log

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@iuioiua/redis

Import symbol

import * as redis from "@iuioiua/redis";
or

Import directly with a jsr specifier

import * as redis from "jsr:@iuioiua/redis";

Add Package

pnpm i jsr:@iuioiua/redis
or (using pnpm 10.8 or older)
pnpm dlx jsr add @iuioiua/redis

Import symbol

import * as redis from "@iuioiua/redis";

Add Package

yarn add jsr:@iuioiua/redis
or (using Yarn 4.8 or older)
yarn dlx jsr add @iuioiua/redis

Import symbol

import * as redis from "@iuioiua/redis";

Add Package

npx jsr add @iuioiua/redis

Import symbol

import * as redis from "@iuioiua/redis";

Add Package

bunx jsr add @iuioiua/redis

Import symbol

import * as redis from "@iuioiua/redis";