revstack.config.ts, then push them to Revstack Cloud with a single command.
Key Features
- Billing as Code: Define your entire billing model in a type-safe TypeScript configuration file
- Zero-Build Config Loading: Evaluates
revstack.config.tson the fly usingjiti— no separate compilation step needed - Diff Before Deploy: Every
pushshows a detailed diff of what will change before anything goes live - Environment Targeting: Push and pull configs to/from different environments (
test,production, etc.) - Interactive Authentication: Securely store your API key locally at
~/.revstack/credentials.json
Installation
Install globally via npm:Quick Start
1. Initialize a Config
Scaffold a newrevstack.config.ts in your project root:
- A
revstack/directory containing modular configuration files - A
revstack.config.tsfile that imports and combines them - A starter config with example plans and features
revstack/features.ts
revstack/plans.ts
2. Authenticate
Log in with your Revstack Secret Key (found in the Revstack Dashboard):3. Deploy
Push your config to Revstack Cloud:- Validate your
revstack.config.tsfor schema and business logic errors - Calculate a diff against the current remote state
- Display a color-coded summary of changes (additions, removals, updates)
- Ask for confirmation before applying
4. Pull Remote State
Fetch the current billing configuration from Revstack Cloud and overwrite your local files:- Syncing changes made in the Revstack Dashboard back to your codebase
- Pulling configuration from one environment to another
- Team collaboration when multiple developers work on billing config
5. Log Out
Clear stored credentials:Configuration File
Therevstack.config.ts file is the entry point for your billing configuration. It uses type-safe helpers from @revstackhq/core to define your billing model:
Templates
Theinit command supports several templates to help you get started quickly:
- starter (default): Basic setup with a free and paid plan
- b2b-saas: Tiered pricing for business software
- usage-based: Metered billing for API/infrastructure products
- ecommerce-platform: Transaction-based pricing
- developer-tools: Per-developer seat licensing
- ai-agent-platform: Token-based consumption pricing
Architecture
The Revstack CLI is intentionally a “dumb client.” All complex diffing, validation, and migration logic lives on the Revstack Cloud backend. The CLI’s responsibilities are limited to:- Config Loading: Evaluate
revstack.config.tsat runtime usingjitiand sanitize the output to plain JSON - Authentication: Store and retrieve the API key from
~/.revstack/credentials.json - Network Communication: Send the parsed config to the Revstack API and display the results
Next Steps
- Command Reference - Detailed documentation for all CLI commands
- Configuration Guide - Learn how to configure plans, features, and pricing
- Environment Management - Best practices for managing multiple environments