wretch
ky
| wretch | ky | |
|---|---|---|
| 9 | 31 | |
| 5,172 | 16,906 | |
| 0.1% | 0.7% | |
| 8.5 | 8.6 | |
| 19 days ago | about 1 month ago | |
| TypeScript | TypeScript | |
| MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
wretch
- Wretch: A tiny wrapper built around fetch with an intuitive syntax
-
Why do people use Axios instead of Fetch
In conclusion, whether you choose axios, fetch, or an alternative like wretch, your focus should be on writing clear, maintainable, and robust code. Understanding the strengths and weaknesses of each tool will empower you to make informed decisions and build applications that are not only functional but also resilient and enjoyable to develop.
-
How does a proper fetch wrapper look?
This package does it quite nicely https://github.com/elbywan/wretch
-
Safe Data Fetching in Modern JavaScript
One newer option, which is a very thin wrapper around Fetch much like Redaxios, is Wretch. Wretch is unique in that it largely still feels like fetch, but gives you helpful methods for handling common statuses which can chain together nicely:
-
You might be using `fetch` wrong...
It would be better with a link to kick things off so boomers can choose to read about it instead https://github.com/elbywan/wretch
-
What do you think are the "must-have" npm packages in (almost) every React Project?
For ajax, I never use Axios anymore, I always use Wretch these days.
- Framework axios pushed a broken update, crippling thousands of websites
-
Why I'm ditching Axios (Spoiler: I moved to Wretch!)
Wretch Wretch on the other hand takes the function chaining approach. It split common error types into separate helper methods so you don't need to result in an interceptor every time
-
AxleJS - Fetch supercharged.
You might be interested in Wretch, it's very lightweight and has a nice middleware facility.
ky
-
Our response to the Axios developer tool compromise
I usually reach for ky these days since it's an extremely lightweight wrapper over `fetch` - basically just adds a few niceties
https://github.com/sindresorhus/ky
From the readme:
- Simpler API
- Method shortcuts (ky.post())
- Treats non-2xx status codes as errors (after redirects)
- Retries failed requests
- JSON option
- Timeout support
- Upload and download progress
- Base URL option
- Instances with custom defaults
- Hooks
- Response validation with Standard Schema (Zod, Valibot, etc.)
- TypeScript niceties (e.g., .json() supports generics and defaults to unknown, not any)
Of course, this is only for projects where I have to make a lot of HTTP requests to a lot of different places where these niceties make sense. In most cases, we're usually using a library generated from an OpenAPI specification and fall back to `fetch` only as an escape hatch.
-
ky + p-limit: Concurrency Control With Built-in Retry for Batch Requests
Batch 100 API calls with Promise.all and the server returns 429. Add retry and transient network errors self-heal — but there's still no cap on how many run at once. ky handles per-request reliability. p-limit controls overall throughput. Both together is the complete solution.
-
ky: Stop Writing Fetch Boilerplate
Every project using fetch ends up with the same boilerplate: if (!response.ok) throw new Error(...). Add retry and you're writing a loop. Add timeout and you're pulling out AbortController. ky wraps all of that. 4KB, zero dependencies.
-
Decorating Promises Without Breaking Them
This came up while building convenience plugins for ffetch, a lightweight fetch wrapper focused on keeping native semantics intact. Libraries like ky solve the ergonomics problem by introducing a custom Response-like object, which works great until something outside the library expects a plain Response. I wanted a different path.
-
Prerelease of Ky 2.0
https://github.com/sindresorhus/ky?tab=readme-ov-file#how-is...
-
Axios VS Ky: When to use which?
Resources I used for writing this article: Ky: https://www.npmjs.com/package/@smeijer/ky?activeTab=readme https://github.com/sindresorhus/ky Axios: https://www.npmjs.com/package/axios?activeTab=readme https://axios-http.com/docs/intro
-
SvelteKit RPC with Hono
API-routes provide regular endpoints through folder hierarchy, giving you full control over request-response objects and middleware. You can use any HTTP client library—mine is ky.
- Fundamentals of React Native App Development: Dependencies, Performance, Native Modules, and Publishing Guide
- Ky: Tiny and elegant JavaScript HTTP client based on the browser Fetch API
- Ky is a tiny and elegant HTTP client based on the browser Fetch API
What are some alternatives?
react-query - 🤖 Powerful asynchronous state management, server-state utilities and data fetching for TS/JS, React, Solid, Svelte and Vue. [Moved to: https://github.com/TanStack/query]
axios - Promise based HTTP client for the browser and node.js
SWR - React Hooks for Data Fetching
fetch - A small Fetch API wrapper
Bearer
dr-fetch - Fetching done right, not just the happy path.