npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yukiakai/resty

v1.1.0

Published

A minimal, clean, and type-safe HTTP client for REST APIs.

Readme

@yukiakai/resty

NPM Version NPM Downloads

A minimal, clean, and type-safe HTTP client for REST APIs.

@yukiakai/resty is a lightweight HTTP client designed specifically for RESTful APIs. It provides a simple, predictable API with zero over-engineering — no streaming, no magic, just clean requests.


Features

  • Adapter-based (fetch, got, or custom)
  • Type-safe (TypeScript first)
  • Clean API (data-first, no .json() chaining)
  • Lightweight & minimal
  • Extensible (easy to add retry, middleware, etc.)
  • REST-focused (no streaming, no complexity)

Installation

npm install @yukiakai/resty

Optional (if using got adapter):

npm install got

Quick Start

import { HttpClient, fetchAdapter } from '@yukiakai/resty';

const http = new HttpClient(fetchAdapter, 'https://api.example.com', {
  Authorization: 'Bearer token',
});

// JSON (default)
const user = await http.get<{ id: string }>('/users/1');

// Query
const users = await http.get('/users', {
  query: { page: 1, limit: 10 },
});

// Text
const html = await http.getText('/page');

// Buffer
const file = await http.getBuffer('/file.zip');

// POST
await http.post('/users', {
  body: JSON.stringify({ name: 'yuki' }),
  headers: {
    'Content-Type': 'application/json',
  },
});

API

See docs: API Docs

Core Methods

http.get<T>(path, options?)
http.post<T>(path, options?)
http.put<T>(path, options?)
http.patch<T>(path, options?)
http.delete<T>(path, options?)

Sugar Methods

http.getTextResponse(path, options?)
http.getBufferResponse(path, options?)

...

Request Options

type RequestOptions = {
  query?: Record<string, string | string[]> | URLSearchParams;
  headers?: Record<string, string>;
  body?: any;
  responseType?: 'json' | 'text' | 'buffer';
};

Example

await http.get('/users', {
  query: { page: 1 },
  headers: { 'x-custom': '123' },
});

Adapters

@yukiakai/resty uses adapters to support different HTTP clients.

Fetch (built-in)

import { fetchAdapter } from '@yukiakai/resty';

const http = new HttpClient(fetchAdapter, baseUrl);

Got (optional)

import { HttpClient } from '@yukiakai/resty';
import { gotAdapter } from '@yukiakai/resty/adapters/got';

const http = new HttpClient(gotAdapter, baseUrl);

You must install got manually.


Custom Adapter

import type { HttpAdapter } from '@yukiakai/resty';

const customAdapter: HttpAdapter = async (req) => {
  return {
    status: 200,
    headers: {},
    ok: true,
    json: async () => ({}),
    text: async () => '',
    buffer: async () => Buffer.from(''),
  };
};

Query Handling

await http.get('/users', {
  query: {
    page: 1,
    tags: ['a', 'b'],
  },
});

→ Result:

/users?page=1&tags=a&tags=b

Design Goals

  • Keep API surface small
  • Avoid unnecessary abstractions
  • Make behavior predictable
  • Optimize for developer experience (DX)

Non-Goals

  • Streaming APIs
  • Multipart/form-data helpers
  • Browser polyfills
  • Complex middleware system

If you need those, consider other libraries.


Testing

npm run test

Built with Vitest.


Changelog

See full release notes in CHANGELOG.md


License

MIT © Yuki Akai


Support

If you find this useful, consider giving it a star ⭐