ky
v1.7.5MITTree-shakeableTS ReadyTiny and elegant HTTP client based on the browser Fetch API, with automatic retry, timeout, and hooks.
98/ 100
Excellent Health
Weekly Downloads
4.2M
Bundle Size (gzip)
3.4 kB(10.4 kB min)
Dependencies
Zero Deps
Last Updated
2024-11-20
SPONSORED CLOUD & DEV TOOLSβ’Google Ads Partner
NPMBot AI Assessment
The modern, zero-dependency successor to Axios for modern web & edge projects.
Ky wraps native Fetch with the developer ergonomics developers love in Axios (like timeout, retries, and prefixUrl) in a fraction of the bundle size. It is pure ESM, requires zero external dependencies, and handles JSON parsing gracefully.
Key Advantages
- β’Only 3.4 kB gzipped with zero external dependencies
- β’Built-in automatic retry logic with exponential backoff
- β’Native TypeScript support and clean async/await API
- β’Lightweight lifecycle hooks (beforeRequest, afterResponse)
Gotchas & Limitations
- β’Pure ESM only (cannot be required in legacy CommonJS without dynamic import)
- β’Relies on native Fetch (requires Node 18+ or global fetch polyfill)
Recommended For:
Modern Next.js / Vite / Nuxt frontend applications, Cloudflare Workers, Vercel Edge functions, and Deno runtimes, Projects requiring automatic retries and lightweight HTTP hooks
Avoid If:
Legacy CommonJS Node.js 14- environments, IE11 or old browser targets without polyfills
FEATURED PARTNERβ’Google Ads Partner
Installation & Quickstart
Package Manager Command
javascriptnpm install kyky Usage Example
javascriptimport ky from 'ky';
const user = await ky.get('https://api.github.com/users/octocat', {
retry: 2,
timeout: 5000
}).json();
console.log(user.name);Compare ky with Alternatives
Recommended Alternatives
SPONSORED SERVERSβ’Google Ads Partner