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/core

v0.6.0

Published

The shared type system and config authoring toolkit for [Revstack](https://revstack.dev) — Billing as Code for SaaS.

Readme

@revstackhq/core

The shared type system and config authoring toolkit for Revstack — Billing as Code for SaaS.

This package provides the type-safe helper functions (defineConfig, defineFeature, definePlan, etc.) used to write revstack.config.ts, plus the runtime validation engine that powers the CLI and server-side config processing.

Installation

npm install @revstackhq/core

Usage

Writing a Billing Config

Use the identity helpers to get full autocompletion and compile-time validation in your revstack.config.ts:

import { defineConfig, defineFeature, definePlan } from "@revstackhq/core";

const features = {
  seats: defineFeature({
    name: "Seats",
    type: "static",
    unit_type: "count",
  }),
  ai_tokens: defineFeature({
    name: "AI Tokens",
    type: "metered",
    unit_type: "count",
  }),
};

export default defineConfig({
  features,
  plans: {
    default: definePlan<typeof features>({
      name: "Default",
      is_default: true,
      is_public: false,
      type: "free",
      features: {},
    }),
    pro: definePlan<typeof features>({
      name: "Pro",
      is_default: false,
      is_public: true,
      type: "paid",
      prices: [
        {
          amount: 2900,
          currency: "USD",
          billing_interval: "monthly",
          trial_period_days: 14,
        },
      ],
      features: {
        seats: { value_limit: 5, is_hard_limit: true },
        ai_tokens: { value_limit: 1000, reset_period: "monthly" },
      },
    }),
  },
});

Type-Safe Feature Keys

When you pass typeof features as a generic to definePlan<typeof features>(...), the features object is restricted to only the keys defined in your feature dictionary. Typos become compile-time errors:

// ✅ Compiles — "seats" exists in features
definePlan<typeof features>({ ..., features: { seats: { value_limit: 5 } } });

// ❌ Compile error — "seets" is not a valid key
definePlan<typeof features>({ ..., features: { seets: { value_limit: 5 } } });

API Reference

Config Helpers

| Function | Description | | ------------------ | ------------------------------------------------------------- | | defineConfig() | Wraps the root revstack.config.ts export for type inference | | defineFeature() | Define a feature (static, metered, or boolean) | | definePlan() | Define a plan with optional compile-time feature key checks | | defineAddon() | Define an add-on (same generic pattern as definePlan) | | defineDiscount() | Define a discount/coupon |

Validation Engine

The validator module provides runtime validation for billing configs, ensuring structural correctness before they're pushed to Revstack Cloud.

Types

All shared TypeScript types are exported from the package root — FeatureDefInput, PlanDefInput, PlanFeatureValue, RevstackConfig, and more.

Architecture

@revstackhq/core is a zero-dependency package designed to be shared across:

  • @revstackhq/cli — Uses the define helpers and validator at config-loading time.
  • @revstackhq/node — Depends on the shared type system for API contracts.
  • User projects — Imported directly in revstack.config.ts for type-safe authoring.

License

FSL-1.1-MIT