npmbot.com
AI

axios

v1.7.9MITTS Ready

Promise based HTTP client for the browser and node.js with automatic JSON transformation and request interception.

92/ 100
Excellent Health
Weekly Downloads
48.5M
Bundle Size (gzip)
11.8 kB(34.2 kB min)
Dependencies
3 direct
Last Updated
2024-12-10
SPONSORED CLOUD & DEV TOOLSβ€’Google Ads Partner
NPMBot AI Assessment

The battle-tested king of HTTP requests, but heavy for modern ESM and Edge workloads.

Axios remains the most ubiquitous HTTP client across JavaScript ecosystems. Its request interceptors, automatic error handling, and cross-platform support are unmatched in stability. However, for modern greenfield apps with native fetch, its ~11kB gzipped footprint and lack of granular tree-shaking make it sub-optimal compared to ky or native fetch.

Key Advantages
  • β€’Rock-solid request & response interceptor pipelines
  • β€’Automatic JSON request body serialization and response parsing
  • β€’Wide compatibility with older Node.js versions and legacy browsers
  • β€’Universal error format with built-in timeout handling
Gotchas & Limitations
  • β€’Noticeable bundle size overhead (~11.8 kB gzipped) compared to ky (~3.5 kB)
  • β€’Not tree-shakeable; imports the full client even for basic GET requests
  • β€’Redundant on modern Node 18+ and edge environments that provide native Fetch
Recommended For:

Large enterprise SPAs requiring complex auth refresh interceptors, Legacy Node.js backends needing standard request wrappers, Teams migrating legacy projects without wanting API rewrites

Avoid If:

Edge runtime or serverless functions where cold boot and bundle size matter, Modern frontend apps where ky or native fetch suffices

FEATURED PARTNERβ€’Google Ads Partner
Installation & Quickstart
Package Manager Command
javascript
npm install axios
axios Usage Example
javascript
import axios from 'axios';

const { data } = await axios.get('https://api.github.com/users/octocat', {
  headers: { 'Accept': 'application/vnd.github.v3+json' },
  timeout: 5000
});
console.log(data.name);
Compare axios with Alternatives