elbywan

elbywan/wretch

TypeScript MIT Web Dev

A tiny wrapper built around fetch with an intuitive syntax. :candy:

5.2k stars
107 forks
recent
GitHub

5.2k

Stars

107

Forks

10

Open issues

21

Contributors

3.0.9 19 Jun 2026

AI Analysis

Wretch is a lightweight (~1.8KB gzipped) TypeScript wrapper around the Fetch API that provides an intuitive, chainable syntax for HTTP requests with automatic serialization, error handling, and immutable instances. It serves developers building browser, Node.js, Deno, and Bun applications who want a simpler alternative to fetch while maintaining type safety and modularity through addons and middlewares.

Web Dev Library Discovery value: 4/10
Documentation 9/10
Activity 8/10
Community 8/10
Code quality 9/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

http-client fetch-wrapper typescript isomorphic lightweight
Actively maintained Well documented MIT licensed Popular Beginner friendly Production ready
Deep Analysis · Based on README and public signals
2w ago

Wretch: a typed, composable fetch wrapper that adds ergonomics without hiding the platform API

Wretch is a lightweight (~1.8KB gzipped) TypeScript wrapper around the browser/Node.js Fetch API. It solves the verbosity and error-handling gaps of raw fetch: two-step JSON parsing, silent HTTP error codes, and repetitive header boilerplate. Built for frontend developers and Node.js/Deno/Bun backend developers who want fetch semantics without fetch's rough edges. The library has accumulated over 5,000 GitHub stars since 2017, ships with a middleware and addon system, and claims consistent npm downloads. It is maintained by a single author who has kept it active for nearly nine years.

Origin

Created in September 2017 when fetch was relatively new and axios dominated. Wretch positioned itself as a fetch-native alternative rather than an XHR abstraction. It reached v3.0 as a major milestone, indicating sustained evolution.

Growth

Growth appears to have been slow and steady rather than spike-driven. The library benefited from the broader industry move away from axios toward native fetch, particularly after Node.js 18+ shipped fetch natively. Stars are modest relative to age, suggesting a loyal niche audience rather than viral adoption. Recent star velocity (1 per week as of late June 2026) indicates mature plateau rather than active expansion.

In production

The README claims the library is 'widely used' and npm download badges are displayed, but concrete download numbers are not quoted in the excerpt. No named production users, case studies, or enterprise references are cited. NPM weekly download counts would be the most reliable signal but are not available in provided metadata. Adoption not verified beyond self-reported claims and star count.

Code analysis
Architecture

Appears to be a fluent/builder-pattern API where each method call returns a cloned immutable instance. Likely implemented as a thin class or function chain over the native fetch call, with addons as separate modules that extend the core. Middleware support suggests a pipeline/interceptor pattern similar to express middleware. The modular addon design likely keeps the core minimal while allowing opt-in features such as query string handling or form data.

Tests

README states the library is 'fully covered by unit tests' and links to a Coveralls badge, suggesting meaningful automated test coverage exists. Exact percentage not documented in README excerpt, but CI badge (GitHub Actions) is present and referenced.

Maintenance

Last push was June 19, 2026 — six days before the evaluation date — indicating very active maintenance. The project has been sustained for nearly nine years by a single maintainer, with a v3 release, migration guides, and a changelog, all positive signals. Single-maintainer dependency is a structural risk but not a current abandonment signal.

Honest verdict

ADOPT IF: you use fetch natively in a TypeScript project and want immutable, composable request configuration with built-in HTTP error handling and a small bundle footprint. AVOID IF: your team is already standardized on axios or ky, or if you have only simple, low-volume fetch calls that a small helper function would handle equally well. MONITOR IF: you are evaluating ofetch vs wretch for a Nuxt/UnJS-ecosystem project, as ofetch's organizational backing may offer better long-term sustainability.

Independent dimensions

Mainstream potential

4/10

Technical importance

6/10

Adoption evidence

4/10

Risks
  • Single-maintainer project: if the author steps back, the project has no organizational backstop, which is a real long-term sustainability risk despite current active maintenance.
  • The value proposition narrows as fetch becomes more ergonomic natively and as TypeScript utility patterns mature — a future fetch standard update could reduce the need for this abstraction layer.
  • Competition from ofetch is significant: similar feature set, similar size, but with UnJS/Nuxt organizational adoption that may attract contributors and users more rapidly.
  • Star growth velocity appears to have plateaued at low single-digit weekly additions, suggesting the library may not be gaining new mindshare relative to alternatives.
  • No verified enterprise or named production adoption in available metadata; the 'widely used' claim in the README cannot be independently confirmed from provided data.
Prediction

Wretch will likely remain a well-maintained niche tool for developers who prefer its specific API style. It is unlikely to close the gap with axios or displace ofetch, but it should remain viable and actively maintained for several more years given the author's track record.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

TypeScript
98.2%
JavaScript
1.3%
Handlebars
0.4%

Information

Language
TypeScript
License
MIT
Last updated
3w ago
Created
107mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

better-auth

better-auth/better-fetch

Better Fetch is an advanced fetch wrapper for TypeScript that adds schema...

1k TypeScript Dev Tools
posva

posva/mande

Mande is a lightweight (~800 bytes) TypeScript wrapper around the Fetch API...

1.3k TypeScript Web Dev
unjs

unjs/ofetch

ofetch is a lightweight HTTP client that improves upon the standard Fetch API...

5.3k TypeScript Web Dev
node-fetch

node-fetch/node-fetch

node-fetch brings the browser's Fetch API to Node.js, allowing developers to...

8.9k JavaScript Dev Tools
vs. alternatives
axios

Axios wraps XHR/http, not fetch, making it heavier and incompatible with fetch-based runtimes by default. Wretch stays on the platform primitive; axios has vastly larger adoption and ecosystem. Wretch is a better choice when you want to stay fetch-native and keep bundle size minimal.

ofetch (unjs)

ofetch is a direct peer with similar goals and nearly identical star count (~5,317). ofetch has backing from the UnJS ecosystem used by Nuxt, giving it stronger organizational adoption signals. Wretch has a more mature middleware/addon system and longer track record. Competition is real and fairly even.

node-fetch

node-fetch is a fetch polyfill for older Node.js versions, not an ergonomics layer. With Node.js 22+ shipping native fetch, node-fetch's use case is shrinking. Wretch targets the ergonomics problem that node-fetch does not address.

ky

ky is another fetch wrapper (by Sindre Sorhus) with similar scope and philosophy. ky has strong open-source branding and is often cited alongside wretch. The two are functionally comparable; choice often comes down to API style preference and ecosystem trust.

raw fetch

The zero-dependency option. Raw fetch is now available natively across all major runtimes. Wretch's value proposition exists only if the ergonomics gap (error handling, serialization, composability) justifies the dependency. For simple use cases, raw fetch with a few utility functions may be sufficient.