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

api-orchestrator

v1.0.0

Published

A comprehensive, configurable API infrastructure toolkit for frontend applications. Configure once. Use everywhere.

Readme

api-orchestrator

Configure once. Use everywhere.

A comprehensive, configurable API infrastructure toolkit for frontend applications. Built with TypeScript, powered by the native Fetch API, with optional React integration.

Features

  • HTTP Client – GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS
  • Authentication – Bearer tokens, API keys, Basic auth, custom providers, token refresh
  • Content Types – JSON, FormData, URLSearchParams, Blob, ArrayBuffer
  • File Uploads – Progress tracking (XHR), validation helpers, multi-file
  • Cancellation – AbortController, timeouts, cancellation-aware retries
  • Error Handling – Normalized ApiError, status handlers, global error callbacks
  • Retries – Exponential backoff, jitter, Retry-After, idempotent-only defaults
  • Logging – Structured logs, redaction of secrets, custom loggers
  • Middleware – Request, response, and error middleware
  • React Hooks – useApiQuery, useApiMutation, useApiUpload, ApiProvider
  • TypeScript-first – Full type safety and autocomplete
  • JavaScript-friendly – Works without TypeScript configuration

Installation

npm install api-orchestrator

For React integration:

npm install api-orchestrator @api-orchestrator/react

Quick Start

JavaScript

import { createApiClient } from 'api-orchestrator';

const api = createApiClient({
  baseURL: 'https://api.example.com',
  timeout: 15000,
});

const users = await api.get('/users');
console.log(users);

TypeScript

import { createApiClient } from 'api-orchestrator';

interface User {
  id: number;
  name: string;
}

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

const users = await api.get<User[]>('/users');
console.log(users[0]?.name);

Authentication

const api = createApiClient({
  baseURL: '/api',
  auth: {
    type: 'bearer',
    getToken: async () => authService.getAccessToken(),
  },
});

React

import { ApiProvider, useApiQuery } from '@api-orchestrator/react';
import { createApiClient } from 'api-orchestrator';

const client = createApiClient({ baseURL: '/api' });

function App() {
  return (
    <ApiProvider client={client}>
      <UserList />
    </ApiProvider>
  );
}

function UserList() {
  const { data, isLoading, error } = useApiQuery('/users');
  if (isLoading) return <p>Loading…</p>;
  if (error) return <p>Error: {error.message}</p>;
  return <ul>{data?.map((u) => <li key={u.id}>{u.name}</li>)}</ul>;
}

Cancellation

import { isApiCancellationError } from 'api-orchestrator';

const controller = new AbortController();

try {
  const users = await api.get('/users', { signal: controller.signal });
} catch (error) {
  if (isApiCancellationError(error)) {
    // cancelled – not an application failure
  } else {
    throw error;
  }
}

controller.abort();

File Upload with Progress

const formData = new FormData();
formData.append('file', file);

const result = await api.upload('/files', formData, {
  onUploadProgress: (progress) => {
    console.log(`${progress.percentage}%`);
  },
});

Status Handlers

const api = createApiClient({
  statusHandlers: {
    401: async ({ error }) => {
      await authService.handleUnauthorized(error);
    },
    403: ({ error }) => {
      notificationService.showForbidden(error);
    },
    422: ({ error }) => {
      formService.handleValidationError(error);
    },
  },
});

API Overview

| Method | Description | |--------|-------------| | createApiClient(config) | Create a client instance | | api.get(url, config?) | GET request → data | | api.post(url, data?, config?) | POST request → data | | api.put / patch / delete / head / options | Other HTTP methods | | api.upload(url, data, config?) | Multipart upload | | api.requestFull(config) | Full response with metadata | | api.setHeader / removeHeader / setAuth | Runtime config | | isApiError / isApiCancellationError | Error helpers |

Security Notes

  • Tokens are fetched dynamically per request – never captured at init.
  • Sensitive headers are redacted from logs by default.
  • Confidential API keys must stay on the server. Frontend env vars are not private.
  • Do not rely on client-side file validation alone.

License

MIT

Documentation

  • Full docs (website): https://api-orchestrator-beige.vercel.app/
  • Complete guide (Markdown): GUIDE.md
  • Repository: https://github.com/Kiran-Deokar/api-orchestrator