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.2.0

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. Renders the paywall in a Shadow DOM modal on your page, with no iframe.

  • Websites: install via npm and bundle, or load from a CDN (esm.sh/unpkg/jsDelivr).
  • Chrome extensions: use the dedicated @monetize.software/sdk-extension package and bundle as an npm dependency — Chrome Web Store MV3 policy forbids remote code execution, so CDN loading is not allowed.

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',
  apiOrigin: 'https://your-paywall-domain.com',  // required: your custom_domain
  identity: { email: user.email, userId: user.id }
});

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

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

apiOrigin must match the custom_domain configured for your paywall in the platform. The SDK validates it against the bootstrap response and throws invalid_config on mismatch.

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, Freemius, Chargebee, Overpay), 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', apiOrigin: 'https://your-paywall-domain.com' });
const billing = new BillingClient({ paywallId: 'pw_abc', apiOrigin: 'https://your-paywall-domain.com', 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.

What's included

  • Auth layer — Email/password, OAuth (Google, Apple, Facebook, GitHub), password reset and OTP confirmation flows. Lazy-loaded chunk: pay for it only if you instantiate AuthClient or open the SDK with auth: true.
  • Trials — time-based trial counter (LocalTrialStore on web, RemoteTrialStore in the extension offscreen) with server-side validation.
  • Localization — 27 bundled locales, lazy-loaded per active language; falls back to canonical English baked into block strings.
  • Server-driven layout — blocks, ordering, copy and visibility are owned by the platform; the SDK renders. Live preview API for the admin editor.
  • React bindings — see @monetize.software/sdk-react for <PaywallProvider>, hooks and declarative gate/button components.
  • Chrome extensions — see @monetize.software/sdk-extension for the offscreen-backed integration (single source of truth across tabs, popups, side panels).