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

@reinconsole/gate

v0.1.1

Published

Rein Gate — vendor-side x402 monetization middleware. Price your routes, verify and settle agent payments, screen payers, and get receipts and revenue observability from one middleware.

Downloads

194

Readme

@reinconsole/gate

The supply side of Rein — vendor-side x402 monetization middleware. Price your routes once and every payment into your API is quoted, cross-checked, screened, rate-limited, settled, and receipted before your handler runs.

Status: v0.1 — early open-source infrastructure, live on testnet. Verified live on Base Sepolia against the hosted x402.org facilitator. APIs may change before 1.0. See it running: Rein console.

Install

npm install @reinconsole/gate

Quickstart

import { createGate, gateMiddleware, facilitatorClientRails } from '@reinconsole/gate';

const gate = createGate({
  routes: [
    { path: '/api/answer', price: '0.05', description: 'one research answer' },
    { path: '/api/premium/*', method: 'POST', price: '0.25' },
  ],
  rails: facilitatorClientRails(facilitator), // or mockFacilitatorRails(...) offline
  payTo: '0xYourTreasury…',
  network: 'base-sepolia',
  asset: USDC_ADDRESS,
  screen: { denyPayers: ['0xKnownMule…'] },
});

app.use(gateMiddleware(gate)); // Express, or wrap any node:http handler

In-process instead? createGatedFetch(...) turns the same gate into a fetch-shaped vendor for tests and agent loops.

What it does that a bare 402 snippet doesn't

  • Quote consistency. A presented payment must match the gate's own quote — scheme, network, amount, recipient — before any facilitator round-trip. Underpayment is refused at the door.
  • Payer screening. Allow/deny lists plus a dynamic screen.check hook (reputation plugs in here — see @reinconsole/graph's payerCheck), checked before verify/settle, so a blocked payer costs you nothing.
  • Replay protection. Each payment settles once; the slot is burned before the async legs, so two concurrent copies can't both pass.
  • Velocity caps + rate limiting. Per-payer settled-spend caps (maxPayments / maxAmount) and a sliding-window presentation limiter (maxAttempts → 429 + Retry-After). Throttle refusals happen before the replay burn, so a held payment clears once the window slides.
  • Honest rails failures. Provably-unsent transport failures are retried, then refused rails_unavailable with the replay slot released; an ambiguous settle refuses settle_unknown with the slot kept burned — the money may have moved, and the gate never guesses.
  • Receipts + revenue. Every settlement becomes a GateReceipt; gate.stats() aggregates revenue by asset, route, and payer; quoted / settled / refused events stream on the bus.
  • x402 v2 dual-stack. Accepts both payment dialects always; advertiseV2 adds the v2 PAYMENT-REQUIRED header quote beside the v1 body; CAIP-2 and v1 network ids normalize in consistency checks.
  • Pluggable rails. The same gate runs against the mock facilitator (@reinconsole/mock-rails) or the real hosted facilitator (@reinconsole/x402-rails) — a two-method structural seam.

MIT © Rein contributors · Repository · Issues