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 🙏

© 2025 – Pkg Stats / Ryan Hefner

redicrate

v1.0.0

Published

Redis Client to reduce duplicate API calls

Downloads

3

Readme

Redicrate

Ready 2 Go Redis client for small NodeJS applications that limits repetitive API calls.

Installation & Usage

Installation

Install using NPM.

npm i redicrate

The package is currently available only on NPM Registry .

Usage

const crate = require('redicrate')
const query = '<Your API Query goes here>'
const url = '<The Complete URL of the Resource you are fetching>'

async function doSomething(){
    // Let the magic happen!
    const data = await crate(url, query)
    // The data is fetched in JSON format. Do whatever you want in function scope.
}

Using async/await is necessary. You'll get a pending Promise instead of the data if you don't use that syntax.

The query needs to be passed separately because it acts as a key to access value from the key-value store.

See an Example

I am using the Studio Ghibli API. The controller module defined below will respond with the film details when provided the id. It won't call the API on repetitive similar requests.

So if 2 users are both searching for the same film, you call the API only once. The next time, cached data is sent back to the user. Using a cache is significantly faster than calling an API.

const express = require('express')
const app = express()

const crate = require('redicrate')

// Defining the GET Route using Express.
app.get('/:id', async (request, response, next) => {
    const query = request.params.id
    url = `https://ghibliapi.herokuapp.com/films/${query}`

    try {
        data = await crate(url, query)
        response.send(data)
    }
    catch (exception) {
        next(exception)
    }
})

Installing and Running a Redis Server

If you host your own backend then you'll need to install Redis and run it on a separate server.

On MacOS, assuming you have Homebrew installed:

brew install redis

This will install the redis-server and redis-cli needed to host your own Redis cluster.

For other platforms, see here: redis.io

To start a server, navigate to the folder where you want to store the data dumps and execute this:

redis-server

By default, the redis-server uses Port: 6379

You can use the redis-cli for testing or any other purposes when you don't want to use your backend. See the docs here: using redis-cli

Using Redis on Heroku

Heroku is a Platform-as-a-Service (PaaS) provider. You can host your backend there. It has add-ons for caching and many other things.

Get started quickly, head over to : heroku-redis to install the add-on.

After the add-on is configured, just install redicrate and you're good to go.

If you're on the NodeJS environment and have never used Heroku or other PaaS providers before, get started here.

Common Error

Something like this:

[ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)

This means that you are not running a redis server. Please see the above instructions on how to install and run a redis server.

Make sure that you're not using the same port for redis and your backend.

Project Dependencies

ioredis : A robust, performance-focused and full-featured Redis client for Node.js

bent : Functional JS HTTP client (Node.js & Fetch) w/ async await

Join in!

I'm happy to receive bug reports, fixes, documentation enhancements, and any other improvements. Raise an issue or mail me!