The disabled button that wasn't
You gray out the button when a user hits their limit. Then someone calls the API directly, or keeps an old tab open, and blows right past it. A disabled button is not enforcement. The server deciding at write time is.
One runaway user can't run up your bill.
Set limits per plan: how many projects, how much AI, how many requests. The server enforces every limit at the moment of the write, so nobody sneaks past a grayed-out button. And retries never burn quota twice.
Product example
This is the same visual component used by the authenticated app, rendered with deterministic sample data.
Review included allowance, enforced limits, and remaining capacity.
Inert sample data · no network access
Preview ready
Without a shared foundation, every team rebuilds these edge cases — differently.
You gray out the button when a user hits their limit. Then someone calls the API directly, or keeps an old tab open, and blows right past it. A disabled button is not enforcement. The server deciding at write time is.
A flaky network retries a request. A naive counter charges the quota twice. Now a paying customer is locked out of an allowance they never actually used, and they're right to be mad.
Limits scattered across ad hoc if-statements drift apart until support asks what a plan actually allows and nobody can answer with confidence. One registry ends that.
Highlights
Every limit lives in one typed file, so what each plan allows is written down in exactly one place.
Each use carries a stable ID. A retried request gets the original answer back instead of charging quota again.
If the server can't tell what plan someone is on, the answer is no. Nothing slips through by accident.
The mechanism end to end, as implemented in the repository.
Declare the limit once
Each limit is one typed entry: what it counts, who it applies to, the time window, and what happens when it's hit.
The server finds the plan
It maps the subscription to a plan and its limits. A late payment gets a short grace window before access tightens.
Usage is reserved inside the write
The server locks, reads the usage ledger, and reserves the quota in the same transaction as your write. Races and retries settle safely.
Clear errors, not mystery 500s
A rate limit tells the caller exactly when to retry. A plan limit says so plainly, which is your upgrade prompt. The UI meters just explain the decision.
Engineering guarantees
The meters in the UI only explain decisions, they never make them. The server re-checks every limit inside the write itself, and an unknown plan means denied, not allowed.
The boundary above is code, not a claim. These files carry the contract:
src/registries/quotas.tssrc/server/commercial-access.tsconfig/entitlements.tsThese capabilities share contracts and boundaries with this one.
The docs describe the same contracts this page demonstrates.