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

@qbit-labs/super-axios

v1.0.7

Published

A lightweight Axios wrapper with server-side caching using Redis. Enterprise-grade caching for Node services.

Downloads

32

Readme

@qbit-labs/super-axios

npm version npm license

A lightweight wrapper around Axios with server-side caching backed by Redis. Designed for Node services and enterprise workloads where a single authoritative cache (Redis) is preferred.


✨ Features

  • Drop-in replacement for Axios (all axios features still available)
  • 📦 Smart caching: caches responses automatically by URL + payload
  • 🔑 Custom cache keys for finer control
  • 🗄️ Storage: Redis (server-side)
  • ⏱️ Configurable stale times: control how long cached data stays fresh
  • 🚀 Works with GET, POST, DELETE, PUT, etc.

📊 Performance Benchmark

Super-Axios drastically improves response times on repeated requests compared to raw Axios.

Super-Axios Performance

| Network Speed | Without Cache (Axios) | With Cache (Super-Axios) | Improvement | |---------------|------------------------|---------------------------|-------------| | Fast 4G | ~250ms | ~20ms | 🚀 ~92% faster | | 3G | ~1200ms | ~30ms | 🚀 ~97% faster | | Slow Internet (1Mbps) | ~3000ms | ~50ms | 🚀 ~98% faster |


Key Notes

  • Without cache → Every request goes to the server, causing delays especially on slower networks.
  • With cache → Subsequent requests for the same key are served instantly from Redis cache.
  • Use Case: Ideal for apps where repeated data fetching occurs (e.g., user profiles, product lists).

📦 Installation

pnpm install @qbit-labs/super-axios

Or with npm/yarn:

npm install @qbit-labs/super-axios
# or
yarn add @qbit-labs/super-axios

⚙️ Usage (server / Node)

import axios from "axios";
import { createSuperAxios } from "@qbit-labs/super-axios";

// Create a super-axios instance backed by Redis
const api = await createSuperAxios(axios, {
  storage: { type: "redis", redisUri: "redis://127.0.0.1:6379" },
  defaultCacheOptions: {
    useCache: true,
    staleTime: 5 * 60 * 1000, // 5 minutes
  },
});

📘 Examples

1. GET request with cache

const response = await api.get("https://jsonplaceholder.typicode.com/todos/1", {
  cacheOptions: {
    useCache: true,
    staleTime: 10000, // 10 seconds
  },
});

console.log(response);

2. POST request with custom cache key

const response = await api.post(
  "https://jsonplaceholder.typicode.com/posts",
  {
    title: "foo",
    body: "bar",
    userId: 1,
  },
  {
    cacheOptions: {
      useCache: true,
      staleTime: 10000, // 10 seconds
      key: "custom-post-key", // cache key override
    },
  }
);

console.log(response);

3. DELETE request with caching

const response = await api.delete(
  "https://jsonplaceholder.typicode.com/posts/1",
  {
    cacheOptions: {
      useCache: true,
      staleTime: 10000,
    },
  }
);

console.log(response);

4. Permanent caching (never stale)

const response = await api.get("https://jsonplaceholder.typicode.com/todos/1", {
  cacheOptions: {
    useCache: true,
    staleTime: -1, // never expires
  },
});

console.log(response);

⚡ Cache Options

Each request supports a cacheOptions field:

| Option | Type | Default | Description | |-------------|---------|-----------|-------------| | useCache | boolean | false | Whether to use caching for this request | | staleTime | number | 300000 (5 min) | How long (in ms) the cached data is valid. Use -1 for never stale | | key | string | auto-generated (url+payload) | Custom cache key |


🔧 API

createSuperAxios(axiosInstance, options)

Parameters:

  • axiosInstance: Your axios instance (or axios directly).
  • options:
    • storage: { type: "redis", redisUri: string }
    • defaultCacheOptions: { useCache?: boolean; staleTime?: number }

Returns:

A super-axios instance with all axios methods (get, post, put, delete, etc.) + caching.


🔄 Revalidation (optional)

If you need to force refresh the cache manually:

await api.revalidate("custom-post-key");

🗑️ Cleanup (optional)

If you need to force clear the cache manually:

await api.clear();

✅ Summary

  • Install with pnpm install @qbit-labs/super-axios
  • Create a wrapper with createSuperAxios
  • Use cacheOptions to control per-request caching
  • Works the same as axios but faster with caching