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

@nextn/outbound-guard

v0.2.1

Published

````md # outbound-guard

Readme

# outbound-guard

A **process-local Node.js library for safe outbound HTTP access**.

It provides **two independent tools**, each solving a different real-world problem when calling external services:

---

## What this library provides

### 1. Resilient HTTP Client (requests under load)

For **on-demand HTTP calls** made by your application (APIs, BFFs, workers).

It protects your service when traffic spikes or upstreams misbehave by combining:

- request coalescing (duplicate GET collapse)
- bounded concurrency + queueing
- per-attempt timeouts
- a small health gate (OPEN → CLOSED → HALF_OPEN)

This is what you use when **your code actively sends requests**.

---

### 2. Instant GET Store (background polling)

For **continuously polling a single GET endpoint** and serving its latest value instantly.

It runs in the background, fetches on a fixed interval, and lets your code read the most recent value with zero latency.

This is what you use when **your code consumes external state**.

---

These two features are independent but complementary.

---

## Feature overview

| Feature | Purpose | Typical use |
|------|------|------|
| **ResilientHttpClient** | Protect outbound requests under load | APIs, gateways, webhook senders |
| **InstantGetStore** | Continuously poll & cache one GET endpoint | config flags, prices, health endpoints |

---

## 1. Resilient HTTP Client

A guarded HTTP client that keeps your service predictable under pressure.

### What it does
- Collapses identical GETs into a single upstream call
- Enforces per-host concurrency limits
- Uses a bounded FIFO queue (no unbounded memory)
- Fails fast when an upstream becomes unhealthy
- Retries safely without amplification

### When to use
- Calling third-party APIs
- Partner integrations
- Webhooks and background jobs
- Any request-driven outbound traffic

(Details below ⬇)

---

## 2. Instant GET Store

A lightweight **background poller for a single GET URL**.

### What it does
- Polls one URL on a fixed interval
- Stores the latest successful response
- `get()` returns instantly (no network call)
- Handles retry or stop behavior on failure
- Optionally waits until first successful fetch

### When to use
- Remote config endpoints
- Feature flags
- Prices, rates, counters
- “Read often, update periodically” data

(Details below ⬇)

---

---

## Install

```bash
npm install @nextn/outbound-guard

Node 18+ required (tested on Node 20).


Quick links

  • Demos & usage examples [https://github.com/next-n/guardtest]

─────────────────────────────

Resilient HTTP Client

─────────────────────────────