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

@pings/phtps

v1.0.1

Published

A modern HTTP client built on native fetch — with plugins for retry, auth, cache, queue, encryption, streaming (SSE/NDJSON), pagination, and payment security.

Readme

Phtps

A modern HTTP client built on native fetch.
Plugins for retry, auth, cache, deduplication, queue, encryption, streaming (SSE + NDJSON), pagination, and payment security. Zero dependencies. Full TypeScript.

npm install phtps

Why Phtps

Most HTTP clients give you a thin wrapper around fetch and leave the hard parts to you. Phtps ships the features that production apps actually need — without pulling in extra dependencies.

| Feature | Phtps | Axios | Ky | Got | |---|---|---|---|---| | Retry with backoff | ✅ built-in | ❌ plugin needed | ⚠️ basic | ✅ | | Token refresh (401 queue) | ✅ | ❌ manual | ❌ manual | ❌ manual | | Proactive token rotation | ✅ | ❌ | ❌ | ❌ | | Request deduplication | ✅ | ❌ | ❌ | ❌ | | Response cache + adapters | ✅ | ❌ | ❌ | ❌ | | Concurrency queue | ✅ | ❌ | ❌ | ❌ | | SSE streaming | ✅ | ❌ | ❌ | ❌ | | NDJSON streaming | ✅ | ❌ | ❌ | ❌ | | Payload encryption (AES-GCM) | ✅ | ❌ | ❌ | ❌ | | Payment security (HMAC) | ✅ | ❌ | ❌ | ❌ | | CSRF protection | ✅ full | ⚠️ basic | ❌ | ❌ | | Pagination (all strategies) | ✅ | ❌ | ❌ | ❌ | | Plugin system | ✅ typed | ❌ | ⚠️ hooks | ❌ | | Zero dependencies | ✅ | ❌ | ✅ | ❌ | | Full TypeScript | ✅ | ✅ | ✅ | ✅ |


Quick Start

import { Phtps } from 'phtps';

const { data } = await Phtps.get('/api/users');
const { data } = await Phtps.post('/api/users', { name: 'Alice' });

Custom Instance

import { createHttpClient } from 'phtps';
import { RetryPlugin, AuthPlugin, CachePlugin } from 'phtps/plugins';

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

api.use([
  RetryPlugin(),
  AuthPlugin(),
  CachePlugin(),
]);

export default api;

Plugins

Install only what you need. Every plugin is tree-shakeable.

import {
  RetryPlugin,
  AuthPlugin,
  CachePlugin,
  DedupePlugin,
  QueuePlugin,
  EncryptionPlugin,
  CsrfPlugin,
  PaginationPlugin,
  PaymentPlugin,
} from 'phtps/plugins';

RetryPlugin

api.use(RetryPlugin());

await api.get('/api/data', {
  retries: 3,
  retryDelay: 1000, // exponential: 1s, 2s, 4s ± jitter
});

AuthPlugin — token refresh on 401

api.use(AuthPlugin());

await api.get('/api/me', {
  onTokenRefresh: async () => {
    const { token } = await refreshToken();
    return token;
  },
});

CachePlugin

api.use(CachePlugin());

await api.get('/api/users', { useCache: true, cacheTTL: 60000 });

SSE Streaming

const stream = await api.stream('/api/chat', {
  method: 'POST',
  body: { messages },
  streamType: 'sse',
});

const reader = stream.data.getReader();
while (true) {
  const { done, value } = await reader.read();
  if (done) break;
  console.log(value.data); // parsed per-event
}
stream.cancel();

PaginationPlugin — fetch all pages

api.use(PaginationPlugin());

const { data } = await api.get('/api/posts', {
  paginate: { strategy: 'cursor', cursorField: 'nextCursor', limit: 200 },
});
// data is all items merged across all pages

PaymentPlugin — HMAC signing + idempotency

api.use(PaymentPlugin({
  secretKey: getRuntimeKey(),
  signRequests: true,
  idempotency: true,
  maskSensitiveData: true,
}));

Error Handling

try {
  await api.get('/api/users');
} catch (err) {
  if (err.isTimeout) { /* timed out */ }
  if (err.isCancel)  { /* aborted */ }
  if (err.response)  {
    console.log(err.response.status);
    console.log(err.response.data);
  }
}

TypeScript

import type { HttpClientConfig, HttpResponse, HttpError, PhtpsPlugin } from 'phtps';

const { data } = await api.get<User[]>('/api/users');
//      ^ User[]

Requirements

  • Browser: Any modern browser (Chrome 89+, Firefox 90+, Safari 15+)
  • Node.js: 18.0.0 or later
  • Dependencies: None

Documentation

Full documentation: https://phtps.dev/docs


Contributing

See CONTRIBUTING.md.

License

MIT © 2026 Phtps Contributors