AppFig Start free
  1. Home
  2. Glossary
  3. What is client-side evaluation of feature flags?

What is client-side evaluation of feature flags?

Client-side evaluation means the app downloads the targeting rules and decides each flag or config value on the device, with no network call per check.

Client-side evaluation, also called on-device evaluation, means the app downloads the targeting rules and decides locally which value this user gets. The SDK holds the rules and the user's data on the device, so checking a feature flag or a remote config value is a local lookup, not a request to a server.

How it works

  1. The SDK downloads the rule set at startup and caches it on the device.
  2. The app tells the SDK what it knows about the user: events as they happen, and properties such as subscription tier.
  3. When the code asks for a value, the SDK runs the rules against that data and returns the answer.
  4. In the background the SDK checks whether the rule set has changed and downloads it again only if it has.

What follows from deciding on the device

Latency. A check does not wait for the network. It can sit in the code that builds a screen without a loading state.

Offline use. The rules are already on the device, so they keep being evaluated on a plane or in a tunnel.

Fresh behavior. The device knows what the user did a second ago. A rule based on that behavior takes effect at once; see behavioral targeting.

Privacy. The data the rules need (the user's events and properties) does not have to be sent to a server for a decision to be made.

The limit: no secrets in rules. Anything downloaded to a device can be read on that device. The rule set shows the conditions and the possible values, so it must not contain API keys or anything a server has to enforce, such as whether a purchase is valid.

How server-side evaluation differs

With server-side evaluation the app, or your backend, sends the user's identity and attributes to a service, which applies the rules and returns the values for that user.

Either way, a value that reaches the app can be read there. The difference is whether the rules that produced it travel too.

How AppFig works

AppFig evaluates on the device in all its SDKs: Unity, Android, iOS, Flutter and Web (React). The SDK loads the rules, the app logs events and sets user properties, and each call such as AppFig.GetFeatureValue("max_lives") loops through that feature's rules in order. The first rule that matches wins. If none matches, the call returns null and your code uses its own fallback.

No network call is made when a value is read. The SDK asks the CDN whether the rule set has changed when it starts and then once per poll interval, every minute by default while the app is in the foreground, and downloads the rules only when they have changed.

A/B test variants are chosen and remembered on the device in the same way. How it works has the full walk-through, including what the SDK sends to the server.

FAQ

Is client-side evaluation slower than a server lookup?

No. A local check runs in memory against rules already on the device, while a server lookup needs a round trip.

Can users see the rules?

Someone who inspects the app's traffic or storage can. Treat the rule set as public: fine for limits and switches, wrong for secrets.

What happens when I change a rule?

The SDK notices on its next check and downloads the new rule set. With AppFig that check runs every minute by default while the app is in the foreground.

What does the app do before it has ever downloaded rules?

It uses the fallback written in your code. With AppFig a lookup with no matching rule returns null, so every read should have a default next to it.

Keep reading