unjs/ofetch

😱 A better fetch API. Works everywhere.

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 15 minutes ago
Added to GitGenius on September 12th, 2026
Created on December 9th, 2020
Open Issues & Pull Requests: 125 (+0)
GitHub issues: Enabled
Number of forks: 193
Total Stargazers: 5,362 (+0)
Total Subscribers: 14 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 10.7 days
Mean response time: 90.5 days
90th percentile: 389.6 days
Tracked items: 59

Most active contributors

Sign in to see contributor activity.

How this project is maintained

Around half of the issues opened in the past year never receive a reply. 94% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Only 3% of issues opened in the past year have been closed. Three people close 76% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 34
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 523 days
Stale 30+ days: 32
Stale 90+ days: 27

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • enhancement (25)
  • bug (22)
  • documentation (5)
  • discussion (3)
  • needs reproduction (1)
  • pending triage (1)
  • upstream (1)

Most active issues this week

Detailed Description

ofetch is a fetch wrapper library that works on Node.js, browsers, and workers.

The tool addresses the inconsistencies and limitations of the native fetch API across different JavaScript environments. It provides automatic JSON parsing for responses, intelligently detecting content types and returning Blob objects for binary data. When sending requests with object bodies, ofetch automatically serializes them to JSON and sets appropriate headers. The library includes built-in error handling that throws exceptions when response status indicates failure, with parsed error bodies available for inspection. It implements automatic retry logic for transient failures like timeouts and rate-limiting, with configurable retry counts and delays, though it avoids retrying mutating requests by default to prevent side effects. Additional conveniences include request timeouts, base URL handling with proper slash normalization, query parameter management, and TypeScript support for response type assistance.

Developers should choose ofetch when they want a more ergonomic fetch experience without the boilerplate of manual JSON handling, error checking, and retry logic. It suits projects targeting multiple JavaScript runtimes that need consistent behavior across Node.js, browsers, and workers. The library is particularly valuable for API clients where automatic retries on transient errors and sensible defaults reduce implementation complexity.

The project maintains active development with regular commits addressing bug fixes and feature refinements. The codebase shows attention to edge cases, such as handling streaming bodies and ensuring proper header defaults for different request methods. The maintainers respond to issues and incorporate community feedback into the tool's evolution. Development includes comprehensive handling of various response types and careful consideration of when to apply automatic behaviors versus when to require explicit configuration.