
ky
Tiny elegant HTTP client based on Fetch
Coldcast Lens
ky is what fetch should feel like. A tiny (5KB) HTTP client built on the Fetch API that adds retries, timeout handling, JSON parsing, and hooks — all the stuff you'd write yourself anyway. From Sindre Sorhus, who has a habit of building small perfect things.
Axios is the incumbent at 11KB with XMLHttpRequest baggage and a massive install base. Got/node-fetch are Node-specific options. Plain fetch is free but raw — no retries, verbose error handling, manual JSON parsing.
Use ky if you're building a modern frontend or full-stack app and want clean HTTP calls without Axios's weight. It works everywhere Fetch works — browsers, Node, Bun, Deno. The hook system (beforeRequest, afterResponse) is elegant for auth headers and logging.
The catch: if your project already uses Axios, switching gains you almost nothing. The 6KB size difference doesn't matter for most apps. And ky's error handling is different from Axios — HTTPError instead of status codes on the response — so migration isn't a find-and-replace.
About
- Stars
- 16,479
- Forks
- 455
Explore Further
More tools in the directory
Get tools like this delivered weekly
The Open Source Drop — the best new open source tools, analyzed. Free.