Flags

Why it's so important not to hard code entitlements when building SaaS/AI

fynn
Fynn Glover
·
05/29/2025

Let’s say you’re building a SaaS app with a premium feature — say, exporting reports.

When you hard-code entitlements, the logic might look like this inside your backend:

python
if company.plan in ['pro', 'enterprise']:
    allow_export = True
else:
    allow_export = False

Seems simple, right?

But now a customer on the ‘starter’ plan negotiates with sales to get export access. So your developer hacks in a one-off override:

python
if company.id == 12345:
    allow_export = True
elif company.plan in ['pro', 'enterprise']:
    allow_export = True
else:
    allow_export = False

Then Product adds a new tier.

CS needs to enable exports temporarily for a few accounts.

Marketing wants to run a limited-time trial.

Pretty soon you’re scattering logic like this everywhere:

python
if (
    company.plan in ['pro', 'enterprise', 'growth']
    or company.id in [12345, 67890]
    or company.trial_flags.get('export') is True
    or company.custom_flags.get('export_enabled') is True
):
    allow_export = True
else:
    allow_export = False

It’s brittle. It’s invisible. Nobody knows who has access to what, or why.

Now multiply that by every feature you gate — usage limits, add-ons, API calls, roles, products — and suddenly your business logic is a landmine.

Pricing experiments? Risky.

Trials? Dangerous.

Billing bugs? Guaranteed.

A robust entitlements layer solves this by externalizing that logic into a structured, queryable system. Instead of coding it in, you check:

python
if entitlements.check(company, 'can_export'): # proceed

And that check pulls from a central config: the source of truth for what each company is entitled to — across plans, overrides, trials, whatever.

Clean. Flexible. Safe.


FAQs

Why is hard-coding entitlements in a SaaS app a problem?: Hard-coded entitlements may seem simple at first, but they quickly become fragile and messy as exceptions, new plans, and temporary overrides pile up.

What kinds of issues arise when entitlement logic is scattered across the codebase?: You end up with inconsistent access control, unclear business logic, and mounting technical debt. No one can easily answer who has access to what, or why.

How does scattered logic affect pricing and product experimentation?: It makes changes risky. Launching trials, creating temporary access, or running pricing experiments becomes dangerous and error-prone, often leading to bugs.

What’s the alternative to hard-coded entitlements?: Use a structured entitlements layer — a centralized, queryable system that tracks and enforces access rules in a consistent and transparent way.

How does a proper entitlements system simplify application code?: Instead of complex conditionals, your code checks something like

python
entitlements.check(company, 'can_export')
, and the logic is managed centrally, outside the app.

What benefits does an entitlements layer offer as your SaaS grows?: It improves maintainability, enables safer experimentation, supports complex packaging, and keeps your monetization logic clean and auditable.