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

platform-api-kit-client

v0.1.23

Published

Abstract API Communication for Platform

Readme

Usage

  1. .npmrc in user directory (token from https://github.com/settings/tokens)
//npm.pkg.github.com/:_authToken=___GENERATED_TOKEN___
  1. .npmrc in project

@supaapps:registry=https://npm.pkg.github.com/
  1. Ensure you initialize ApiKitInstances for 'user': Logged in user 'public': Public user 'admin': Admin panel only

Admin billing cheatsheet (frontend)

Initialize the admin billing ApiKit client once in your app (example):

import { ApiKitClient } from "supaapps-api-kit-client";

ApiKitClient.i("billing-admin").initialize(
  process.env.BILLING_API_BASE_URL!,
  async () => getAdminJwt(), // return admin bearer token
  () => {},                  // unauthorized callback (optional)
  true                       // use auth
);

Grab the admin billing API:

import { PlatformApi } from "@supaapps/platform-api-kit-client";

const billingAdmin = PlatformApi.admin().billingApi();

List products (no auth required on backend, but you can still call through admin client)

const products = await billingAdmin.listProducts();
// Filter client-side by realm_id or realm.name if needed

List entitlements for a user (admin token required)

const entitlements = await billingAdmin.listEntitlementsForUser(userId, {
  page: 1,
  per_page: 25,
  checkout_type: "local",          // or "stripe"
  expired: false,
  subscribed_until_ts_min: 1700000000,
  subscribed_until_ts_max: 1800000000,
  filter_core: "no_payments",      // only entries with no last payment
});
// Returns Laravel-style pagination with user_addresses when available

Create entitlement for a user (admin token required)

const entitlement = await billingAdmin.createEntitlement({
  user_id: userId,
  realm_id: realmId,
  product_key: "pro_monthly",
  // Optional overrides (copied from product if omitted):
  // price_in_cents, currency, interval, interval_count, config_version, config
  // Additional flags you might set:
  subscribed_until_ts: 1800000000, // expiry in epoch seconds (no auto-expiry otherwise)
  is_trial: false,
  is_canceled: false,
  is_custom_entitlement: false,
  local_reference: `admin_${userId}`, // defaults to this pattern when omitted
  checkout_type: "local",            // defaults to "local"
  workspace_id,                      // optional; ensured/created within realm if provided
});

Update entitlement for a user (admin token required)

const updated = await billingAdmin.updateEntitlement(entitlementId, {
  subscribed_until_ts: 1810000000, // extend/shorten
  config_version: 2,
  config: { plan: "pro_plus" },
  is_trial: false,
  is_canceled: false,
});
// Any entitlement field can be patched; publishes entitlement update events on backend

Reminders:

  • Admin-created entitlements do not auto-expire. Always set subscribed_until_ts on create or patch later.
  • When creating, is_subscription always follows the product and is not overrideable.