TypeScript-first retry library with concurrency control, request prioritization, token refresh, response caching, and circuit breaker — as composable plugins.
npm install axios-retryer Most retry helpers stop at "try again after a delay." Real apps need more.
maxConcurrentRequests to cap parallel traffic. Excess requests queue automatically with optional per-request priorities.onMetricsUpdated events for dashboards and alerting.
Wrap your Axios instance, add plugins, make requests. The axiosInstance property is a drop-in replacement for your existing Axios usage.
import { createRetryer } from 'axios-retryer';
import { createTokenRefreshPlugin } from 'axios-retryer/plugins/TokenRefreshPlugin';
import { createCircuitBreaker } from 'axios-retryer/plugins/CircuitBreakerPlugin';
// Chain .use() so TypeScript merges plugin events on `retryer`
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,
}),
);
// Use exactly like Axios
const { data } = await retryer.axiosInstance.get('/api/users'); Each plugin is a separate tree-shakeable entry point. The core stays lean.
| Feature | axios-retryer | axios-retry | retry-axios |
|---|---|---|---|
| Automatic & Manual Modes | ✅ Both | ❌ Auto only | ❌ Auto only |
| Concurrency Control | ✅ Yes | ❌ No | ❌ No |
| Priority Queue | ✅ CRITICAL→LOW | ❌ No | ❌ No |
| Token Refresh Plugin | ✅ Built-in | ❌ Manual | ❌ Manual |
| Circuit Breaker | ✅ Built-in | ❌ No | ❌ No |
| Response Caching | ✅ Built-in | ❌ No | ❌ No |
| Cancellation | ✅ Full | ❌ No | ❌ No |
| Plugin Architecture | ✅ Yes | ❌ No | ❌ No |
| Metrics & Observability | ✅ Rich | ⚠️ Basic | ⚠️ Basic |
| TypeScript Support | ✅ First-class | ⚠️ Basic | ⚠️ Basic |
| Tree-Shakeable | ✅ Yes | ❌ No | ❌ No |
Install in seconds. Add the plugins that make sense for your app.