OSS TanbouSign in with GitHub

extend Fetch API with concise retries, timeouts, hooks, and JSON handling

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
17,104
Primary language
TypeScript
License
MIT
Repository last updated
Sep 16, 2026
On this page

Overview

Ky is a small HTTP client built on the standard Fetch API. It adds method shortcuts, non-2xx errors, JSON helpers, retries, timeouts, base URLs, hooks, progress handling, and Standard Schema response validation across browsers, Node.js, Bun, and Deno.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Add method shortcuts and response helpers to fetch-compatible requests

Shortcuts such as ky.get and ky.post combine with .json(), .text(), and other body helpers. The json option sends JSON request bodies, while non-2xx responses become HTTPError instances.

Sources: [1]

Centralize retry, timeout, baseUrl, and hook behavior

Retry policies, per-attempt and total timeouts, base URLs, and lifecycle hooks can be configured as options. extend creates clients with shared defaults for authentication, errors, and other cross-cutting behavior.

Sources: [1]

Type and validate JSON responses with TypeScript and Standard Schema

.json<T>() accepts TypeScript generics and defaults to unknown when no type is supplied. Standard Schema-compatible validators can also perform runtime validation and report SchemaValidationError on invalid data.

Sources: [1]

Best fit

Fits frontends that want to standardize HTTP behavior without abandoning fetch semantics

It is useful when applications want the native fetch request/response model while centralizing repeated JSON, error, retry, and authentication behavior.

Sources: [1]

Before adoption

Version 2.1.0 requires Node.js 22 or newer

Package metadata declares engines.node as >=22. Browser, Bun, and Deno usage remains supported, but Node.js backends and SSR environments should verify their runtime first.

Sources: [2]

Tune retry methods and delays to match API semantics

Ky includes retries by default and version 2.1.0 further hardens retry handling. The default method set includes PUT and DELETE in addition to GET, so endpoints with side effects should define retry limits and status handling explicitly.

Sources: [1][3]

Official sources

  1. [1]Ky v2.1.0 README(2026-10-05)
  2. [2]Ky v2.1.0 package metadata(2026-10-05)
  3. [3]Ky v2.1.0 release(2026-10-05)
  4. [4]Ky MIT license(2026-10-05)
Supplemental curator note

Ky 2.1.0 requires Node.js 22 or newer. Retries are convenient, but default retry methods include operations such as PUT and DELETE, so confirm API idempotency and disable retries explicitly when a request must not be repeated.

Try it in 3 steps

  1. 1

    Verify Node.js 22+ and install Ky 2.1.0

    Check the package engine requirement before installing the reviewed Ky release in an isolated project.

    node -e "if (Number(process.versions.node.split('.')[0]) < 22) { console.error('Ky 2.1.0 requires Node.js >=22'); process.exit(1); }" && demo=$(mktemp -d "${TMPDIR:-/tmp}/ky.XXXXXX") && cd "$demo" && npm init -y >/dev/null && npm install --save-exact ky@2.1.0
  2. 2

    Create a local HTTP server and request it with Ky

    Use a local server to exercise the fetch-based request and JSON body shortcut without relying on an external endpoint. Retries are disabled for a deterministic check.

    printf "%s\n" "import {createServer} from 'node:http';" "import ky from 'ky';" "const server = createServer((request, response) => { response.setHeader('content-type', 'application/json'); response.end(JSON.stringify({ok: true})); });" "server.listen(0, '127.0.0.1', async () => {" " const address = server.address();" " try {" " const data = await ky.get('http://127.0.0.1:' + address.port + '/', {retry: {limit: 0}}).json();" " if (data.ok !== true) process.exitCode = 1;" " console.log(data);" " } finally { server.close(); }" "});" > demo.mjs
  3. 3

    Run the request with Node.js

    Confirm that Ky retrieves the response and returns the parsed JSON body.

    node demo.mjs
Check the official README

Growth

Growth trends · Last 30 days

17,104 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
48
Open PRs
0

Development activity is still being collected.

Built with

Categories and tags

Categories

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • fetch
  • whatwg-fetch
  • http-client
  • http-request
  • request
  • npm-package
  • tiny
  • json
  • rest
  • js
  • javascript
Stars
17,104
Forks
499
Watchers
64
Open issues
2
Contributors
120
Owner type
User
Primary language
TypeScript
License
MIT
Repository last updated
Sep 16, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?