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

@monetize.software/sdk

v3.0.0-alpha.4

Published

Monetize SDK — bundled billing client and paywall render engine for web and Chrome extensions

Readme

@monetize.software/sdk

SDK 3.0 — bundled billing client and paywall render engine. Embeds into Chrome extensions and websites via npm / CDN, with no iframe and no remote code.

Status: alpha, WIP. See TODO.md.

Three entrypoints

// server / headless billing — API only, no UI
import { BillingClient } from '@monetize.software/sdk/core';

// host renders its own UI but needs our modal
import { PaywallUI } from '@monetize.software/sdk/ui';

// all in one — auth layer is loaded lazily
import { PaywallUI } from '@monetize.software/sdk';

Quick start

import { PaywallUI } from '@monetize.software/sdk';

const paywall = new PaywallUI({
  paywallId: 'pw_abc123',
  identity: { email: user.email, userId: user.id }
});

paywall.on('checkout_started', ({ url }) => {
  window.open(url, '_blank');
});

document.getElementById('upgrade').onclick = () => paywall.open();

Scripts

pnpm install
pnpm dev          # local demo at http://localhost:5060/demo/
pnpm build        # ESM + CJS + .d.ts into dist/
pnpm typecheck
pnpm size         # bundle-size gate
pnpm test

Architecture (in brief)

  • Preact (not React) — 3KB instead of 45KB. Critical for the bundle budget.
  • Shadow DOM ({ mode: 'closed' }) — style isolation.
  • Tailwind v4, compiled into a CSS string and injected into the shadow root.
  • Server-driven layout — JSON schema of blocks (heading, price_grid, cta_button, ...). SDK knows how to render blocks; the server controls order, copy, and visibility.
  • Server-driven checkout — SDK is provider-agnostic (Stripe/Paddle/Chargebee), it just opens the checkout_url returned by the server.

Metered AI proxy (ApiGatewayClient)

The platform supports proxying calls to OpenAI/Anthropic/any HTTP API with token accounting against paywall_balances. The SDK ships a thin client to this proxy and maintains local balance state.

import { BillingClient, AuthClient, QuotaExceededError } from '@monetize.software/sdk/core';

const auth = new AuthClient({ paywallId: 'pw_abc' });
const billing = new BillingClient({ paywallId: 'pw_abc', auth });
const gateway = billing.createApiGatewayClient();

billing.onBalanceChange((balances) => {
  // Render quota counter in UI
});

try {
  // SSE stream: returns a raw Response, no built-in parser.
  const res = await gateway.call({
    providerId: 'prov_openai',
    path: '',
    body: { model: 'gpt-4', stream: true, messages: [...] },
    signal: controller.signal
  });
  for await (const chunk of res.body!) {
    /* ... */
  }
} catch (e) {
  if (e instanceof QuotaExceededError) {
    paywall.open(); // upgrade prompt
  } else throw e;
}
  • BillingClient.createApiGatewayClient() wires the Bearer from AuthClient, optimistically decrements cachedBalances on success, and refetches /balances on 402.
  • gateway.call() returns the raw Response. Caller decides: .json(), .body.getReader(), or async-iter — anything that works on a fetch Response.
  • On 402, QuotaExceededError is thrown with balances / queryType / currentBalance.

Not in this version (alpha)

  • Auth layer (Google / Apple / Email) — coming after the hybrid beta.
  • Timer-based trials, A/B variants, localization.
  • Framework adapters (@monetize/react).
  • Tests.