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

@pax8/core

v0.1.4

Published

Core API client, auth, services, and types for Pax8

Readme

@pax8/core

Computed business logic for Pax8 marketplace operations — renewal tracking, invoice audit, upsell recommendations, and MRR analytics. Interface-agnostic: the same package powers pax8-cli, and is usable from a portal feature, a web dashboard, a Lambda, or any Node.js context. The Pax8 API is a CRUD layer; this package is what turns raw subscriptions, invoices, and products into the answers MSPs actually ask for.

Install

pnpm add @pax8/core
# or: npm install @pax8/core
# or: yarn add @pax8/core

Requires Node.js 20+. ESM only.

Quick example

Compute upcoming renewals and total estimated MRR at risk for the next 30 days:

import { Pax8Client, getUpcomingRenewals } from "@pax8/core";

const client = new Pax8Client({
  clientId: process.env.PAX8_CLIENT_ID!,
  clientSecret: process.env.PAX8_CLIENT_SECRET!,
});

const subsResult = await client.subscriptions.list({ status: "Active", size: 1000 });
const companiesResult = await client.companies.list({ size: 1000 });
const companyNameById = new Map(companiesResult.content.map((c) => [c.id, c.name]));

const report = getUpcomingRenewals(subsResult.content, companyNameById, {
  withinDays: 30,
});

console.log(`${report.items.length} renewals, $${report.totalMrrRenewing.toFixed(2)} estimated MRR renewing in window`);
for (const item of report.items.slice(0, 5)) {
  console.log(`  ${item.companyName} — ${item.productName} in ${item.daysUntilRenewal}d`);
}

The sub-clients return a paginated envelope ({ content, page }); pass size: 1000 (or walk pages explicitly) when you need every row in one shot. Pax8Client and MockPax8Client share the same surface: subscriptions, companies, contacts, orders, invoices, products, usage, quotes, and webhooks each expose list / get and the relevant CRUD subset.

Demo mode (no credentials):

import { MockPax8Client, getUpcomingRenewals } from "@pax8/core";

const client = new MockPax8Client();
const subsResult = await client.subscriptions.list({ status: "Active", size: 1000 });
// ...same shape as above

What's in here

The durable asset — questions this package answers without you having to assemble them from raw API calls:

  • Renewal tracker (getUpcomingRenewals) — which subscriptions renew within N days, how much estimated MRR is at risk, sorted by urgency. The Pax8 API has no renewals endpoint; this parses commitment dates and computes the report.
  • Invoice auditor (auditInvoices) — cross-references invoice line items against active subscriptions to flag overcharges, undercharges, and orphan line items with dollar impact.
  • Recommendation engine (getRecommendations, getPortfolioCoverage) — analyzes each customer's stack against backup / security / identity / productivity categories, identifies gaps, estimates MRR uplift, and emits ready-to-execute order parameters.
  • MRR analytics (subscriptionMrr, computeMrr, computeGrowth) — per-subscription MRR with annual-to-monthly amortization; aggregation by company/product/vendor; growth deltas across snapshots.
  • API client (Pax8Client) — typed wrapper over Pax8 v1 with auth, retry, and rate-limit awareness. Sub-clients: companies, contacts, subscriptions, orders, invoices, products, usage, quotes, webhooks.
  • Mock client (MockPax8Client) — drop-in replacement backed by an in-memory fixture. Same interface as Pax8Client. Used by the CLI for PAX8_DEMO=1.
  • Bulk executor (executeBulk) — concurrency-bounded batch runner with progress callbacks, used to apply a list of operations (e.g. ordering across many companies) without overwhelming the API rate limit.
  • Types and Zod schemasSubscription, Company, Invoice, Product, Order, etc., plus typed errors (ApiError, AuthError, RateLimitError, NotFoundError, ValidationError) and machine-readable error codes (ERROR_AUTH_EXPIRED, ERROR_COMPANY_NOT_FOUND, etc., as a Pax8ErrorCode union).

Versioning

Experimental. This package is currently 0.x and the public surface may change between minor versions. Pin a specific version ("@pax8/core": "0.1.0", not "^0.1.0") until the package reaches 1.0. Breaking changes will be called out in release notes.

The CLI in this repo is the reference consumer — if you're unsure how to assemble a workflow, look at how packages/cli uses these services.

License

Apache-2.0