Axios → ky / native fetch
easyAxios is 13kb minified+gzipped. Ky is 4kb and built on fetch. For most apps the bundle savings and modern API are worth the migration.
npm uninstall axios && npm install ky
Configure base URL, headers, timeout once.
import ky from 'ky'
export const api = ky.create({ prefixUrl: process.env.NEXT_PUBLIC_API_URL, timeout: 10000 })axios.get(url).then(r => r.data) → api.get(url).json(). Errors throw HTTPError instead of axios error shape.
Axios interceptors → ky hooks (beforeRequest, afterResponse, beforeError). Auth refresh handled in afterResponse.
What this migration involves
Moving from Axios to ky / native fetch is rated easy and takes about 1-3h on a typical project. The guide breaks it into 5 steps, 2 of which ship with runnable commands and 1 with a verification check.
Related migrations
FAQ
How long does migrating from Axios to ky / native fetch take?
Around 1-3h for a typical project — 5 steps, difficulty rated easy, 2 of them with copy-paste commands.
Is moving from Axios to ky / native fetch reversible?
No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your Axios data before you start.
What does ky / native fetch cost compared to Axios?
Pricing for both tools is contact-based or not tracked yet.