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

@revstackhq/node

v0.6.1

Published

The official Node.js / TypeScript server SDK for [Revstack](https://revstack.dev) — billing infrastructure for SaaS.

Readme

@revstackhq/node

The official Node.js / TypeScript server SDK for Revstack — billing infrastructure for SaaS.

Provides a single Revstack client with two namespaces:

  • Data Plane (revstack.*) — Daily backend operations: entitlement checks, usage reporting, subscriptions, customers, wallets, plans, invoices, and webhook verification.
  • Control Plane (revstack.admin.*) — Infrastructure management: plan CRUD, entitlement CRUD, integrations, and environments.

Installation

npm install @revstackhq/node

Quick Start

import { Revstack } from "@revstackhq/node";

const revstack = new Revstack({
  secretKey: process.env.REVSTACK_SECRET_KEY!,
});

Check Feature Access

const { allowed, limit, usage } = await revstack.entitlements.check(
  "cus_abc123",
  "api-calls",
);

if (!allowed) {
  return res.status(403).json({ error: "Upgrade required" });
}

Report Usage

await revstack.usage.report({
  customer_id: "cus_abc123",
  feature_id: "api-calls",
  delta: 1,
});

Manage Subscriptions

// Create a subscription
const sub = await revstack.subscriptions.create({
  customer_id: "cus_abc123",
  plan_id: "plan_pro",
});

// Change plan
await revstack.subscriptions.changePlan(sub.id, {
  plan_id: "plan_enterprise",
});

Verify Webhooks

const event = revstack.webhooks.constructEvent(
  requestBody,
  signatureHeader,
  webhookSecret,
);

API Reference

Data Plane Modules

| Module | Description | | --------------- | ------------------------------------------- | | customers | Create, update, and query customer records | | subscriptions | Create, cancel, and manage subscriptions | | entitlements | Check feature access and query entitlements | | usage | Report and query metered feature usage | | wallets | Manage customer wallet balances | | webhooks | Verify inbound webhook signatures | | plans | Query billing plans (read-only) | | invoices | Query billing invoices (read-only) |

Control Plane (admin)

| Module | Description | | -------------------- | ------------------------------------ | | admin.plans | CRUD operations for billing plans | | admin.entitlements | CRUD operations for entitlements | | admin.integrations | Manage payment provider integrations | | admin.environments | Manage deployment environments |

Error Hierarchy

The SDK provides a structured error hierarchy for precise error handling:

import { Revstack, RateLimitError, RevstackAPIError } from "@revstackhq/node";

try {
  await revstack.entitlements.check("cus_abc", "api-calls");
} catch (error) {
  if (error instanceof RateLimitError) {
    // Retry after error.retryAfter seconds
  } else if (error instanceof RevstackAPIError) {
    // API returned a non-2xx status
    console.error(error.status, error.message);
  }
}

| Error | Description | | ---------------------------- | ------------------------------------------- | | RevstackError | Base error class for all SDK errors | | RevstackAPIError | API returned a non-2xx response | | RateLimitError | Rate limit exceeded (includes retryAfter) | | SignatureVerificationError | Webhook signature verification failed |

Constructor Options

new Revstack({
  secretKey: "sk_live_...", // Required — your Revstack Secret Key
  baseUrl: "https://...", // Optional — API base URL (default: https://app.revstack.dev/api/v1)
  timeout: 10000, // Optional — request timeout in ms (default: 10000)
});

License

MIT