Open-source project
axios/axios avatar
axios/axios

Axios 1.21: The HTTP Client That Keeps Its Promise API, and Its Trade-Offs

Promise based HTTP client for the browser and node.js

109,389 stars12,019 forksJavaScriptMIT

At a glance

What is it?
Axios is a widely used Promise-based HTTP client for browsers and Node.js. This review covers its core mechanism, setup, real limitations, and where it fits against alternatives like fetch.
Who is it for?
Adopt Axios if you need a battle-tested, Promise-based HTTP client with broad browser support, interceptors, and a consistent API across Node and the browser. Skip it if you are on a modern runtime where native fetch suffices, or if you want to minimize dependencies.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly JavaScript, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • axios/axios109,389 ★ · +231
Star history
Repository2026-07-282026-11-13
axios/axios109.2k109.4k

231 Stars in the last 108 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The Problem Axios Solves: HTTP Without the Boilerplate

Axios solves a specific annoyance: making HTTP requests in JavaScript without repeating the same setup code. In a browser, you have XMLHttpRequest and, more recently, fetch. In Node.js, you have http and https modules. Each has its own quirks. Axios wraps these into a single Promise-based interface. The project's own description calls it a 'Promise based HTTP client for the browser and node.js'. That is the core value. It is for developers who want one API for both environments, with features like request and response interception, automatic JSON transformation, and cancellation. It is not for people who want the absolute smallest bundle or who are happy to write their own fetch wrappers. Axios is a convenience layer, and it has been around long enough that many teams treat it as the default choice.

How Axios Works: The Adapter and the Promise Chain

Axios does not reinvent HTTP. It builds on existing transports. In the browser, it uses XMLHttpRequest under the hood. In Node.js, it uses the http and https modules. This is visible in the repository layout, which includes separate adapters for each environment. The key mechanism is the adapter pattern. You call axios.get('/api') or axios.post('/data', payload). Axios then picks the right adapter based on the environment, makes the actual network call, and returns a Promise. That Promise resolves with a response object that has data, status, headers, config, and request properties. The rejection path gives you an error object with a response property if the server replied with a non-2xx status. This uniform shape is what makes Axios predictable. Interceptors sit between your call and the adapter. They let you modify request config before it is sent and transform the response before it reaches your code. The documentation shows this as a chain: request interceptors, then the adapter, then response interceptors. This is a simple, linear flow, and it is the reason Axios is easy to reason about.

Getting Started: Install, Import, and First Request

Installation is a single command. The package is on npm, so you would run npm install axios. The standard import is const axios = require('axios') in CommonJS or import axios from 'axios' in ES modules. A minimal request looks like this: axios.get('/user?ID=12345').then(function (response) { console.log(response.data); }).catch(function (error) { console.log(error); }). That is the classic pattern. You can also use async/await. The config object is where the power lies. You can set baseURL, timeout, headers, params, and transformRequest. For example, axios.create({ baseURL: 'https://api.example.com', timeout: 1000 }) returns an instance with those defaults. The homepage axios-http.com hosts the documentation. The repository has a v1.x branch, and the latest 1.x release is v1.21.0, which suggests the API has been stable for a long time. You can also use axios.all for concurrent requests, though Promise.all is the modern equivalent.

A Real Limitation: The Browser Dependency and the Bundle Size

Axios is not a zero-cost abstraction. In the browser, it relies on XMLHttpRequest, which is older than fetch. That has implications. For one, streaming responses is not as natural as with fetch's ReadableStream. Axios does support progress events, but the underlying XHR model is less flexible for things like server-sent events or large binary streams. Another limitation is bundle size. Axios is not tiny. Browser builds swap the Node http adapter for a null helper (package.json browser field), but the XHR adapter and utility functions still ship. If you are building a small front-end and only need GET requests, you are paying for features you do not use. This is a case where the wrong tool is a minimal API client. If your only job is to fetch JSON from a single endpoint, native fetch is lighter and built into every modern browser and Node.js 18 and later. Axios shines when you need interceptors, cancellation, or consistent error handling across many requests, not for a one-off call.

The Alternative: Native fetch and Its Different Approach

The direct alternative is the Fetch API, which is now standard in browsers and Node.js (since version 18). Fetch is Promise-based too, but it takes a different approach. It is a lower-level API. You get a Response object and must call res.json() or res.text() yourself. Error handling is different: fetch only rejects on network failure, not on HTTP error status. You have to check res.ok and throw your own error. Axios, by contrast, rejects on non-2xx status by default. That is a real difference in behavior. Fetch also has no built-in interceptors, and cancelling a request goes through an AbortController, which is more verbose than Axios's CancelToken (though Axios also supports AbortController in recent versions). The trade-off is that fetch is native, has zero install cost, and is actively maintained by the platform. Axios is a third-party dependency that you must update. For teams that want a consistent API across many projects and do not mind the dependency, Axios is convenient. For teams that prefer platform primitives and are comfortable writing a small wrapper, fetch is the leaner choice.

Maintenance and Upgrade Cost: What the Release History Shows

The repository shows an active maintenance cadence. The most recent releases are v0.35.0 on 2026-11-02, v1.21.0 on 2026-10-26 and v0.34.0 on 2026-09-13, so the older 0.x line is still being released as well. This is a project that is still being updated. The default branch is v1.x, which means the maintainers are committed to the 1.x line. For users, this means upgrades are frequent but likely minor. The README does not detail breaking changes, but the version number staying at 1.x suggests API stability. The license is MIT, which is permissive and allows commercial use. The maintenance cost for you is the need to track these releases, read changelogs, and test your code against new versions. There is also the sponsor situation. The README is full of sponsor blocks, including 'Platinum sponsors' and 'Gold sponsors'. That is a sign of a project that relies on corporate funding. It is not a negative, but it means the project's direction can be influenced by sponsors. You should verify that the features you depend on are not deprecated in the next minor release.

When Axios Is the Wrong Tool: Cases That Expose Its Limits

Axios is the wrong tool in several specific scenarios. First, if you are building a library that will be bundled for many users, adding Axios as a dependency increases the payload. A library author might prefer to use fetch and let the consumer decide. Second, if you need to handle streaming responses, such as large file downloads with progress, Axios works but fetch's ReadableStream is more direct. Another failure mode is error handling. Axios's default rejection on HTTP errors can be surprising if you expect a resolved promise with a status code. Some developers find this convenient, others fight it. It is a design choice that you must accept. If you prefer a more functional style, a library like ky (built on fetch) might suit you better. Ky has a similar API but uses fetch under the hood.

Editorial conclusion

Adopt Axios if you need a battle-tested, Promise-based HTTP client with broad browser support, interceptors, and a consistent API across Node and the browser. Skip it if you are on a modern runtime where native fetch suffices, or if you want to minimize dependencies. Before adopting, verify that the version you pin (e.g., 1.21.0) matches your Node.js version and that you are comfortable with the ongoing maintenance cadence, which shows regular releases.

Frequently asked questions

What is Axios used for?

It is a promise based HTTP client for the browser and node.js, published as the npm package axios. The repository describes it in exactly those terms and points its homepage field at axios-http.com.

how to install axios

The package name is axios, so the usual command is `npm install axios`. The package metadata names main as ./dist/node/axios.cjs, module as ./index.js, and serves dist/axios.min.js through jsdelivr and unpkg.

how to use axios.post

The examples directory ships separate folders for get, post, upload and postMultipartFormData, each with its own entry, so the post and multipart call shapes are meant to be read from those files.

how to use axios in react native

The export map defines a react-native condition that sends require to ./dist/browser/axios.cjs and default to ./dist/esm/axios.js, so React Native receives the browser build rather than a native one.

how to use axios in react

The package.json exposes a browser condition that sends require to ./dist/browser/axios.cjs and default to ./index.js, alongside a browser field that maps ./lib/adapters/http.js to ./lib/helpers/null.js.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community

Where developers are discussing it

Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 1 in the last 30 days; newest first.

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/axios-axios.svg)](https://hysenlabs.com/projects/axios-axios)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/axios-axios.svg)](https://hysenlabs.com/projects/axios-axios)

Was this useful?