Skip to main content

Billing infrastructure for SaaS

Entitlements, subscriptions, usage metering, and payment provider abstraction — so you can ship features instead of billing plumbing.

Quick Start

Get up and running with Revstack in minutes

1

Install the SDK

Install the Revstack SDK for your platform:
npm install @revstackhq/node
2

Initialize the client

Create a Revstack client instance with your secret key:
import { Revstack } from "@revstackhq/node";

const revstack = new Revstack({
  secretKey: process.env.REVSTACK_SECRET_KEY
});
Get your secret key from the Revstack Dashboard
3

Define your billing configuration

Create a revstack.config.ts file to define your plans and features:
revstack.config.ts
import { defineConfig, defineFeature, definePlan } from "@revstackhq/core";

const features = {
  "api-calls": defineFeature({
    key: "api-calls",
    name: "API Calls",
    type: "limit",
  }),
};

export default defineConfig({
  features,
  plans: [
    definePlan<typeof features>({
      key: "starter",
      name: "Starter",
      features: {
        "api-calls": { value_limit: 1000 },
      },
    }),
  ],
});
4

Check entitlements

Use the SDK to check if a customer can access a feature:
const { allowed, remaining } = await revstack.entitlements.check(
  "customer_id",
  "api-calls"
);

if (!allowed) {
  throw new Error("API limit exceeded");
}
{
  "allowed": true,
  "remaining": 750,
  "limit": 1000,
  "reset_at": "2024-02-01T00:00:00Z"
}

Explore by Topic

Learn about Revstack’s core capabilities

Billing as Code

Define plans and features in TypeScript with full type safety

Entitlements

Control feature access with flexible entitlement rules

Usage Metering

Track and limit feature usage with real-time metering

Subscriptions

Manage customer subscriptions and billing lifecycle

Payment Providers

Abstract away payment provider complexity with unified interfaces

Auth Integration

Integrate with Auth0, Clerk, Supabase, and more

SDKs & Tools

Choose the SDK that fits your stack

Node.js SDK

Server-side SDK for Node.js applications

React SDK

React hooks and components for client-side integration

Next.js SDK

Full-stack integration for Next.js applications

Browser SDK

Lightweight client-side SDK for web applications

Resources

Additional resources to help you succeed

CLI Reference

Manage your billing infrastructure from the command line

API Reference

Comprehensive API documentation for all SDKs

GitHub Repository

Explore the source code and contribute

Community & Support

Get help and share feedback with the community

Ready to get started?

Start building with Revstack today and ship billing features faster.

Get Started