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

@apihive/core

v1.0.2

Published

<p align="center"> <a href="https://cleverplatypus.github.io/apihive-core/"> <img src="./docs/public/images/logo.svg" alt="APIHive logo" width="120" /> </a> </p>

Downloads

37

Readme

APIHive is a modern, standards‑based HTTP client for TypeScript and JavaScript apps. It builds on the native Fetch API and adds a clean, config‑first architecture with interceptors, progressive features (opt‑in via a feature system), typed APIs, and an adapter ecosystem for real‑world needs.

📙 Documentation: https://cleverplatypus.github.io/apihive-core/

Some notes on simplicity

We're all about an uncomplicated life and we (not so) secretly despise merchants of complexity. If your app only needs to make a handful of HTTP calls, just use the Fetch API directly — really.

If your application needs to grow, there is a threshold where adding a light abstraction on top of Fetch actually solves problems: organizing a whole API interface, centralizing defaults, adding interceptors, retry/backoff, progress, SSE, and more. APIHive is designed exactly for that moment.

The API is thought so that it's always clear what's going on, and it's easy to reason about. The method names are self-explanatory, and the API is designed to be easy to use and understand. HTTPRequestFactory is less flashy and brand-y than, say, axios, but it's clearer what it does.

Feature highlights

  • Config‑first HTTP client
    • Centralize headers, base URL, query params, and behavior at the factory/API level
    • Progressive disclosure: opt‑in only to what you need
  • Interceptors and transformers
    • Request, response, error interceptors with controls (abort, replace URL/body, update headers)
    • Response body transformers for post‑processing
  • Strong TypeScript story
    • Type‑safe configuration, excellent IntelliSense, and built‑in types
  • Adapters ecosystem (opt‑in via features)
    • Attach adapters to add capabilities (caching, OpenAPI, logging, etc.)
  • Optional features you can enable when needed
    • Retries with linear/exponential backoff and meta‑driven policy
    • Upload and download progress with throttling and fall‑through handlers
    • Deterministic request hashing for caching keys
    • Server‑Sent Events (SSE) with a dedicated request type
  • Ergonomic URL and params API
    • URL templates with {placeholders}, query param builders, conditional building with when()
  • Developer‑friendly extras
    • Wrapped error mode to avoid try/catch: receive { response?, error? }
    • Framework‑agnostic and ESM‑first

Installation

Using npm

npm install @apihive/core

Using yarn

yarn add @apihive/core

Using pnpm

pnpm add @apihive/core

Quick start

Basic request

import { HTTPRequestFactory } from '@apihive/core';

const http = new HTTPRequestFactory()
  .withBaseURL('https://api.example.com');

const user = await http
  .createGETRequest('/users/{id}')
  .withURLParam('id', '42')
  .withQueryParam('include', 'repos')
  .execute();

Fail‑fast handling without try/catch

import { HTTPRequestFactory } from '@apihive/core';

const http = new HTTPRequestFactory().withWrappedResponseError();

const { response, error } = await http
  .createGETRequest('https://httpbin.org/json')
  .execute();

if (error) {
  // deal with it early and return
}

Define an API interface and call endpoints by name

import { HTTPRequestFactory } from '@apihive/core';

const http = new HTTPRequestFactory().withAPIConfig({
  name: 'default',
  baseURL: 'https://api.github.com',
  headers: { 'accept': 'application/vnd.github+json' },
  endpoints: {
    getUser: { target: '/users/{username}' },
    updateUser: { target: '/user', method: 'PATCH' }
  }
});

const user = await http
  .createAPIRequest('getUser')
  .withURLParam('username', 'octocat')
  .execute();

Opt‑in features (retry, progress, hashing, SSE)

import { HTTPRequestFactory } from '@apihive/core';
import {
  RetryFeature,
  UploadProgressFeature,
  DownloadProgressFeature,
  RequestHashFeature,
  SSERequestFeature
} from '@apihive/core/features';

const http = new HTTPRequestFactory()
  .use(
    new RetryFeature().withDefaultAttempts(3),
    new UploadProgressFeature(),
    new DownloadProgressFeature(),
    new RequestHashFeature(),
    new SSERequestFeature()
  );

// Retry example
await http
  .createGETRequest('https://httpbin.org/status/503')
  .withRetry({ 
    attempts: 3, 
    onRetry: () => console.log('Retrying...'),
    onRetrySuccess: () => console.log('Retry successful!'),
    onRetryError: () => console.log('Retry failed!')
  })
  .execute();

// Upload progress example
await http
  .createPOSTRequest('/upload')
  .withFormDataBody(fd => fd.append('file', new File(['data'], 'demo.txt')))
  .withProgressHandlers({
    upload: ({ percentProgress, fallThrough }) => {
      console.log('Upload', percentProgress);
      fallThrough(); //lets other handlers process the progress
    }
  })
  .execute();

Documentation

  • Getting started, concepts, demos, and API reference: https://cleverplatypus.github.io/apihive-core/

Contributing

Contributions are welcome! Issues and PRs are appreciated — in particular new adapters and docs improvements. See existing code and docs for patterns and conventions.

License

MIT © 2025 Nicola Dal Pont