relaxios is axios 1.20.0, ported to TypeScript on native fetch, Web Streams, and AbortController. It has no dependencies. Installing axios 1.20.0 adds 27 packages, because it depends on follow-redirects, form-data, proxy-from-env, and https-proxy-agent. relaxios does that work itself.
It runs on Node 20.3 and later, Bun, Deno, Cloudflare Workers, and browsers from the last two years.
Four entries
| Entry | What it is |
|---|---|
relaxios/axios |
A drop-in replacement for axios 1.20.0, with the same API, types, and behavior. |
relaxios |
A 2 kB client with the axios shape (get, post, create, interceptors, timeout, signal) and fetch responses. |
relaxios/progress |
Download and upload progress for fetch, with the rate and the time left. |
relaxios/upload |
Chunked uploads that pause, resume, and retry, with progress the server confirms. |
Each entry is its own build. An app that imports only relaxios/axios ships only the port.
Checked against axios
A differential suite runs 445 cases against real axios 1.20.0 and against relaxios, and allows 0 differences in status, headers, data, error codes, and messages. It runs in Node, Bun, Deno, jsdom, Chromium, Firefox, WebKit, and Cloudflare’s workerd. axios’s own unit and browser suites and the axios-mock-adapter suite pass too, with no skipped tests.
The trade-off is size. The browser build is 22.73 kB min+gzip, against 18.8 kB for axios, because it carries an XMLHttpRequest stand-in so browsers get axios-identical responses over fetch.
Switch from axios
npm install relaxios
npm uninstall axios
Then change the import. The default instance, create, interceptors, AxiosError, CancelToken, and the types stay the same.
import axios, { AxiosError, isAxiosError } from 'relaxios/axios';
If a dependency imports axios itself, alias axios to relaxios/axios in Vite, webpack, Jest, or tsconfig.json.
Resumable uploads
relaxios/upload sends a file in chunks over Resumable Uploads for HTTP (draft -12), S3 multipart, or one XHR request. A job pauses and resumes, retries with backoff, picks up from the server’s offset after an error, and survives a page reload. Its confirmed count is the bytes the server acknowledged.
