axios
v1.7.9MITTS ReadyPromise based HTTP client for the browser and node.js with automatic JSON transformation and request interception.
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.
- β’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
- β’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
Large enterprise SPAs requiring complex auth refresh interceptors, Legacy Node.js backends needing standard request wrappers, Teams migrating legacy projects without wanting API rewrites
Edge runtime or serverless functions where cold boot and bundle size matter, Modern frontend apps where ky or native fetch suffices
npm install axiosimport 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);