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

@liha-labs/apizel

v0.3.0

Published

Lightweight fetch-based API client for Web + React Native.

Downloads

275

Readme

apizel

Thin fetch wrapper for TypeScript.

標準の fetch に、ちょうどいい薄皮。

  • Small & predictable: 余計な抽象化なし
  • TanStack Query friendly: signal を尊重、timeoutMs は Abort で中断
  • Minimal axios-like body: FormData をそのまま、JSON は Content-Type 補完
  • 401 refresh retry: refresh は single-flight、リトライは 1 回だけ
  • Observe hooks: onRequest / onResponse は観測のみ

Status: v0.1.2 Design goal: “軽く、標準に沿い、必要なら捨てられる”。


Install

pnpm add @liha-labs/apizel
# npm i @liha-labs/apizel
# yarn add @liha-labs/apizel

Quick Start

import { apizel } from '@liha-labs/apizel'

type Me = { id: string; name: string }

const api = apizel({
  baseURL: 'https://api.example.com',
})

const me = await api.get<Me>('/v1/me')
console.log(me)

Extend Client

共通設定を保ちつつ、baseURL などだけを差し替えた派生クライアントを作れます。

const api = apizel(common)

const usersApi = api.extend({ baseURL: USERS_URL })
const billingApi = api.extend({ baseURL: BILLING_URL })

await usersApi.get('/me')
await billingApi.post('/invoices', body)

Usage

Request options

await api.get('/v1/items', {
  params: { q: 'hello', tag: ['a', 'b'] }, // => tag=a&tag=b
  timeoutMs: 10_000, // <= 0 disables timeout
  signal, // AbortSignal (TanStack Query compatible)
  headers: { 'X-Trace-Id': '...' },
})

Body (minimal axios-like)

// JSON (auto sets Content-Type if missing)
await api.post('/v1/items', { name: 'apple' })

// FormData (Content-Type is NOT touched)
const fd = new FormData()
fd.append('file', file)

await api.post('/v1/upload', fd)

Errors

Non-2xx responses throw HttpError.

import { HttpError } from '@liha-labs/apizel'

try {
  await api.get('/v1/me')
} catch (e) {
  if (e instanceof HttpError) {
    console.log(e.status, e.data, e.url)
  }
}

Note: abort/timeout errors are not converted to HttpError. You’ll receive the native AbortError (or environment equivalent).


Auth Token

const api = apizel({
  baseURL: 'https://api.example.com',
  getAccessToken: () => localStorage.getItem('token'),
  shouldAttachToken: ({ endpoint }) => !endpoint.startsWith('/auth/'),
})

Refresh on 401

  • refresh is single-flight
  • retry is once
const api = apizel({
  baseURL: 'https://api.example.com',
  getAccessToken: async () => getToken(),
  refresh: async () => {
    const newToken = await refreshToken()
    return newToken
  },
  onRefreshFailed: async () => {
    // logout / clear tokens / notify...
  },
})

Hooks (observe only)

const api = apizel({
  baseURL: 'https://api.example.com',
  onRequest: ({ method, url, init }) => {
    // observe only (no behavior changes)
    console.log('[req]', method, url, init)
  },
  onResponse: ({ method, url, response }) => {
    console.log('[res]', method, url, response.status)
  },
})

Documentation

  • Documentation: https://apizel.liha.dev/
  • Repository: https://github.com/liha-labs/apizel

License

MIT © 2026 Liha Labs