sindresorhus/ky

🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 25 minutes ago
Added to GitGenius on July 3rd, 2026
Created on September 4th, 2018
Open Issues & Pull Requests: 2 (+0)
Number of forks: 485
Total Stargazers: 17,032 (+1)
Total Subscribers: 59 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 6.1 hours
Mean response time: 62.9 days
90th percentile: 85.6 days
Tracked items: 183

How this project is maintained

Around half of the issues opened in the past year never receive a reply. Only 7% of issues opened in the past year have been closed. Three people close 90% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 1
New in 7 days: 1
Closed in 7 days: 0
Avg open age: 1 days
Stale 30+ days: 0
Stale 90+ days: 0

Recent activity

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

Top labels

  • enhancement (28)
  • help wanted (23)
  • bug (9)
  • good first issue (9)
  • documentation (8)
  • external (2)
  • :gift: Rewarded on Issuehunt (1)
  • low priority (1)

Most active issues this week

Detailed Description

Ky is a lightweight HTTP client library for JavaScript built on top of the Fetch API, designed to provide a simpler and more elegant alternative to using fetch directly. The repository, maintained by Sindre Sorhus, targets modern browsers, Node.js, Bun, and Deno environments. As a zero-dependency package, Ky offers a minimal footprint while adding substantial convenience features that extend the native fetch functionality.

The library provides several key advantages over plain fetch usage. It includes method shortcuts like ky.post(), ky.get(), and other HTTP verbs for cleaner syntax. Ky treats non-2xx status codes as errors after redirects, providing more intuitive error handling. The package includes built-in retry logic for failed requests, timeout support, and progress tracking for both uploads and downloads. Additional features include a base URL option for relative requests, the ability to create instances with custom defaults, hooks for request and response interception, and response validation using Standard Schema compatible validators like Zod and Valibot. For TypeScript users, Ky provides enhanced type safety with features like generic support for the .json() method and defaults to unknown rather than any.

The API closely mirrors the standard fetch interface, accepting the same input and options parameters while adding Ky-specific enhancements. The library provides convenient body method shortcuts including .json(), .text(), .formData(), .arrayBuffer(), .blob(), and .bytes(). A notable feature is that these body methods throw HTTPError if the response status falls outside the 200-299 range, and .json() specifically throws when the body is empty or the status is 204. The searchParams option allows flexible query string handling, accepting strings, objects, arrays, or URLSearchParams instances. The retry configuration is highly customizable, with defaults that retry up to twice on specific status codes like 408, 429, 500, 502, 503, and 504, with exponential backoff and support for Retry-After headers.

Ky is available through multiple CDN options including jsDelivr, unpkg, and esm.sh, making it accessible for various deployment scenarios. The project is actively maintained with documentation covering both the current stable version and upcoming features, reflecting ongoing development and community support.