Skip to content
The xtandard-entitlements logoThe xtandard-entitlements logo

Plans and usage limits, inside your app

Declare your pricing model in code, gate features and meter usage in-process with atomic counters, sync plan state from any billing provider, and give your team an admin UI and your customers a usage portal. Your database, your process.
Terminal window
bun add @xtandard/entitlements

The Stigg / Schematic / Autumn niche, as an MIT library: billing-provider-agnostic, storage-pluggable and framework-agnostic. check() is a memory read, consume() is one atomic step and a refused request never counts. Invoicing, tax, dunning and payments stay with your provider.

import { defineCatalog, feature } from "@xtandard/entitlements/catalog";
export const catalog = defineCatalog({
features: {
seats: feature.capacity({ name: "Seats", unit: "seat" }),
api_calls: feature.metered({ name: "API calls", unit: "call", reset: "month" }),
export_pdf: feature.boolean({ name: "PDF export" }),
},
plans: {
free: { default: true, features: { seats: 3, api_calls: 1_000 } },
pro: {
trial: { days: 14 },
providers: { stripe: ["price_pro_monthly"] },
features: { seats: 10, api_calls: { limit: 100_000, overage: "allow" }, export_pdf: true },
},
},
});

Zero dependencies, fully typed — the same file drives your API, your React gates and your pricing page. Catalog guide →

A typed catalog

Boolean, metered, credits, capacity and value features; plan groups, defaults, trials, add-ons and versioned plans for grandfathering.

Atomic metering

A counter port where every consume is one atomic step; Redis, Postgres, SQLite, MongoDB, Drizzle or memory; optional write-behind counters for hot soft limits.

Any billing provider

Stripe, Polar, Paddle, Lemon Squeezy, better-auth’s Stripe plugin and manual plans — verified, idempotent, order-safe webhook intake, no SDKs.

Admin UI and customer portal

Look up customers, comp features, raise limits, see usage — and give customers their plan, usage and upgrade link-outs behind short-lived portal tokens.

React

useEntitlement, <Gate>, <UsageMeter>, <PricingTable>, <UpgradePrompt>, plus the full dashboard and portal as embeddable components.

One gate with flags

An OpenFeature provider and hook so @xtandard/flags rules can target plan and entitlement.* — rollouts and plan gates share one decision.

@xtandard/entitlements has siblings: open-source, MIT-licensed projects that share the xtandard name. Each one stands on its own.

All of them, with npm and GitHub links: the xtandard ecosystem.