npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

js-redis-server

v0.0.1

Published

In-memory Redis-compatible server implementation in JavaScript, useful for testing and client-agnostic mocks

Readme

js-redis-server

CI npm version npm downloads License: MIT Node.js Version

In-memory Redis-compatible server implementation in JavaScript. Useful for testing and development without requiring a real Redis instance.

Features

  • Redis-compatible protocol - Works with any Redis client (ioredis, node-redis, etc.)
  • Standalone and Cluster modes - Run a single server or a full cluster
  • Lua scripting support - Execute Redis Lua scripts via WebAssembly
  • No external dependencies - Pure JavaScript, no Redis installation needed
  • Dual package - Supports both ESM and CommonJS

Installation

npm install js-redis-server

Quick Start

As a Library

import { createCustomCommander, Resp2Transport } from 'js-redis-server'

const logger = {
  info: console.log,
  error: console.error,
}

const factory = await createCustomCommander(logger)
const transport = new Resp2Transport(logger, factory.createCommander())

await transport.listen(6379)
console.log('Redis server listening on port 6379')

// Cleanup
await transport.close()
await factory.shutdown()

As a CLI

# Run a single server on default port 6379
npx js-redis-server

# Run on a specific port
npx js-redis-server --port 6380

# Run a cluster with 3 masters
npx js-redis-server --cluster --masters 3

# Run a cluster with replicas
npx js-redis-server --cluster --masters 3 --slaves 1

CLI Options

Modes:
  --single               Run a single Redis server (default)
  --cluster              Run a Redis cluster
  --mode <single|cluster>

Single server options:
  --port <number>        Port to listen on (default 6379)

Cluster options:
  --masters <number>     Number of masters (default 3)
  --slaves <number>      Number of replicas per master (default 0)
  --base-port <number>   Starting port for cluster nodes (default 30000)

General:
  -h, --help             Show help

Cluster Mode

import { ClusterNetwork } from 'js-redis-server'

const logger = { info: console.log, error: console.error }
const cluster = new ClusterNetwork(logger)

await cluster.init({
  masters: 3,
  slaves: 1,
  basePort: 30000,
})

// Get all node addresses
const nodes = cluster.getAll()
console.log(nodes.map(n => `${n.host}:${n.port}`))

// Cleanup
await cluster.shutdown()

Supported Commands

Strings

GET, SET, MGET, MSET, MSETNX, APPEND, STRLEN, GETSET, INCR, INCRBY, INCRBYFLOAT, DECR, DECRBY

Hashes

HGET, HSET, HMGET, HMSET, HDEL, HEXISTS, HGETALL, HINCRBY, HINCRBYFLOAT, HKEYS, HLEN, HVALS

Lists

LPUSH, RPUSH, LPOP, RPOP, LLEN, LRANGE, LINDEX, LSET, LREM, LTRIM

Sets

SADD, SREM, SMEMBERS, SISMEMBER, SCARD, SPOP, SRANDMEMBER, SMOVE, SDIFF, SINTER, SUNION

Sorted Sets

ZADD, ZREM, ZSCORE, ZRANK, ZREVRANK, ZCARD, ZRANGE, ZREVRANGE, ZRANGEBYSCORE, ZREMRANGEBYSCORE, ZINCRBY

Keys

DEL, EXISTS, EXPIRE, EXPIREAT, TTL, PTTL, TYPE

Server

PING, QUIT, INFO, DBSIZE, FLUSHDB, FLUSHALL

Cluster

CLUSTER INFO, CLUSTER NODES, CLUSTER SLOTS, CLUSTER SHARDS

Scripting

EVAL, EVALSHA, SCRIPT LOAD

Client

CLIENT SETNAME

Requirements

  • Node.js >= 22

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Run integration tests (mock backend)
npm run test:integration:mock

# Run integration tests (real Redis)
npm run test:integration:real

# Run all tests
npm run test:all

Contributing

Contributions are welcome! Please read the contributing guidelines before submitting a pull request.

License

MIT - see LICENSE for details.