Opinionated HATEOAS / REST client for JavaScript and TypeScript, currently at version 9.1.0. Released under the MIT license, with active development. Supports multiple hypermedia formats including HAL, JSON:API, Siren, Collection+JSON, and HTML links. Designed for both browser and Node.js environments, built on top of the Fetch API. Provides middleware support for authentication (e.g., OAuth2) and integrates with React via companion library react-ketting. Requires Node.js >=20.
npm install kettingNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize Ketting, follow a link, read state, modify data, and save via PUT.
Use ESM imports (import { Ketting } from 'ketting') and upgrade Node to >=20.Use fetch-mw-oauth2 or implement a custom fetch middleware if you need custom fetch behavior.
Use `const resource = await ketting.follow('link'); const state = await resource.get();`Always base your PUT state on the result of `.get()` to preserve metadata.
Switch to ESM imports: `import { Ketting } from 'ketting'`If using Node <18, install and import `node-fetch` and set it as global: `globalThis.fetch = require('node-fetch');`Ensure you await `resource.get()` and check for HTTP errors (e.g., 404). Wrap in try/catch.