What is Revstack?
Revstack is a billing infrastructure platform for SaaS companies. Define your plans and entitlements in code, connect a payment provider, and let the platform handle entitlement checks, usage tracking, subscription lifecycle, and webhook orchestration. Think of it as Stripe for billing logic — you get the infrastructure without building it yourself.Core Capabilities
Entitlements
Check feature access in real-time with
entitlements.check(). Works with boolean flags, numeric limits, and metered usage.Usage Metering
Track consumption of metered features (API calls, AI tokens, storage) with automatic quota enforcement.
Subscriptions
Create, upgrade, downgrade, and cancel subscriptions with lifecycle management handled for you.
Provider Abstraction
Connect Stripe, Polar, or other payment providers. Switch providers without rewriting your app.
Architecture Overview
Revstack operates across two planes:Data Plane (Runtime Operations)
The data plane handles your daily backend operations:- Entitlement Checks —
revstack.entitlements.check()validates feature access - Usage Reporting —
revstack.usage.report()tracks metered consumption - Subscription Management — Create, modify, and cancel subscriptions
- Customer Records — Manage end-user data and billing profiles
- Webhooks — Verify signatures and handle provider events
Control Plane (Infrastructure Management)
The control plane manages your billing infrastructure:- Billing as Code — Define plans, features, and pricing in
revstack.config.ts - Plan CRUD — Programmatically manage plans via
revstack.admin.plans - Integrations — Connect and configure payment providers
- Environments — Manage dev/staging/production deployments
revstack push) or admin API to sync your billing configuration to Revstack Cloud.
How It Works
Define Your Billing Config
Create a
revstack.config.ts file with your features, plans, and pricing:revstack.config.ts
Key Features
Type-Safe Configuration
Define your billing config with full TypeScript inference. ThedefinePlan<typeof features> pattern ensures you only reference features that exist:
Flexible Entitlement Types
Support all common billing patterns:- Boolean — On/off flags (e.g., “SSO Access”, “Custom Branding”)
- Static — Fixed limits per plan (e.g., “5 Team Seats”)
- Metered — Usage-based with automatic resets (e.g., “10,000 API calls per month”)
Payment Provider Abstraction
The provider gateway lets you:- Switch payment providers without code changes
- Use multiple providers simultaneously (e.g., Stripe for US, Polar for Europe)
- Test billing logic without real payment accounts
Multi-Environment Support
Manage separate configurations for development, staging, and production. Deploy billing changes safely with preview environments.Package Ecosystem
Revstack is distributed as a monorepo with specialized packages:Client SDKs (MIT)
| Package | Description |
|---|---|
@revstackhq/node | Server-side SDK for Node.js |
@revstackhq/react | React hooks and context |
@revstackhq/next | Next.js integration with SSR support |
@revstackhq/browser | Vanilla TypeScript browser client |
@revstackhq/auth | JWT verification for Auth0, Clerk, Supabase, etc. |
@revstackhq/cli | Command-line tool for config management |
Core Infrastructure (FSL-1.1-MIT)
| Package | Description |
|---|---|
@revstackhq/core | Entitlement engine and config authoring |
@revstackhq/providers-core | Provider gateway interfaces |
@revstackhq/provider-stripe | Stripe provider implementation |
Client SDKs are MIT-licensed for unrestricted use. Core infrastructure uses the Functional Source License and converts to MIT after two years.
Use Cases
SaaS Feature Gating
API Rate Limiting
AI Token Metering
Team Seat Management
Next Steps
Quickstart
Build your first billing-enabled app in 5 minutes
Installation
Detailed setup instructions for all SDKs
API Reference
Complete SDK documentation
Core Concepts
Learn about billing as code and entitlements