Monetize your Software in Minutes.
Revstack is the open-source Billing OS for modern SaaS. Define your pricing and entitlements in code, eliminate the webhook hell, and control your revenue from a centralized infrastructure.
1import { defineConfig } from "@revstack/core";2
3export default defineConfig({4 features: [5 {6 slug: "seats",7 name: "Team Seats",8 type: "metered",9 unit_type: "count",10 },11 ],12
13 plans: [14 {15 slug: "pro",16 name: "Pro",17 type: "paid",18 status: "active",19 prices: [20 {21 amount: 2900,22 currency: "USD",23 billing_interval: "monthly",24 },25 ],26 features: {27 seats: { value_limit: 5, is_hard_limit: true },28 api_calls: { value_limit: 100000, reset_period: "monthly" },29 },30 },31 ],32});$ npx revstack push✓ Connected to Revstack✓ Validated revstack.config.ts (Strict Mode)✓ Synced 1 Plan & 2 Features🚀 Push complete!A Developer Experience you'll actually love
From codebase to first revenue in a few minutes. Define your pricing model, deploy it to the edge, and start checking entitlements without ever leaving your IDE.
Define your truth in code
Your codebase is the single source of truth. Define plans, entitlements, addons, and coupons in a type-safe config file that lives alongside your app, gets reviewed in PRs, and versions naturally.
1import { defineConfig } from "@revstack/core";2
3export default defineConfig({4 plans: [5 {6 slug: "pro",7 name: "Pro",8 type: "paid",9 status: "active",10 prices: [11 {12 amount: 2900,13 currency: "USD",14 billing_interval: "monthly",15 },16 ],17 features: {18 api_calls: { value_limit: 100000, reset_period: "monthly" },19 },20 },21 ],22
23 features: [24 {25 slug: "api_calls",26 name: "AI Tokens",27 type: "metered",28 unit_type: "currency",29 },30 ],31
32});Push and pull your changes
A single CLI command validates your billing configuration and syncs it to the Revstack Engine. Payment provider resources are created on-demand during checkouts, keeping your payment provider dashboard clean.
$ npx revstack push✓ Connected to Revstack Cloud✓ Validated revstack.config.ts (Strict Mode)✓ Synced 4 Plans & 12 Features🚀 Push complete!Gate any feature in one line
Check who has access to what, and how much they can use. The entitlements engine responds in sub-milliseconds, works in any runtime—React Server Components, API routes, or background workers.
1import { revstack } from "@/lib/revstack";2
3export async function POST(req: Request) {4 const access = await revstack.entitlements.check({5 feature: "pdf_export",6 userId: "usr_123"7 });8
9 if (!access.granted) {10 return Response.json(11 { error: "Upgrade to Pro to unlock this." },12 { status: 403 }13 );14 }15
16 return Response.json({ ok: true });17}Charge through any provider
Generate high-converting checkout sessions without building payment forms. Revstack handles proration, taxes, and provider routing under the hood—whether your customer pays via Stripe, PayPal, or Paddle.
1import { revstack } from "@/lib/revstack";2import { redirect } from "next/navigation";3
4export async function POST(req: Request) {5 const session = await revstack.checkout.create({6 plan: "pro",7 userId: "usr_123",8 successUrl: "https://app.com/welcome",9 });10
11 // Revstack routes to the right provider12 redirect(session.url);13}No more webhook configuration
Stop maintaining fragile webhook endpoints. Revstack manages the subscription lifecycle—upgrades, downgrades, cancellations, and renewals—so you can query the current state directly instead of reacting to events.
1// No more api calls to your payment provider ❌2
3// Just query the current state ✅4import { revstack } from "@/lib/revstack";5
6// Get the current user from your auth provider.7const user = await getUser();8
9const sub = await revstack.subscriptions.get(user.id);10
11if (sub.status === "past_due") {12 return renderGracePeriodWarning();13}14
15console.log(`Renews at: ${sub.currentPeriodEnd}`);Robust primitives for complex SaaS.
Built on a foundation of event sourcing and edge computing. Revstack abstracts the chaos of billing states, webhooks, and limits into clean, predictable APIs.
const access = await revstack.check({
feature: "api_calls",
customerId: user.id
});
if (!access.granted) {
return Response.json(
{ error: "Upgrade" },
{ status: 403 }
);
}Edge-Ready Entitlements
Check user access in sub-milliseconds globally. Block unauthorized features before your API even boots.
// revstack.config.ts
providers: [
stripe({
secretKey: env.STRIPE_KEY
}),
polar({
accessToken: env.POLAR_KEY
})
]Agnostic Gateway
Switch between payment providers without touching your codebase. We normalize every webhook into a single truth.
await revstack.meter({
feature: "api_calls",
customerId: user.id,
value: 1
});
// Batched & aggregated
// automatically at the edgeHigh-Throughput Metering
Ingest millions of AI tokens, API requests, or gigabytes per second. Batched, aggregated, and synced automatically.
const access = await revstack.check({
feature: "api_calls",
// userId is undefined
// → auto-fingerprint
});
// guest_fp_a7f3d2e1
// → Default Guest PlanAnonymous Fingerprinting
Stop trial abuse natively. Track guests via device telemetry and seamlessly merge their usage when they finally sign up.
const session = await revstack
.checkout.create({
plan: "pro_monthly",
customerId: user.id,
successUrl: "/dashboard",
cancelUrl: "/pricing"
});Hosted Checkout
Drop-in, high-converting payment pages. Fully localized, tax-compliant, and optimized for your pricing model.
const portal = await revstack
.portal.create({
customerId: user.id,
returnUrl: "/settings"
});
// → Hosted billing UISelf-Serve Portal
Give your users a zero-code dashboard to upgrade plans, manage seats, and download invoices without asking support.
// Wallet type entitlement
// Auto-deducts on usage
await revstack.streamText({
model: openai("gpt-4"),
entitlementKey: "ai_credits",
customerId: user.id
});Prepaid Wallets
Let users buy AI credits or API tokens upfront. Auto-deduct usage in real-time and gracefully fallback to plan overages.
// revstack.config.ts
plans: [{
name: "Pro",
price: { monthly: 29 },
entitlements: [
boolean("analytics"),
metered("api_calls", 10000)
]
}]Centralized Billing in Code
Define pricing tiers, feature limits, discount coupons, addons and overages in a single TypeScript config. Push to the engine and sync instantly.
$ docker pull revstack/engine $ docker run -d \ -e DATABASE_URL=... \ -e REVSTACK_KEY=... \ -p 3000:3000 \ revstack/engine
100% Open Engine
Deploy the core engine on your own AWS/GCP infrastructure. Audit the code, own your data, and avoid vendor lock-in.
Launch complex pricing in minutes.
Don't reinvent the wheel. Start with production-ready architectures for B2B SaaS, AI wrappers, or metered APIs. One command scaffolds your entire pricing logic, ready to be deployed.
AI Agents & Credits
Pre-configured for token metering, prompt limits, and auto-refilling wallets for AI wrappers.
Per-Seat B2B SaaS
Ready for pro-rated team members, role-based access control (RBAC), and enterprise SSO limits.
Cloud & Pay-As-You-Go
Pure metered billing. Track gigabytes, compute hours, or API requests with tiered volume pricing.
Hybrid (Base + Overages)
Fixed monthly platform fees combined with usage-based overages. The standard for scaling SaaS.
Marketplace Platform
Take a percentage cut of transactions combined with flat monthly merchant subscriptions.
PLG & Freemium
Generous free tiers with strict usage limits, gated power-ups, and automated upsell logic.
Entitlements as Primitives. Control anything.
Features aren't just booleans. Revstack treats entitlements as typed primitives: Boolean, Metered (Count, Wallet, Bytes, Seconds), Static, and JSON. They remain dormant until attached to a Plan, giving you the context to safely gate routes, issue AWS signed URLs, or trigger custom executions like Slack VIP invites.
Active Plan
Founding Member
Resolved Value · JSON Primitive
{ workspaceId: "T123", channelName: "#pro-founders" }
1import { revstack } from "@/lib/revstack";2import { slack } from "@/lib/slack";3
4export async function POST(req: Request) {5 const { userId } = await req.json();6
7 // 1. Resolve the entitlement within the context of the user's current plan8 const access = await revstack.entitlements.resolve({9 feature: "vip_community_access",10 customerId: userId11 });12
13 if (!access.granted) {14 return Response.json({ error: "Upgrade required" }, { status: 403 });15 }16
17 // 2. The entitlement is a JSON primitive. 18 // We extract the plan-specific payload securely configured in Revstack.19 const { workspaceId, channelName } = access.value;20 // e.g., { workspaceId: "T123", channelName: "#pro-founders" }21
22 // 3. Execute custom business logic using the secure context23 const inviteUrl = await slack.admin.createInvite(24 workspaceId, channelName, userId25 );26
27 return Response.json({ inviteUrl });28}Bring your own Identity.
Revstack is entirely agnostic by design. Whether you use Supabase, Clerk, Auth0, or a custom solution, simply pass the user ID to our SDKs to check entitlements across any frontend or backend framework.
1'use client';2
3import { RevstackProvider } from "@revstack/react";4import { useAuth } from "@clerk/nextjs";5
6export function AppProviders({ children }) {7 const { getToken } = useAuth();8
9 return (10 <RevstackProvider11 config={{12 publicKey: process.env.NEXT_PUBLIC_REVSTACK_KEY,13 // Seamless auth resolution14 getToken: () => getToken(),15 }}16 >17 {children}18 </RevstackProvider>19 );20}The end of Webhook Hell.
Stripe, Paddle, LemonSqueezy, or PayPal—they all converge into a single, unified API. Stop maintaining brittle endpoint handlers. We absorb the payment events, normalize the logic, and orchestrate the entire subscription lifecycle for you.
High-converting Hosted Checkout.
High-converting, hosted checkout sessions. Stop rebuilding payment forms and let Revstack handle the complex edge cases under the hood: global tax calculation, prorations, discounts, and 3D Secure routing.
1import { revstack } from "@/lib/revstack";2
3// Get the current user from your auth provider.4const user = await getUser();5
6// Create a checkout session.7const session = await revstack.checkout.create({8 customerId: user.id,9 planId: "pro_monthly",10 successUrl: "https://yourapp.com/dashboard",11});12
13// Redirect the user.14return redirect(session.url);
Self-Serve Billing Portal.
Drop-in subscription management. Give your users a fully white-labeled portal to handle upgrades, payment methods, and invoice histories. Zero frontend code or maintenance required from your team.

1import { revstack } from "@/lib/revstack";2
3// Get the current user from your auth provider.4const user = await getUser();5
6// Generate a secure, one-time link to the billing portal.7const session = await revstack.portal.create({8 customerId: user.id,9 returnUrl: "https://yourapp.com/dashboard",10});11
12// Let your users manage upgrades, downgrades, invoices, and more.13return redirect(session.url);Anonymous usage, fully metered.
Protect your compute and unit economics from free-tier abuse. Revstack natively integrates with Fingerprint to assign Default Guest Plans to unauthenticated traffic, silently tracking and metering usage before they even sign up.
Anonymous Device
UA: Chrome/120 • macOS
Generated Guest ID
guest_fp_a7f3d2e1
1import { revstack } from "@/lib/revstack";2
3// If no userId is passed, Revstack automatically fingerprints4// the device and applies the 'guest' plan limits.5const access = await revstack.check({6 feature: "api_calls",7 // userId: is left undefined8});9
10if (!access.granted) {11 return new Response("Sign up to continue using this feature.", {12 status: 40313 });14}Prepaid Wallets
Built for the AI and API economy. Issue custom Prepaid Wallets (like "AI Tokens" or "Compute Hours"). Revstack natively drains prepaid balances first, smoothly failing over to standard plan billing only when credits hit zero.
1import { revstack } from "@/lib/revstack";2
3// 1. User buys a one-time top-up of 50,000 credits4await revstack.wallets.credit({5 customerId: "usr_123",6 walletId: "ai_tokens",7 amount: 500008});9
10// 2. Report usage later. Revstack deducts from the wallet FIRST.11// If the wallet is empty, it automatically bills the plan's overage rate.12const tx = await revstack.metering.record({13 customerId: "usr_123",14 feature: "ai_tokens",15 amount: 450016});17
18console.log(`Remaining balance: ${tx.remainingWalletBalance}`);Available Balance
AI Tokens
Auto-fallback active
Bills $0.02 / 1k tokens on overage
Auto-metering for the Vercel AI SDK.
Stop manually counting tokens and writing complex billing logic. Define a wallet entitlement in your plan, set your margin, and Revstack automatically tracks token consumption, resolves the model's live pricing, and deducts the cost from your customer's credit balance.
Plan: Pro
AI Credits Feature Active
Type: Wallet
10,000
Credit Limit
0.8
Margin
Stream Completed · GPT-4 Turbo
450
Prompt Tokens
120
Completion Tokens
Credit Deduction
Model Cost
$0.008
Margin
× 1.8
Final Cost
$0.015
−15 credits
deducted from AI Credits
Remaining
9,985
Formula
(promptTokens × inputPrice + completionTokens × outputPrice) × (1 + margin)
Model pricing is resolved automatically by Revstack per million tokens.
Flexible Overage
If configured, customers can exceed their credit limit up to the overage cap you set for that plan.
Auto-Rejection
The SDK blocks AI execution when the customer has no credits and overage is not allowed or the limit is reached.
1import { trackUsage } from "@revstackhq/next/server";2import { createRevstackAI } from "@revstackhq/ai";3
4export const revstack = createRevstackAI(5 { secretKey: process.env.REVSTACK_SECRET_KEY! },6 trackUsage7);1import { revstack } from "@/lib/revstack";2import { openai } from "@ai-sdk/openai";3import { getUser } from "@/lib/auth";4
5export async function POST(req: Request) {6 const { messages } = await req.json();7
8 // Get the current user from your auth provider.9 const user = await getUser();10
11 // Drop-in replacement for Vercel's streamText12 const result = await revstack.streamText({13 model: openai("gpt-4-turbo"),14 messages,15 // Revstack tracks usage and bills this entitlement16 entitlementKey: "ai_credits",17 customerId: user.id, // If not provided, track usage as guest user18 });19
20 return result.toDataStreamResponse();21}Pricing that scales with your infrastructure.
Revstack Cloud officially launches on April 20th exclusively for Founding Members. The public launch will be announced at a later date. Secure your lifetime license today or join the waitlist!
Hobby$0/mo Perfect for side projects. | Pro$63/mo The standard for serious SaaS. | Teams$159/mo For growing organizations. | Business$479/mo For high-volume operations. | EnterpriseCustom For custom enterprise architecture. | |
|---|---|---|---|---|---|
| Core Limits | |||||
| Revenue Limit | Unlimited | Unlimited | Unlimited | Unlimited | Unlimited |
| Subscriptions | 100 | 2,500 | 10,000 | 50,000 | Custom |
| Customers | 5,000 | 25,000 | 100,000 | 500,000 | Custom |
| Events | 10k | 250k | 1M | 5M | Unlimited |
| Members | 1 | Up to 5 | Up to 10 | Unlimited | Unlimited |
| Providers | 2 | 5 | 10 | Unlimited | Unlimited |
| Fees | |||||
| Success Tax (% of Revenue) | 0% | 0% | 0% | 0% | 0% |
| Features & Support | |||||
| Advanced Payment Orchestration | |||||
| Remove Revstack Badge | |||||
| Point-in-time Recovery | Custom | ||||
| Enterprise SSO | |||||
| On-premise deployment | |||||
| Support | Community | Priority Email | Priority Email | Dedicated Slack | Custom SLAs |
Self-Hosted Open Source
Prefer to manage your own servers? Deploy the Revstack™ Engine via Docker in minutes.