← Back to The Shortcut

Plan Enforcement without a Rate Limiter – How Trnqify Keeps Free, Standard, and Pro Users in Check

Why plan enforcement matters for a high-growth SaaS

When you’re managing a product that scales across Free, Standard, and Pro tiers, every ounce of operational complexity costs you time you could spend shipping features. Trnqify is a privacy-first URL shortener built for marketers and developers who need analytics with built-in UTM tagging. The moment we opened a Pro plan for early customers, we realized the naïve “check-the-plan-field-and-allow” approach would break under even modest usage.

The solution had to be simple enough to maintain at scale, privacy-aware, and reliable enough that a free user can’t accidentally eat the quota of a paying customer. The result is a usage-identifier-driven enforcement model that lives entirely in the request pipeline and externalizes quota checks to our billing provider.

AI Disclosure: This essay was drafted with the help of Trnqify’s AI assistant (via the internal MCP server) to speed up copy-editing and generate the diagrams you’ll see below. The final voice is still entirely mine.

The privacy-first guarantee we built into every click

Trnqify’s redirect domains (trnq.io and any custom domains a Pro customer adds) are cookie-free. We deliberately avoid storing raw IP addresses; instead, we resolve a geo-location bucket (country, region, city) on the fly and discard the IP. Click records live for three years, after which they are automatically purged.

Because there are no client-side cookies or tracking pixels on the redirect, we can safely enforce per-plan limits without compromising privacy. The only piece of data that survives in our analytics store is the anonymized geolocation bucket and the link’s path.

Enforcing limits with usage-identifiers, not bucket-style rate limiters

Most SaaS products reach for a classic token-bucket or leaky-bucket algorithm. Those patterns require:

  • A fast in-memory store (Redis, Memcached) to decrement counters.
  • A background job to refill buckets on a schedule.
  • Edge-case handling for bursts and partial failures.

For a high-growth operation, that stack is overkill. Trnqify instead leverages the usage-identifier-key that our authentication layer extracts from the authenticated session. The identifier is a stable string that maps 1-to-1 with a customer and, by extension, their plan.

When a request to create a link arrives:

  1. The request passes through the authentication layer, which injects usageIdentifierKey.
  2. The link-creation handler checks the current month’s click count for that identifier against the plan’s threshold.
  3. If the count exceeds the plan’s threshold, the handler serves a click interstitial (on free plans) or simply increments the metered usage for billing (on paid plans).
  4. No external rate-limiter is required; the “enforcement” is handled by user experience (the interstitial) or billing adjustments.

Because the counter lives in a single database item per customer, there’s no distributed state to synchronize and no per-request latency beyond a cheap read. This pattern scales linearly with the number of customers, not the number of clicks.

A close-up of a server rack panel with four blue fiber-optic cables plugged in, labeled "Allow" and "Block", representing the allow/block enforcement model

Note: The redirect handler itself does not enforce limits; it simply increments the counter asynchronously after the redirect completes. This guarantees that a user never sees a broken short link because a limit was hit mid-click.

Metered click tracking – what we actually bill for

Trnqify’s revenue model is a metered clicks tier on the Standard plan. Our billing provider handles the metering automatically:

  • Each click increments a usageQuantity on a usage record.
  • At the end of the billing period, the provider calculates the over-age fee based on the tiered pricing we configured ($0.0001 per extra click).
  • The customer sees the usage in their billing portal; we surface a read-only view in the Trnqify dashboard.

A printed checklist titled "Use billing metering" with items: "Store counters in database", "Avoid cookies", "Keep code <200 LOC", next to a leather notebook and laptop

Because the metering is performed by the billing provider, we avoid writing any custom invoicing logic. The only integration point is a background “report click” function that pushes a usage event to the billing API. If the click fails to report (network outage, background error), we retry via a queue, ensuring eventual consistency without impacting the redirect latency.

Trade-offs: simplicity vs. fine-grained control

AspectWhat we gainedWhat we gave up
Operational overheadNo separate rate-limiter service, no Redis, no scheduled refill jobsNo per-second burst protection (but not needed for URL shorteners)
PrivacyNo IP logs, no client-side trackingCannot identify abusive click patterns beyond aggregate city-level data
ScalabilityDatabase auto-scales; single read per requestSlightly higher read latency vs. in-memory counters (≈ 2 ms)
Customer insightClick totals per month are visible in billing portalNo real-time throttling dashboard (future work)

For a professional team, the trade-off is worthwhile: the code base stays under 200 LOC for enforcement, and the only external dependency is billing.

Lessons for builders who prioritize reliability over complexity

  1. Leverage existing metered-billing services – A provider’s usage API is a hidden gem. It spares you from building a custom invoicing pipeline.
  2. Let the database be the source of truth – A single item per customer gives you atomic increment, expiry, and built-in durability.
  3. Keep the enforcement path linear – Authentication → plan lookup → counter read → decision. No branching, no side-cars.
  4. Make privacy a feature, not an afterthought – By design, we never store raw IPs; that eliminates an entire class of compliance work.
  5. Document every edge case – In our case, the redirect handler must never block on the counter, so we do the increment asynchronously. A short note in the code prevented a nasty production bug.

If you’re building a SaaS that needs tiered usage but you want to prioritize reliability, ask yourself: Do I need a full-blown token bucket, or can I piggy-back on my billing provider? For most “light-touch” products, the answer is the latter.

Next steps & a single CTA

Trnqify continues to iterate on plan enforcement. The next milestone is a real-time usage dashboard for paid customers, built on top of the same counters.

Ready to short-link with privacy-first analytics?
Sign up for Trnqify

(The link includes UTM tags so we can see how this post drives traffic.)

Ready to shorten your links?

Try Trnqify free and start sharing smarter links with privacy-first analytics.

Start free