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

axios-retryer

v2.3.2

Published

TypeScript-first Axios retry library with concurrency limits, request priority, token refresh, response caching, and circuit breaker plugins.

Readme

npm version npm downloads codecov Known Vulnerabilities Build Gzipped Size TypeScript License: MIT



What is axios-retryer?

axios-retryer is a drop-in Axios retry manager for Node.js, React, and any TypeScript or JavaScript project. It solves the hard parts that ad hoc retry interceptors get wrong: concurrent token refresh without duplicate calls, ordered request queues under backpressure, circuit breaking on unstable upstreams, response caching, and pluggable observability — all with zero magic and full type safety.

Key capabilities:

| Feature | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------- | | 🔄 Intelligent retries | Automatic or manual retry modes, exponential / linear / static backoff, fully custom strategies | | 🚦 Priority queue | CRITICAL → LOW priorities, binary-heap scheduling, configurable concurrency cap | | 🔑 Token refresh | Queues concurrent 401s, refreshes once, replays all requests with the new token | | 🛡️ Circuit breaker | Trips on N failures, fast-fails during recovery window, sliding-window analysis | | 💾 Response caching | TTR-based in-memory cache, exact / prefix / regex invalidation, swappable storage adapters | | 📊 Metrics & events | Live retry counters, timer health, rich lifecycle event hooks | | 🌳 Tree-shakeable plugins | Each plugin is a separate entry point — unused code is never bundled |

Peer dependency: axios >= 1.7.4


Installation

npm install axios-retryer
# yarn add axios-retryer
# pnpm add axios-retryer

Quick Start

import { createRetryer } from 'axios-retryer';
import { createTokenRefreshPlugin } from 'axios-retryer/plugins/TokenRefreshPlugin';
import { createCircuitBreaker } from 'axios-retryer/plugins/CircuitBreakerPlugin';

// Chain .use() on one expression so TypeScript merges each plugin's event types
const retryer = createRetryer({
  retries: 3,
  maxConcurrentRequests: 10,
})
  .use(
    createTokenRefreshPlugin(async (axios) => {
      const { data } = await axios.post('/auth/refresh');
      return { token: data.accessToken };
    }),
  )
  .use(createCircuitBreaker({ failureThreshold: 5, openTimeout: 30_000 }));

// Drop-in replacement for your existing axios instance
const { data } = await retryer.axiosInstance.get('/api/users');

Try it: Interactive sandbox (browser, mocked HTTP)


Plugins

Import only what your application needs. Each plugin is independently tree-shakeable:

| Plugin | Import path | Purpose | | ------------------------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | TokenRefreshPlugin | axios-retryer/plugins/TokenRefreshPlugin | Auth token refresh on 401; optional per-request opt-out | | CircuitBreakerPlugin | axios-retryer/plugins/CircuitBreakerPlugin | Fail-fast on repeated upstream failures | | CachingPlugin | axios-retryer/plugins/CachingPlugin | In-memory response cache with TTR invalidation | | ManualRetryPlugin | axios-retryer/plugins/ManualRetryPlugin | Store failed requests and replay on reconnect | | MetricsPlugin | axios-retryer/plugins/MetricsPlugin | Live retry counters and lifecycle events | | DebugSanitizationPlugin | axios-retryer/plugins/DebugSanitizationPlugin | Redact secrets from debug logs |


Behavior notes

  • Retry-After header support. When a response carries a Retry-After header (numeric seconds or HTTP-date), it overrides the computed backoff delay for that retry. The honored value is capped at 5 minutes to prevent runaway waits.
  • Backoff cap. All backoff strategies (static, linear, exponential) are capped at 60 seconds by default. Override via the maxBackoffDelayMs option on RetryManagerOptions.

How axios-retryer Compares

| Feature | axios-retryer | axios-retry | retry-axios | | ------------------------------ | :-----------: | :---------: | :---------: | | Automatic & Manual retry modes | ✅ | ❌ | ❌ | | Concurrency control | ✅ | ❌ | ❌ | | Priority queue | ✅ | ❌ | ❌ | | Token refresh (401 handling) | ✅ | ❌ | ❌ | | Circuit breaker | ✅ | ❌ | ❌ | | Response caching | ✅ | ❌ | ❌ | | Request cancellation | ✅ | ❌ | ❌ | | Plugin architecture | ✅ | ❌ | ❌ | | TypeScript-first | ✅ | ⚠️ | ⚠️ | | Tree-shakeable | ✅ | ❌ | ❌ |


Performance

Benchmarks from the current release (standard profile, local suite):

  • Healthy-path throughput (core scenario): 2,150 req/sec
  • Peak burst throughput (stress scenario): 4,285 req/sec
  • Cache hit rate: 100% (integration + hot-read scenarios)
  • Test suite: 117 suites · 1414 tests (pnpm test:run); use pnpm test:quick for a faster local run (~75 suites, skips integration, performance, and package-contract)

See BENCHMARK_RESULTS.md for full methodology and raw numbers.


Documentation

Full API reference, all plugin options, guides, and migration notes:

https://samplexbro.github.io/axios-retryer


Contributing

Bug reports, feature ideas, and pull requests are welcome. See CONTRIBUTING.md for guidelines.

License

MIT — see LICENSE.