Billing & authorization,defined as code.
Latchkey is the billing & authorization OS for SaaS. Define plans, entitlements, feature flags, and permissions in one config — push it live, and let Latchkey meter usage, enforce limits, and gate access at runtime. No more spreadsheets, no more hard-coded plan checks scattered across your codebase.
const features = {
api_calls: defineFeature({
key: "api_calls",
type: "metered",
unit_type: "count",
reset_period: "monthly",
}),
pdf_export: defineFeature({
key: "pdf_export",
type: "boolean",
}),
};
export default defineConfig({
features,
plans: [
definePlan({
key: "pro",
prices: [{ amount: 49, currency: "USD" }],
features: {
api_calls: { value_limit: 50_000 },
pdf_export: { enabled: true },
},
}),
],
});Powering pricing for product teams at companies of every size
Everything in one place
Replace six tools with one billing & authorization layer
Pricing logic, usage metering, feature flags, and access control usually live in different systems — and drift apart. Latchkey keeps them in sync, defined once.
Plans & entitlements as code
Model features, plans, prices, and limits with a typed DSL — defineFeature, definePlan, defineConfig. Version it, review it, ship it like any other code.
Usage metering, built in
Record usage events from your backend with one call. Latchkey aggregates, resets on schedule, and enforces hard or soft limits automatically.
Feature flags with targeting
Roll features out by org, user segment, or percentage. Resolution order is explicit: org override → targeting rules → global default.
Authorization (ReBAC) built-in
Define permissions once at the tenant level; let organizations compose their own custom roles. Relationship-based checks resolve in milliseconds.
One unified check() call
Stop scattering plan checks through your codebase. latchkey.check({ feature, flag, can }) is the single primitive for entitlement, flag, and permission gates.
Push, diff, and roll back
The CLI compiles your config, shows you a diff against the live state, and deploys with one command — staging first, then production, with full audit history.
From config to production
Four steps to billing-as-code
Define your model
Run `latchkey init` and describe your features, plans, permissions, and roles in latchkey.config.ts using a typed DSL — defineFeature, definePlan, defineAuthorization.
$ latchkey init --template b2b-seats ✓ created latchkey.config.ts
Authenticate & push
Log in with a scoped secret key, preview the diff against your live environment, and deploy — staging first, then production — all from the CLI.
$ latchkey login --env staging $ latchkey push --env staging --dry-run $ latchkey push --env staging
Gate access in your backend
Drop the @latchkey/node SDK into your API. One unified check() call resolves entitlements, flags, and permissions — then record() logs usage against the org's quota.
const { granted } = await latchkey.check({
subject: `user:${userId}`,
orgId,
feature: "pdf_export",
});
if (!granted) return res.status(403).end();
await latchkey.record({ subject, orgId,
featureKey: "api_calls", value: 1 });Iterate without redeploying
Change a limit, add a plan, or roll out a flag to 10% of orgs — push the config and watch behavior change in production. No app redeploy required.
$ latchkey diff --env production $ latchkey push --env production --strict
Pricing
Simple plans. No surprise invoices.
Pay for what you track. Every plan includes the full feature set — entitlements, metering, flags, and authorization. Upgrade as your subject count grows.
Starter
For side projects and early-stage products finding their pricing model.
$0/month
- 1 environment (staging)
- Up to 1,000 tracked subjects
- Core entitlements & feature flags
- Community support
Growth
For SaaS teams shipping usage-based or seat-based pricing in production.
$249/month
- Unlimited environments
- Up to 50,000 tracked subjects
- Usage metering & overage billing
- Feature flags with targeting rules
- ReBAC authorization & custom roles
- Priority support + Slack channel
Enterprise
For platforms with complex multi-tenant billing, compliance, and scale needs.
Custom
- Unlimited subjects & throughput
- SSO/SAML, audit logs, GDPR tooling
- Custom contracts & invoicing
- Dedicated infrastructure & SLAs
- White-glove migration support
Need usage-based pricing for your own product? See how teams model it with Latchkey →
Loved by engineering teams
Don't just take our word for it
“We replaced a tangle of Stripe webhooks, LaunchDarkly flags, and a homegrown permissions table with one Latchkey config. Shipping a new plan now takes an afternoon, not a sprint.”
“The unified check() call is the killer feature. Our API routes went from five different guard clauses to one — and product can change limits without touching our repo.”
“Usage-based billing was the scariest part of our roadmap. Latchkey's metering + entitlement model meant we shipped metered AI credits in two weeks instead of two quarters.”
FAQ
Frequently asked questions
- Stripe handles payments and invoicing; LaunchDarkly handles flags. Latchkey sits a layer above and ties them together with entitlements and authorization — so a single config defines what a plan includes, what a flag controls, and what a role can do, and a single check() call enforces all three at runtime.
Ship your next pricing change in an afternoon.
Install the CLI, run latchkey init, and push your first config to staging — free, no credit card required.