The Flagsmith Edge API

The Flagsmith Edge API

A plain-English guide to the fast, globally distributed service that answers "which features should this user see?" in a blink, how it works inside, how it stays available, and how to use it well.

Picture a customer in Mumbai opening your mobile app while another customer in Chicago does the same at the very same second. Before either screen can draw itself, the app must ask one tiny question: “Which features should this person see?” If that question has to travel halfway around the planet and back, the screen waits. Multiply that wait by millions of customers, and a small delay becomes a big business problem.

The Flagsmith Edge API exists to remove that wait. It is the part of Flagsmith that answers flag questions from servers placed close to your users, using data that has already been copied to those places. Instead of everybody queuing at one distant front desk, there are many front desks around the world.

You do not need to know anything about networks, databases or feature flags to follow this guide. Every new word is explained when it first appears, with an everyday comparison. By the end you will understand what the Edge API is, why it was built, how a request travels through it, how changes reach it, what can go wrong, and how to design your own applications so they stay fast and calm under pressure.

1First, What Is an API?

Before the “Edge,” we need to be sure about the “API.”

A waiter between two worlds

An API, short for application programming interface, is a set of rules that lets one piece of software ask another piece of software for something. You never see it directly, yet you use APIs all day. When a weather app shows tomorrow’s forecast, it has asked a weather service for the numbers through an API.

Analogy

Think of a restaurant. You do not walk into the kitchen and cook. You tell a waiter what you want, the kitchen prepares it, and the waiter brings it back. The waiter is the API. You speak a simple menu language, and the kitchen can change its recipes without you noticing.

Requests and responses

Almost every API works as a conversation of two messages. Your software sends a request, which says what it wants and who it is. The service sends back a response, which carries the answer or an explanation of why it cannot answer. Each request travels across the internet in small pieces called packets, and each trip takes time.

Where feature flags come in

A feature flag is a switch in your software that decides whether a feature is visible. A remote config value is a similar idea, but the switch holds a number or some text instead of a simple on or off. Flagsmith stores these switches and their rules. Your app does not hold the answers. It asks Flagsmith, through an API, “What are the flags for this user right now?”

That question is asked often. A busy app may ask it every time a user opens the app, loads a page or starts a session. Because it sits right at the start of the user’s experience, this API must be quick and it must almost never fail.

!
Tip

Whenever you meet a new technical word in this guide, ask three things: what is it, why does it exist, and what would break without it? Those three answers explain almost everything.

2What the Flagsmith Edge API Is

A short definition, then the reasons behind it.

The definition

The Flagsmith Edge API is the version of the Flagsmith flag-serving API that runs at many locations around the world, close to your users. It is the part of Flagsmith that your SDKs talk to when they ask for flags, identities and traits. An SDK is a ready-made code library that your app uses so it does not have to speak the raw API language itself.

On Flagsmith’s hosted cloud service, SDKs are normally pointed at the edge servers by default. You often use it without choosing it. Setting up an SDK with an environment key and keeping the default address is usually all it takes.

The word “edge”

In computing, the edge means the places nearest to the people using a service, as opposed to the central data centre where the main system lives. A service “at the edge” has been spread out to many such nearby places. You may already know the idea from content delivery networks, which keep copies of images and videos near viewers so pages load quickly.

Analogy

A big bookstore chain keeps one giant warehouse, but it also puts popular books on the shelves of local shops. When you want a bestseller, you walk to the shop around the corner instead of waiting for a truck from the warehouse. The Edge API is the local shop for flag answers.

What it does and does not do

The Edge API focuses on serving flags quickly. It answers questions from your apps, using stored copies of your settings. It is not where your team edits flags. Editing happens in the Flagsmith dashboard and the management API, which talk to the central part of the system, commonly called the core. Keeping serving separate from editing is the main design idea behind the whole thing.

It is also worth knowing that the Edge API is a feature of Flagsmith’s hosted offering. If you run Flagsmith on your own servers, you reach for different tools to get similar speed, and a later chapter explains them. As details can change between versions and plans, always confirm current behaviour in the official documentation for your setup.

2
halves of the design: core for editing, edge for serving
Many
locations answering flag questions near users
1
job at the edge: answer quickly and reliably

3The Big Picture: Core and Edge Side by Side

One picture holds the whole story.

flowchart LR
  Admin["Product Manager in Dashboard"] --> Core["Flagsmith Core API and Database"]
  Core -->|"publishes changes"| Store["Replicated Edge Data Store"]
  Phone["Mobile App SDK"] --> E1["Edge API: nearest location"]
  Web["Web App SDK"] --> E1
  Server["Backend Service SDK"] --> E1
  E1 --> Store
Figure 1. Editing goes through the core. Serving goes through the edge, which reads copied data.

Reading the picture

On the left sits a person changing a flag in the dashboard. That change goes to the core, which is the central system with the main database, the permission checks and the audit log. The core is built for correctness and rich features. Once the change is safely saved, the core publishes the new settings to a replicated edge data store, which is a database whose contents are copied to several regions.

On the right, three kinds of apps ask for flags: a phone app, a website and a backend service. All of them talk to the edge location nearest them. That location reads the settings from the replicated store, works out the answer, and replies. The core is not involved in that reply at all.

Why this split is clever

Editing flags happens a few times an hour. Reading flags happens thousands or millions of times a minute. These are two very different workloads. A system that tries to do both in one place must be a compromise. Splitting them lets each half be built for its own job. The core can focus on safety and detail. The edge can focus on speed and simplicity.

QuestionCore APIEdge API
Main jobManaging projects, flags, users and permissionsServing flags to apps quickly
Who talks to itThe dashboard, admin tools, automationYour apps through SDKs
Traffic patternLow volume, many different actionsVery high volume, mostly the same few actions
Data locationCentral main databaseCopies spread across regions
PriorityCorrectness and rich featuresSpeed and availability
!
Tip

When reading Flagsmith documents, ask yourself whether a sentence is about the editing side or the serving side. Many confusing moments disappear once you know which half is being described.

4Why Distance Matters: The Physics of Waiting

Even the fastest software cannot beat the speed of light.

Latency in one sentence

Latency is the time between asking for something and starting to receive the answer. Low latency feels instant. High latency feels sluggish. Users rarely say “the latency is high.” They say “this app feels slow,” and then they leave.

A back-of-the-envelope calculation

Signals in optical fibre travel at roughly two hundred thousand kilometres per second, which is about two thirds of the speed of light in empty space. The distance from India to the east coast of the United States is roughly twelve thousand kilometres. A request must go there and the answer must come back, so the signal covers about twenty-four thousand kilometres. Dividing gives about 0.12 seconds, or around 120 milliseconds, and that is the absolute minimum, before any computer does any work.

Real internet routes are longer than straight lines, and every router and server adds a small delay. A real round trip over that distance is often considerably longer. Now remember that opening a connection takes several back-and-forth messages. A single flag request from a far-away app can easily cost a noticeable fraction of a second. If the same app asks a server in its own region, the physics cost drops to a few milliseconds.

~120 ms
physical minimum round trip, India to the US east coast
Few ms
typical physics cost when a server is in your own region
0
ways to beat the speed of light, so move the server instead
Analogy

Imagine you need a pinch of salt. If the nearest shop is next door, you are back in two minutes. If the nearest shop is in another country, no amount of walking faster will help. The only fix is to open a shop near you. That is exactly what the edge does for flag answers.

Why flags are especially sensitive

Many requests can happen in the background while the user does something else. A flag request is different. Often the screen cannot decide what to draw until it knows the flags. If your app waits for a slow answer, one of two bad things happens: the user sees a blank spinner, or the app shows the default version and then suddenly switches to the new one, causing a visible flicker. Both feel unpolished. Fast answers prevent both.

The business angle

Large online companies have shared results from experiments showing that extra delays reduce engagement and purchases. Even without exact figures, the direction is clear and consistent: slower pages, fewer completed actions. A flag service sits in the path of almost every page, so keeping it fast is a small investment that protects a large part of the experience.

5Core Concepts You Need Before Going Deeper

Six ideas appear in nearly every Edge API conversation.

Concept

Organisation, project, environment

An organisation is your company account. A project is usually one product. An environment is one stage of that product, such as development, staging or production, each with its own flag states.

Concept

Environment key

A short secret-looking string that tells Flagsmith which environment a request belongs to. It is how the Edge API knows whose flags to look up.

Concept

Identity

One user, known by an ID your app sends. Flagsmith can give each identity its own flag results.

Concept

Trait

A small fact about an identity, such as plan type or country. Traits help decide which segments a user belongs to.

Concept

Segment

A group of users that share traits, such as “all paid users in Europe.” Flags can behave differently for a segment.

Concept

Override

A special rule for one environment, segment or identity that replaces the normal flag value, for example turning a feature on only for one test user.

Two kinds of keys

Flagsmith uses two kinds of environment keys. A client-side key is designed to be placed in code that runs on a user’s device, such as a website or mobile app. Because anyone can look inside such code, this key is treated as public. It can only be used to read flags for that environment. A server-side key is secret and is meant only for your own backend servers. It can do more, such as reading the full environment settings for local evaluation. Never put a server-side key into code that reaches users’ devices.

!
Watch out

The most common beginner mistake is placing a secret server-side key in a mobile app or website. Treat it like a password. If it leaks, replace it immediately.

How a flag gets decided

When the Edge API receives a question, it follows a short list of steps. It finds the environment from the key. It looks at the default value of each flag. It checks whether any segment rules match the user. It checks whether any specific override applies to this exact user. The most specific rule wins. The result is a clear list: each flag, whether it is enabled, and any value attached to it.

The same list of steps is used everywhere in Flagsmith. This matters because it means the answer from the Edge API, from the core, and from an SDK doing local evaluation should agree for the same inputs.

6Internal Working: The Life of One Request

Follow a single question from your app to the answer and back.

sequenceDiagram
  participant A as App with SDK
  participant R as Global Router
  participant E as Edge API Node
  participant D as Edge Data Store
  A->>R: Request flags with environment key
  R->>E: Route to nearest healthy location
  E->>D: Load environment settings and identity data
  D-->>E: Return stored data
  E->>E: Evaluate rules, segments and overrides
  E-->>A: Return flags and values
Figure 2. A flag request travels to the nearest healthy location, which reads stored data and evaluates it.

Step by step

1

The app asks

Your app uses the SDK to ask for flags. The SDK attaches the environment key and, if the user is known, their identity and traits.

2

The router chooses a location

A global routing layer, often based on the DNS system that turns names into addresses, directs the request to a nearby location that is healthy. If one location is having trouble, it can be skipped.

3

The edge node wakes up

An edge node receives the request. These nodes are built to be small and stateless, which means they remember nothing between requests and can be started or stopped freely.

4

It reads the stored data

The node reads the environment settings, and the identity record if one exists, from the nearby copy of the data store.

5

It evaluates

It runs the rules: defaults, segments, overrides. This is quick computation done in memory, with no calls back to the faraway core.

6

It replies

The answer goes back to the app, which then draws the right version of the screen.

Why stateless nodes are a gift

A stateless service holds no private memory of earlier requests. Everything it needs comes either with the request or from the shared data store. That design makes scaling easy: if traffic doubles, more copies are started, and any copy can answer any request. If one copy fails, the next request simply goes to another copy, and nobody notices.

Analogy

Picture a row of identical bank tellers who all read from the same shared customer ledger and keep no private notes. If one teller goes on a break, you walk to the next window and the service is identical. If the queue grows, the bank opens more windows. No teller needs to be briefed on your history.

Why the core is not in the path

Notice that the core never appears in Figure 2. This is deliberate. If every flag request needed the core, then the core would be the bottleneck, and a problem there would hurt every user everywhere. By answering from copied data, the edge keeps working even if the core is slow, busy or briefly unavailable. The people editing flags may be inconvenienced, but the people using your app are not.

7Data Flow: How a Change Reaches the Edge

The edge answers from copies, so copies must stay fresh.

flowchart TD
  A["Someone saves a flag change"] --> B["Core API validates and stores it"]
  B --> C["Audit log entry written"]
  B --> D["Background task prepares environment document"]
  D --> E["Write to edge data store"]
  E --> F["Replicate to other locations"]
  F --> G["Edge API serves new value"]
  G --> H["SDK picks it up on next request or update"]
Figure 3. A change is saved at the core, packaged, copied to the edge, and then served.

The journey in plain words

When a product manager flips a flag, the core first checks that the person is allowed to, validates the change and saves it in its main database. It also writes an entry in the audit log, the diary of who changed what. Then a background task takes the relevant settings and builds an environment document. That is a compact bundle holding everything needed to answer flag questions for one environment: its flags, their values, segments and rules.

The bundle is written into the edge data store, which then copies it to other regions. From that moment, edge nodes reading from the store will use the new version. The final step is on the app’s side: the SDK sees the new value the next time it asks, or sooner if real-time updates are in use.

Eventual consistency, explained gently

Copying data to many places takes a short time. During that short time, one location may already show the new value while another still shows the old one. This situation is called eventual consistency: the copies are not identical at every instant, but they will become identical soon without anyone intervening. In everyday conditions, the gap is brief, often a matter of seconds, but you should not design anything that needs every user on Earth to see a change at exactly the same millisecond.

Analogy

A head office sends out a new price list to its branches by courier. Some branches receive it in the morning and some after lunch. For a short window, two branches quote different prices. By evening, all the shops agree. The company accepted this short window in exchange for every shop being able to serve customers quickly without phoning head office for every price.

Why this trade is usually worth it

For flags, a gap of a few seconds almost never matters. If you roll out a feature to ten percent of users, it makes no difference whether it started at 14:15:00 or 14:15:04. In return, you get flag answers that are fast everywhere and that keep working during trouble at the core. Engineers call this choosing availability and speed over perfect instant agreement, and for read-heavy data like flags, it is the sensible choice.

!
Watch out

Do not use feature flags as a precise global clock or a lock. A flag is for deciding what to show, not for making sure two machines act at exactly the same moment. For that, use tools built for coordination.

What about the dashboard?

The dashboard reads from the core, so it shows the saved change immediately. You may therefore see the new value in the dashboard a moment before your own test app sees it. If your test seems to disagree with the dashboard, wait a few seconds and ask again before assuming something is broken.

8Identities and Traits at the Edge

Per-user answers need per-user data, and that data must be nearby too.

Two kinds of questions

An app can ask two kinds of questions. The first is “What are the flags for this environment?” That answer is the same for everyone, so it depends only on the environment settings. The second is “What are the flags for this particular user?” Now the answer may depend on who the user is, what traits they have, which segments they fall into, and whether a special override exists for them.

To answer the second kind quickly, the Edge API needs the identity’s data close at hand. That is why identities and their traits are stored in the edge data store as well, and not only in the core. When a user’s traits are sent along with the request, the edge can store them and use them straight away.

What traits are good for

Traits turn raw user facts into useful decisions. A trait called “plan” with the value “premium” lets you show an advanced feature only to premium users. A trait called “app version” lets you hide a feature from an old version that cannot display it. A trait called “country” lets you switch on a feature only where it is legal or ready. Because the data lives at the edge, these decisions need no extra trips.

Analogy

A hotel keeps a guest card at the front desk of each branch: your name, your room preference, your loyalty level. When you arrive, the receptionist does not call head office. The card is already in the drawer. Identities and traits are those guest cards, kept at every desk.

How segments use traits

A segment is defined by rules over traits, for example “plan equals premium and country equals India.” When the edge node receives a user’s traits, it checks them against every segment rule for the environment and finds which segments match. If a flag has a different value for a matching segment, that value is used. If more than one segment matches, the order of priority you set decides the winner.

Percentage rollouts and fairness

Many teams roll features out to a percentage of users, such as five percent, then twenty-five, then everyone. For this to feel fair, the same user must always land on the same side of the split. Otherwise a person could see the new feature on one visit and not on the next. Flagsmith handles this by turning each user’s ID into a stable number, using a mathematical function that always gives the same output for the same input, and comparing that number with your percentage. The result is steady and repeatable, and it is the same regardless of which edge location answers.

Be careful what you store

Traits are convenient, but anything you send is stored. Avoid placing secrets or sensitive personal details in traits. Names, emails and payment details almost never belong there. Use internal IDs and coarse facts such as a plan name or a region. This habit is covered further in the security chapter.

!
Tip

Use stable, non-personal user IDs. If the ID changes every time the user opens the app, they will drift between rollout groups and lose any overrides you set for them.

9What SDKs Do Around the Edge API

The SDK is the polite messenger standing between your app and the service.

Client-side and server-side SDKs

Flagsmith offers SDKs for many languages. They fall into two broad kinds. Client-side SDKs run in places users control, such as a web browser or a phone. They usually ask the Edge API for the flags of one user at a time and hold the result in memory. Server-side SDKs run in your own backend. They can either ask the Edge API on each request, which is called remote evaluation, or download the whole environment document and decide on their own machine, which is local evaluation. Both approaches are valid. They simply trade freshness, speed and cost differently.

What a good SDK does for you

  • Attaches the key and identity to each request so you do not have to.
  • Holds a short-lived copy in memory so your code can check a flag many times without repeated network calls.
  • Provides default values that your code can fall back on if the network is not available.
  • Can refresh periodically or listen for live updates, so long-running apps stay current.
  • Can report usage of flags, so you see which are actually used.
Analogy

A personal assistant keeps a small notebook with today’s schedule. When you ask what is next, the assistant checks the notebook instead of phoning the office each time. If the notebook is a few minutes old, it is probably still right. If the office changes something important, a message arrives and the notebook is updated. The SDK is that assistant, and its notebook is the cache.

Real-time updates

Some SDKs can keep a lightweight connection open so that Flagsmith can announce a change the moment it happens, instead of waiting for the next time the app asks. The technique used is often server-sent events, a simple standard where a server pushes small messages down a connection that stays open. This is helpful for web apps that stay open for hours, because a flag change can take effect without a page refresh. Availability and setup differ between SDKs, so check the documentation for yours.

Why your own defaults matter

A default value is what your code uses when it cannot get an answer. Picking it well is one of the most important decisions in using flags. As a rule, the default should be the safe, stable behaviour, usually “feature off.” If the network fails, users see the old, well-tested version instead of an unfinished feature. The chapter on reliability returns to this idea, because it is the foundation of graceful failure.

!
Watch out

A default of “on” for a risky new feature means that any network hiccup silently exposes that feature to users. Default to the safe path unless you have a strong reason not to.

10Edge API, Local Evaluation and the Edge Proxy

Three ways to get flag answers fast, and when each one fits.

Option one: remote evaluation through the Edge API

This is the default path. Your app asks the Edge API, which decides and replies. It is simple, always fresh within the short copying delay, and works well for browsers and phones. The cost is one network trip per refresh, which the edge design keeps small.

Option two: local evaluation in a server SDK

A backend service can download the whole environment document once, keep it in memory, and decide for every user on its own, with no network call at all. The SDK refreshes the document on a timer, commonly measured in tens of seconds. The benefit is extremely fast decisions and far fewer requests. The cost is that changes appear only when the next refresh happens, and this approach needs a secret server-side key, so it is only for trusted backends.

Option three: the Edge Proxy for self-hosted setups

If you run Flagsmith on your own servers, you do not get Flagsmith’s global edge locations. Flagsmith provides an open-source component called the Edge Proxy that you place near your applications. It holds a cached copy of the environment documents and answers SDK requests itself, asking the main Flagsmith server only now and then for updates. This takes load off your main installation and puts the answers closer to your apps.

flowchart TD
  Q["Where does your app run?"] --> A{"Using Flagsmith cloud?"}
  A -->|"Yes"| B{"Need freshest answer per user?"}
  B -->|"Yes"| E["Use Edge API with remote evaluation"]
  B -->|"No, trusted backend"| L["Consider local evaluation in server SDK"]
  A -->|"No, self-hosted"| P["Use Edge Proxy near your apps"]
Figure 4. A simple guide for choosing how your app gets its flag answers.
ApproachWhere decisions happenFreshnessBest for
Edge API, remote evaluationAt Flagsmith’s edge locationsVery fresh, after the short copy delayBrowsers, mobile apps, general use
Local evaluationInside your own server processAs fresh as the refresh timerHigh-volume trusted backends
Edge ProxyOn a proxy you run near your appsAs fresh as the proxy’s refreshSelf-hosted installations
Analogy

Remote evaluation is phoning a local help desk each time you have a question. Local evaluation is keeping the whole rulebook on your own desk and checking it yourself. The proxy is a neighbourhood office that holds a copy of the rulebook for a whole street.

Mixing approaches

Nothing forces you to choose only one. A common pattern is local evaluation in the busiest backend services and remote evaluation through the edge for browsers and phones. All of them read the same environment settings and use the same decision steps, so a user sees consistent behaviour no matter which route answered.

One honest caution: local evaluation cannot always replicate every feature in exactly the same way, for example when identity data lives only at the service. Check the documentation of your SDK for any listed differences before relying on it for a special case.

11Performance and Scalability

What “fast” means, and how the edge stays fast when traffic explodes.

Three numbers worth knowing

Latency is how long one request takes. Throughput is how many requests are handled each second. Tail latency is the time experienced by the slowest few requests, often described as the ninety-ninth percentile, which means only one request in a hundred is slower. Averages hide pain. A service with a great average and a terrible tail still makes some users miserable, so mature teams watch the tail.

How the edge keeps latency low

  • Nearby servers cut the physics cost of travel.
  • Small, focused work: the edge does one job and does not carry the weight of the whole dashboard.
  • Data already in place: no long calls back to a central database.
  • In-memory evaluation: rule checks are quick computations.
  • Connection reuse: modern SDKs and servers keep connections open so later requests skip the setup handshake.

How it scales up

Because edge nodes are stateless, horizontal scaling works well. That means adding more identical copies instead of making one copy bigger. When traffic spikes, such as a marketing email that sends a million people to your app within minutes, the platform starts more copies to share the load. When traffic falls, the extra copies are removed. You do not need to forecast the spike or buy hardware in advance.

Analogy

A supermarket opens extra checkout counters when the queue grows and closes them when it shrinks. The cashiers are interchangeable and use the same price list. Customers care only that the queue moves. Horizontal scaling is the same idea for software.

The cold start question

Systems that start copies on demand can suffer a cold start, a small extra delay the first time a fresh copy handles a request, because it must load itself first. Providers work hard to keep this small, and steady traffic keeps copies warm. As an app developer, you cannot control it directly, but you can protect your users from it by caching flags on the client and by never blocking the whole screen on a single flag call.

What you can do on your side

  • Ask for flags once per session or page load, then reuse the answer in memory.
  • Avoid calling the API inside loops or on every small user action.
  • Use client-side caching so repeated app launches show something immediately.
  • Prefer one request that returns all flags over many requests that return one flag each.
  • For busy backends, consider local evaluation to avoid network calls entirely.
!
Tip

The fastest request is the one you never make. A thoughtful caching plan on the client usually saves more time than any server improvement.

12High Availability and Reliability

Plan for the day something goes wrong, because that day always comes.

What availability means

Availability is the share of time a service works when you need it. People often describe it in “nines.” Ninety-nine point nine percent allows roughly nine hours of downtime in a year. Ninety-nine point nine nine percent allows under an hour. Each extra nine is much harder and costlier to achieve. Spreading a service across many locations is the classic way to reach more nines, because one failure no longer takes everything down.

How the edge design helps

The edge has no single front door. Requests are routed to nearby locations, and unhealthy locations can be skipped. Data is replicated, so a lost copy can be replaced from another. Nodes are stateless, so a crashed node leaves nothing behind that needs repairing. The core, which is more complex, sits out of the request path, so its problems do not become your users’ problems.

Designing your app for graceful failure

No service promises perfection, so well-built apps expect occasional failures and handle them quietly. The diagram below shows the flow a careful SDK and app follow whenever they need a flag.

flowchart TD
  S["App needs a flag"] --> C{"Cached value available?"}
  C -->|"Yes and fresh"| U["Use cached value"]
  C -->|"No or stale"| N["Call Edge API"]
  N --> OK{"Call succeeded?"}
  OK -->|"Yes"| V["Use and cache fresh value"]
  OK -->|"No"| R{"Retry allowed?"}
  R -->|"Yes"| N
  R -->|"No"| D["Use default flag value"]
Figure 5. Check the cache, ask the edge, retry politely, and fall back to a safe default.

Reading the flow

If a fresh answer is already in memory, use it and make no call at all. If not, ask the Edge API. If that works, use the answer and save it. If it fails, retry a limited number of times, waiting a little longer between attempts, an approach called backoff that prevents a struggling service from being flooded by eager retries. If everything fails, use the default you chose in advance. The user sees a working app, perhaps with an older version of a feature, rather than an error.

Analogy

A pilot flying into a storm does not hope for the best. The plane carries spare fuel, a spare airport on the flight plan, and a checklist for each failure. Calm, rehearsed fallbacks turn emergencies into routine events. Defaults, caches and retries are your app’s spare fuel.

Offline and degraded modes

Some SDKs support saving flag data to local storage or reading it from a file, so apps can start even with no network, and some provide an offline mode designed for testing and for environments cut off from the internet. When your app must work on aeroplanes, in basements or in remote locations, these features are worth learning. Details differ by language, so read your SDK’s guide.

Blast radius

The blast radius of a failure is how much it affects. The edge design shrinks it: a problem in one location affects only that location’s traffic, and a problem in the core affects only editing. Good flag habits shrink it further, because a bad feature can be switched off in seconds, without a new release.

!
Watch out

Do not let a flag call block the whole screen with no timeout. Always set a sensible time limit, so a slow answer leads to a default instead of an endless spinner.

13Security and Privacy

A fast front door is only useful if it has a good lock.

Keys and their reach

Security starts with the two kinds of keys from Chapter 5. A client-side key can sit in public code, so it must be capable of reading flags only. A server-side key is secret and powerful. Store it in a secrets manager or in protected environment settings, never in a code repository, a chat message or a mobile app. If a secret key is ever exposed, create a new one and retire the old one at once.

Encryption in transit

Requests to the Edge API travel over HTTPS, which scrambles the conversation so that anyone listening on the network sees only noise. Keep your SDK settings on the secure address, and never switch to plain, unencrypted connections to “make debugging easier.”

Browser rules, briefly

Web browsers have a safety rule called CORS, which stands for cross-origin resource sharing. It decides whether a page from one website may call a service on another. The Edge API is built to be called from browsers, but if your own proxy or gateway sits in front of it, you must configure it to allow your website’s address. A page that suddenly cannot load flags and shows a CORS message in the browser console is the classic sign.

What data leaves your walls

When you send an identity and its traits to the edge, you are sending information about your users to a third party and storing it in several regions. Follow data minimisation, which means sending only what you need. Prefer internal IDs over emails, and coarse facts like “plan” over detailed personal ones. Review your privacy policy and customer contracts, and consider whether any rules, such as the European Union’s GDPR, restrict where data may be stored. If you have strict regional rules, ask Flagsmith about regional options and about running it yourself.

Analogy

When you hand a parcel to a courier, you decide what goes inside. Once it is sealed and collected, you cannot pull things back out. Data sent to any external service works the same way, so decide first what truly needs to be in the parcel.

Abuse and limits

Public endpoints invite abuse. Hosted services commonly apply rate limits, which cap how many requests one caller can make in a given time. A bug in your app, such as a loop that asks for flags thousands of times a second, can hit those limits and also inflate your costs. Another reason to cache sensibly.

RiskExampleSimple defence
Leaked secret keyServer key committed to a public repositorySecrets manager, rotation, scanning tools
Over-sharingEmails and names placed in traitsUse internal IDs and coarse traits
Wrong environmentProduction key used in a test buildSeparate keys per environment, clear naming
Request floodsBuggy loop calling the API constantlyClient caching, sensible refresh timers
Browser blockingMissing CORS settings on a gatewayAllow your site address on any proxy you add

14Monitoring, Logging and Metrics

You cannot improve what you cannot see.

Three kinds of signals

Metrics are numbers over time, such as requests per minute. Logs are text records of individual events. Traces follow one request through several services. Together they are called observability, and they let you answer questions about a system without guessing.

What to watch on your side of the fence

You cannot see inside Flagsmith’s edge machines, but you can measure how the edge behaves from your app’s point of view. These are the measures worth tracking:

Speed

Request duration

How long flag calls take from your app, with attention to the slowest one percent, measured by region so you spot geographic trouble.

Health

Error rate

The share of flag calls that fail or time out. A rise is an early warning for both Flagsmith and your own network.

Fallback

Default usage

How often the app falls back to default values. A healthy app rarely does. Frequent fallbacks mean answers are not getting through.

Volume

Request count

How many calls your apps make. Sudden jumps often reveal a bug, and the number matters if usage affects your plan.

Freshness

Change delay

The gap between saving a change and seeing it in a test app. Measuring it occasionally tells you what delay to expect.

Usage

Flag evaluations

Optional flag usage reports show which flags are really in use, helping you remove dead ones.

Status pages and alerts

Hosted services publish a status page showing current incidents and past history. Subscribe your team to its notifications, and link it from your own runbook. Then create alerts in your own monitoring tool for flag call failures, so you hear about trouble from a graph before you hear it from customers.

Link flag changes to graphs

A strong habit is placing markers on your dashboards whenever a flag changes, using Flagsmith’s integrations with monitoring tools. When a graph suddenly jumps, a marker beside the jump saves valuable minutes. The Edge API is quick, but your own application behaviour is often the real cause of an incident, and flags are one of the most common triggers.

!
Tip

Tag your flag-related logs with the environment name and the flag name. A log line that says “flag fetch failed” is far less useful than one that says which environment, which user group and how long it took.

Define what “good” means

Write down a target such as “ninety-nine percent of flag requests finish in under 300 milliseconds from the user’s device, and fewer than one in a thousand falls back to a default.” A target turns vague feelings into something you can measure and discuss. Such targets are often called service level objectives, and they help teams decide when a problem is serious enough to wake someone at night.

15Deployment, Setup and Migration

Using the Edge API is mostly a matter of configuration, not construction.

Getting started in plain steps

1

Create the project and environments

In the dashboard, make a project and separate environments for development, staging and production.

2

Copy the right key

Take the client-side key for browsers and phones, and the server-side key for your trusted backends.

3

Install the SDK

Add the SDK for your language, and give it the key. On the hosted service, the default address already points to the edge.

4

Choose safe defaults

For each flag in code, pick the default that is safest if no answer arrives.

5

Test in development

Flip a flag, wait a few seconds, and confirm your test app changes. Then repeat in staging before production.

6

Add monitoring

Track request time, errors and fallbacks, and set alerts before launch rather than after.

Migrating older projects

Flagsmith has evolved over time. Older projects were created when the core served everything, and Flagsmith has offered a path to move such projects onto the edge so they benefit from the faster design. The move involves copying environment and identity data to the edge store. Treat it like any data migration: read the official migration notes, choose a quiet period, test with a non-production project first, and check that flags and identity overrides match afterwards. Ask Flagsmith support if you are uncertain, because the exact steps depend on your plan and history.

Environments and keys in practice

Use a separate environment, and therefore a separate key, for each stage. This keeps test flips away from real users. Name keys clearly in your own secrets store, such as “web-client-production,” so nobody uses the wrong one by accident. Rotate server-side keys on a schedule.

Self-hosted and private options

Some organisations cannot use a shared hosted service because of company rules or laws. Flagsmith can be run on your own infrastructure, and there are private hosted arrangements for larger customers. In such cases, you do not get the global edge in the same form, so plan for the Edge Proxy and local evaluation described earlier, and put the proxy in the same regions as your users and servers.

!
Watch out

Do not copy a production key into a development laptop’s settings “just for a minute.” Minutes become months, and the key travels into screenshots, chat messages and backups.

16Design Patterns and Anti-Patterns

Habits that work well with an edge-served flag system, and habits that cause pain.

Patterns worth copying

Pattern

Safe default

Every flag in code has a default that represents the stable, well-tested behaviour, so failures degrade quietly.

Pattern

Fetch once, reuse

Ask for all flags at session start, hold them in memory, and read from memory throughout the session.

Pattern

Time limit on calls

Every flag call has a timeout, after which the app continues with cached or default values.

Pattern

Kill switch

Risky features are wrapped in a flag that can be turned off in seconds, without a new release.

Pattern

Progressive rollout

Release to staff, then a small percentage, then everyone, watching graphs at each step.

Pattern

Local evaluation for hot paths

Busy backend code paths use local evaluation to avoid network calls entirely.

Advantages and trade-offs of edge serving

Advantages

  • Fast answers near users around the world.
  • Strong availability, since there is no single front door.
  • Smooth handling of sudden traffic spikes.
  • Core problems do not interrupt serving.
  • Little to operate when using the hosted service.

Trade-offs

  • Changes take a short moment to reach every location.
  • Per-user data is stored in several regions, raising privacy questions.
  • Self-hosters need extra components for similar speed.
  • More moving parts to understand when debugging.
  • Relies on a third-party service you do not control.

Anti-patterns to avoid

ANTI-PATTERN 01Avoid
What people do

They call the flag API on every click, every render and every tiny function.

Why it hurts

Requests multiply, the app slows down, rate limits may be hit and costs rise, all to fetch an answer that rarely changes.

Better approach

Fetch once per session or page, store in memory, and refresh on a timer or a live update.

ANTI-PATTERN 02Avoid
What people do

They use feature flags to guard a security rule, such as “only admins may delete,” relying on a flag in the browser.

Why it hurts

Anything in a browser or phone can be inspected and changed by the user. A flag value on the device is a hint for the screen, not a lock.

Better approach

Enforce real permissions on the server, and use flags only to decide what is shown.

ANTI-PATTERN 03Avoid
What people do

They expect a flag change to take effect instantly for every user on Earth, and build features that depend on it.

Why it hurts

Copying and caching mean a short, unpredictable gap, so two users may briefly disagree and a coordinated switch may be messy.

Better approach

Design features to tolerate a few seconds of difference, and use real coordination tools when exact timing is needed.

17Best Practices and Common Mistakes

A short, practical checklist drawn from everything so far.

Do these

  • Choose safe defaults for every flag, and test the app with the network turned off.
  • Use the right key in the right place: client-side keys in apps, server-side keys on servers only.
  • Cache on the client and refresh on a sensible timer, measured in tens of seconds or minutes, not milliseconds.
  • Set timeouts on every flag call so the screen never waits forever.
  • Use stable user IDs so rollouts and overrides stay consistent.
  • Keep traits small and non-sensitive.
  • Watch the edge from your side with request time, error and fallback metrics.
  • Retire old flags once a feature is fully released, to keep code clean.

Common mistakes and quick cures

MistakeWhat you seeCure
Default set to “on” for a risky featureUsers see unfinished features when the network hiccupsDefault to the stable, off behaviour
Fresh anonymous ID every visitUsers flip between old and new versionsStore and reuse a stable ID
No timeout on the flag callEndless spinners on slow networksAdd a time limit and fall back
Flags checked in tight loops over the networkSlow app and huge request countsRead from the in-memory copy
Same key everywhereTest flips affect real usersSeparate environment keys
Sensitive facts in traitsPersonal data stored in several regionsSend only internal IDs and coarse traits
Never removing old flagsCode full of dead branchesLink flags to tickets and review quarterly
A good flag setup is boring: safe defaults, quick answers, and no surprises when the network misbehaves.

18Troubleshooting Guide

When something looks wrong, check in a calm and predictable order.

The usual suspects

Symptom

My change is not showing

Wait a few seconds for copying. Then check you edited the right environment, the app uses that environment’s key, and the SDK is not holding an older cached copy.

Symptom

Unauthorised errors

The key is missing, mistyped, revoked, or belongs to a different environment. Re-copy it from the dashboard and test again.

Symptom

Browser console shows CORS error

A gateway or proxy in front of the service is not allowing your website address. Update its allowed origins.

Symptom

One user sees different flags

Look for an identity override or a segment rule that matches only that user, and check whether their traits are what you expect.

Symptom

Flags flicker after load

The app drew the default first and then received the real answer. Wait for the flags briefly, or draw a neutral loading state.

Symptom

Slow flag calls in one region

Check your own network, any corporate proxy in the way, and the status page. Compare with users in other regions.

A calm order of checks

First, confirm the change exists: look at the dashboard and the audit log. Second, confirm you are asking the right environment with the right key. Third, wait a short moment and ask again, in case copying is not finished. Fourth, clear any caches in your app or test tool. Fifth, check the identity and traits you send, since segment rules rely on them. Sixth, look at the status page and your own network. Going through this order avoids jumping straight to blaming the service.

Test with a clean slate

When results are confusing, try a brand new test identity that has never been used, with only the traits you choose. If a clean identity behaves correctly, the problem is likely an old override or stored trait on the other identity. If a clean identity also behaves wrongly, the problem is in the environment settings or the key.

!
Tip

Keep a test environment and a test identity with a clearly fake ID, such as “test-user-001.” They give you a safe, repeatable way to check behaviour without touching real customers.

19Testing and Rehearsing Your Flag Setup

A fallback you have never tried is only a hope.

Why test the unhappy paths

Most people test that flags work when everything is fine. The real value lies in testing what happens when things are not fine: the network drops, the answer is slow, the key is wrong, or the service returns an error. Those are exactly the situations in which your safe defaults and timeouts are supposed to save you. If you have never seen your app handle them, you do not know whether it does.

Analogy

A fire drill feels silly while nothing is burning. It is also the reason everyone walks calmly to the right door when the alarm is real. Testing your failure paths is a fire drill for your software.

A set of simple experiments

1

Happy path

Flip a flag in a test environment and confirm the test app changes within a few seconds. Note how long it takes.

2

No network

Start the app with the network turned off. Confirm it opens, uses defaults, and shows no scary errors.

3

Slow network

Use a network-throttling tool to make the connection very slow. Confirm that the timeout works and the screen does not freeze.

4

Wrong key

Use a deliberately wrong key in a test build. Confirm the app falls back cleanly and your logs make the cause obvious.

5

Recovery

Restore the network and confirm the app picks up fresh flags without needing a restart.

Test the rules, not just the switch

Segments and overrides are where subtle bugs hide. Create a few fake identities with different traits, such as a premium user, a free user and a user from a different country, and check each one receives the flags you expect. Keep these fake identities and their expected results written down, so you can repeat the check after changing rules.

Test the rollout split

When you plan a percentage rollout, confirm the behaviour on a small scale first. Use a handful of test IDs, check that each lands consistently on one side of the split, and verify that raising the percentage only adds users to the new group and never removes anyone who already had it.

Practice reversing a change

The greatest strength of flags is fast reversal. Practise it. During a calm hour, enable a harmless test feature, then switch it off, and time how long it takes for your test app to follow. Knowing this number in advance changes how you plan launches, because you understand how long the worst moment would last.

!
Watch out

Never rehearse failures against real customers. Use separate test environments and test identities, and tell the team in advance so nobody mistakes a drill for a real incident.

Automate what you can

Add a small automated test to your build process that starts the app with default flags and checks the main screens still work. A second test can use a test environment with a known set of flags. Automated checks catch accidents early, such as a developer removing a default or renaming a flag without noticing.

20Cost, Capacity and Request Planning

Every request has a price, even if it is small.

Why request counts matter

Hosted flag services commonly price their plans partly by how many requests you make, and they may apply limits to protect everyone’s performance. Your plan details can change, so check your own account for the current terms. The principle, however, is stable: fewer unnecessary requests mean lower cost, lower latency and a smaller chance of hitting limits.

A simple estimate

Suppose your app has one million active users in a day, and each user opens the app four times, with one flag request each time. That is four million requests a day. If the app also refreshes flags every minute for the thirty minutes a typical session lasts, each session adds around thirty more requests, and the total climbs to well over a hundred million requests daily. Nothing is broken, yet a small decision about refresh frequency has changed the scale by a factor of thirty.

4 M
requests a day with one call per app open
30x
possible growth from a one-minute refresh timer
0
network calls when a flag is read from memory
Analogy

A phone plan with a small data allowance feels generous until an app quietly refreshes itself every few seconds. Nothing looks wrong, but the allowance vanishes by the middle of the month. Flag refresh timers are the same kind of hidden tap.

Ways to keep volume sensible

  • Lengthen refresh timers to a few minutes unless a feature truly needs near-instant changes.
  • Use real-time updates where offered, because one open connection can replace constant polling.
  • Use local evaluation in heavy backend services so decisions need no network call.
  • Avoid per-component calls: fetch once, share the result across the app.
  • Cache across app launches on devices, so quick reopenings need no request.
  • Turn off optional analytics reporting in places where you do not use it.

Plan for spikes

Think about the biggest day of your year: a sale, a launch or a televised event. The edge is built to absorb sudden growth, but your apps must also behave well. Before such a day, review your refresh timers, make sure defaults are safe, and confirm that your own monitoring will tell you quickly if flag calls begin to fail. Tell your Flagsmith contact in advance if you expect an unusually large event, because they may offer helpful advice.

Cost of staleness versus cost of freshness

Choosing a refresh timer is a trade. A short timer means fresher flags and more requests. A long timer means fewer requests and a longer wait before a change appears. Ask what a stale flag would cost in your case. For a decorative banner, a five-minute delay is harmless. For an emergency kill switch, you may want live updates, or a short timer on just that one part of the app.

21A Worked Example: A Global Food-Delivery App

A made-up company shows how the pieces fit together.

The story below is hypothetical. Imagine a food-delivery company called Spice Route, with customers in India, the United Kingdom and Brazil, and a mobile app, a website and many backend services. The team wants to launch a new “group order” feature without risking dinner-time orders.

Step one: set up the environments

The team creates development, staging and production environments, each with its own keys. Mobile and web apps use client-side keys. Backend services use server-side keys kept in a secrets manager. A flag named “group_order” is created in all three, switched off in production.

Step two: choose defaults

In every app and service, the default for “group_order” is off. If the network fails anywhere in the world, customers simply see the familiar ordering flow.

Step three: speed for users in three continents

A customer in Bengaluru, one in Manchester and one in São Paulo all open the app at the same time. Each request goes to a nearby edge location instead of one distant server, so each screen gets its flags within a short time, and nobody waits on a spinner.

Step four: staff first

The team adds a trait called “staff” to employee accounts and creates a segment for it. The flag is enabled for that segment only. Employees see group ordering at lunchtime while customers do not.

Step five: small slice, one country

A segment based on the “country” trait enables the feature for five percent of users in India. The stable user ID keeps each person on the same side of the split, so nobody sees the feature appear and disappear.

Step six: a problem at dinner time

The order-processing service shows slower payments. The on-call engineer sees a flag change marker just before the slowdown on the dashboard, and switches the flag off. Within seconds the change reaches the edge, and the apps pick it up on their next refresh. Payments recover.

Step seven: a regional network hiccup

A short network problem affects users in one region. Because the apps cache flags, hold safe defaults and use timeouts, those customers keep ordering with no visible error. The team notices a brief rise in fallback usage on their own dashboard, matches it with the provider’s status page, and does nothing further.

Step eight: full release and cleanup

After the fix, the rollout grows from five to fifty to one hundred percent across all countries. The team then removes the flag and the old code path, and closes the ticket.

What made this smooth

Nothing needed heroics. The team used the edge for speed, defaults for safety, segments for control, and markers for diagnosis. Each simple habit covered a different risk, and together they turned a nerve-racking launch into a routine one.

22The Same Idea in the Wider World

Serving small, frequently read data from nearby copies is one of the oldest tricks in internet engineering.

The Edge API belongs to a long family of designs that move data closer to the people who use it. Seeing the family makes the idea easier to remember. The examples below describe publicly known approaches in general terms, not claims about any company’s private systems.

CDN

Content delivery networks

Services that keep copies of web pages, images and videos in hundreds of cities, so a viewer is served from a nearby location instead of the original website.

DNS

The domain name system

The internet’s phone book is itself spread across countless servers worldwide, with answers cached close to users, which is why typing a website name feels instant.

Streaming

Video delivery

Large streaming companies, including Netflix, have talked publicly about placing video servers inside or near internet providers’ networks so that popular shows travel a short distance.

Databases

Replicated databases

Many cloud databases can copy data to several regions so reads are local and quick, accepting a small delay before every copy matches.

Serverless

Edge functions

Cloud providers offer small programs that run in locations near users, ideal for quick decisions such as redirecting or personalising a page.

Config

Remote configuration

Large companies have long used central switches to control features gradually, with the switches’ values copied widely so every server decides fast.

The shared pattern

Every one of these systems separates a rarely changing source of truth from a widely copied serving layer. They accept that copies may lag the source slightly. In return they gain speed and the ability to survive trouble. The Flagsmith Edge API applies exactly this pattern to feature flags.

Analogy

A national newspaper is written in one newsroom but printed in many cities overnight. Readers in every city have the paper at breakfast. If the newsroom’s phone line breaks at midnight, the printing plants still deliver what was already sent. Nobody expects the paper to update minute by minute, and that patience is what makes wide delivery possible.

Lessons you can reuse

  • Put frequently read data close to the reader.
  • Keep the writing path separate from the reading path.
  • Accept a small delay in return for speed and resilience.
  • Plan for the source being unreachable, and let the copies keep serving.
  • Always keep a sensible fallback for when the copy itself cannot be reached.
The edge does not make data faster. It makes the distance shorter.

23Limits: What the Edge API Is Not Meant For

Knowing a tool’s limits is as valuable as knowing its strengths.

Not a place to edit

The Edge API serves flags. It is not the right tool for creating projects, managing team members or editing flags at scale. Those tasks belong to the dashboard and the management side of the platform. If you need to automate editing, use the proper management interfaces and tools such as Terraform, not the serving endpoints.

Not an instant global broadcast

As covered earlier, changes arrive after a short copy delay, and clients may add their own caching on top. Treat flags as “soon,” not “now.” For anything that needs strict ordering across machines, such as a database migration step, use tools designed for coordination.

Not a database for your user data

Traits exist to drive flag decisions, not to store your customer profiles. Do not treat them as a general database. Keep the facts small and relevant, and keep the real customer records in your own systems with your own protections.

Not a security boundary on its own

A flag value delivered to a browser or phone can be seen and potentially changed by the person holding the device. Do not use client-side flags to guard sensitive actions. Check permissions on your server, and use flags only for presentation and rollout decisions.

Not a substitute for testing

Flags make it easier to release carefully, but they do not remove bugs. Code behind a flag still needs tests, and both the on and the off states must work. Teams that forget this find themselves with a switch that nobody dares to flip.

You want toUseNot
Show a feature to some usersFlags with segments or percentagesSeparate code branches per user
Edit many flags at onceManagement API or TerraformThe serving endpoints
Guard a sensitive actionServer-side permission checksA client-side flag
Coordinate machines at an exact momentCoordination tools such as locks and queuesA flag flip
Store customer profilesYour own databaseIdentity traits
!
Tip

If a design feels awkward, step back and ask whether you are using flags for what they are good at: fast, gradual, reversible control over what users see.

24A Plain-English Glossary

Quick definitions of the words used in this guide.

Term

Edge

The locations nearest to users, as opposed to a central data centre.

Term

Latency

The time between asking for something and starting to receive the answer.

Term

Stateless

Remembering nothing between requests, which lets any copy of a service answer any request.

Term

Replication

Copying data to several places so reads are local and a single loss does not matter.

Term

Eventual consistency

Copies may differ for a short time but will agree soon without manual repair.

Term

Environment document

A compact bundle of everything needed to answer flag questions for one environment.

Term

Remote evaluation

Asking a service to decide the flag value for you.

Term

Local evaluation

Downloading the rules and deciding on your own machine.

Term

Edge Proxy

A component you run near your apps that caches environment data and answers SDK requests.

Term

Backoff

Waiting a little longer between each retry, so a struggling service is not overwhelmed.

Term

Cold start

The small extra delay when a freshly started copy of a service handles its first request.

Term

Blast radius

How much of a system a failure affects.

Term

CORS

A browser rule that decides whether one website may call a service on another.

Term

Service level objective

A measurable target for how well a service should perform.

25Inside the Decision Engine: Rules, Priority and Fairness

A closer look at how one answer is chosen from many possible rules.

The engine is just a careful checklist

Every flag answer, wherever it is produced, comes from a small piece of logic often called the flag engine. It is not magic. It is a checklist that goes from the most general rule to the most specific one, and the most specific rule that applies is the one that wins. Understanding that order explains almost every surprising result you will ever see.

1

Start with the environment default

Each flag has a default state and value in each environment. If nothing else applies, this is the answer.

2

Check segment rules

The engine looks at the user’s traits and finds which segments match. If a matching segment has its own value for the flag, that value replaces the default.

3

Apply segment priority

If several segments match and disagree, the one you ranked higher wins. This is why the order of segments in the dashboard matters.

4

Check identity overrides

If a specific identity has its own override for the flag, it beats everything above. This is the tool for “turn this on just for the test user.”

5

Resolve variations and splits

For flags with several variations or a percentage split, the engine uses the stable number made from the user’s ID to place them in a group.

An example in numbers

Imagine a flag called “new_search.” In production, the default is off. A segment called “premium users” turns it on. A second segment called “users in India” leaves it off, and you ranked it above the premium segment. One identity, a tester named “test-user-001,” has an override that turns it on.

UserTraitsMatching rulesResult
AnitaFree plan, IndiaIndia segment onlyOff
BenPremium plan, United KingdomPremium segment onlyOn
ChitraPremium plan, IndiaBoth, India ranked higherOff
test-user-001Free plan, IndiaIndia segment, plus identity overrideOn, because the override is most specific
GuestNo traitsNoneOff, the default

Notice how Chitra gets “off” even though she is premium. That is not a bug. Her country segment outranks the premium segment. When a result surprises you, writing out a table like this is the quickest way to find the reason.

Analogy

School rules work in layers. A general rule says everyone wears a uniform. A rule for the sports team says wear the team kit on match days. A note from a doctor excuses one particular student from a rule. The most specific note wins. The flag engine reads its rules the same way, from general to specific.

Why the answer is the same everywhere

Because the same engine logic is used by the edge, by local evaluation inside server SDKs, and by the Edge Proxy, the same user with the same traits gets the same flags no matter which path answers. That consistency is deliberate. It means you can move an app from one evaluation approach to another without surprising your users.

Fairness in percentage splits

For a rollout to be fair and stable, each user needs a fixed position. The engine takes the user’s ID, combines it with the identity of the flag, and runs it through a mathematical function that always returns the same number for the same input. That number is then compared with your percentage. Because the flag is part of the input, a user who falls in the first five percent for one flag is not automatically in the first five percent for every other flag, which avoids the unfair situation where the same unlucky people always receive every experiment.

!
Tip

When a rollout feels uneven, check the identity first. An ID that changes between visits is the usual cause. The engine is steady only when the input is steady.

Common surprises explained

  • A user keeps seeing the old version. A higher-ranked segment or an identity override is probably winning. Check both.
  • A new segment seems to do nothing. The user’s traits may not have been sent with the request, so the segment cannot match.
  • Two environments behave differently. Rules and segments are stored per environment, so they must be set up in each.
  • A trait change takes a moment to matter. Traits are stored when sent, and the next evaluation uses them. An older cached answer on the device may need to refresh first.

26Running Flags Across Many Teams

What works for five engineers needs a little structure for fifty.

Why structure matters

The Edge API makes serving flags easy. That ease can tempt a growing company into creating hundreds of flags with no owners, no naming rules and no plan for removal. Each flag is a branch in your code that someone must understand and eventually delete. Unmanaged flags become flag debt, a slow build-up that makes software harder to read, test and change.

A light set of rules

Naming

Say what and where

Begin names with the product area, such as checkout or search, and describe the change. Names appear in dashboards, logs and graphs, so make them self-explaining.

Ownership

One named owner

Every flag has a person or team responsible for it, recorded in a tag or description, so questions have an address.

Lifespan

Planned removal

Release flags carry a target removal date. Long-lived flags, like kill switches, are labelled as such so nobody deletes them by mistake.

Review

Approval for production

Production changes need a second person’s approval, which also creates a clear record in the audit log.

Keys

Key hygiene

Keys are stored in a secrets manager, named by purpose, rotated on a schedule, and removed when no longer used.

Cleanup

Quarterly sweep

Once a quarter, review flags older than a set age, remove those that are fully released, and delete their code.

Who needs what permissions

Not everyone needs the power to change production. A sensible arrangement lets most engineers view flags and edit them in development and staging, lets a smaller group change production, and reserves administrative actions, such as creating keys, for a few trusted people. This follows the old principle of least privilege: give each person only the access their job requires.

Analogy

In a large building, every employee has a pass for the front door, fewer have a pass for the server room, and only a handful hold the master key. Nobody is distrusted. The arrangement simply limits the damage any single mistake or lost pass can cause.

A small runbook for incidents

A runbook is a short, step-by-step guide that a tired person can follow at night. A useful flag runbook has five lines. First, look for recent flag changes on your dashboards. Second, open the audit log to see exactly what changed and who did it. Third, if a change is a plausible cause, reverse it. Fourth, watch your graphs to confirm recovery. Fifth, write a short note linking the flag, the graph and the ticket for the review afterwards.

Keep the audit log in your sights

The audit log is the official diary of every change. Make a habit of reading it during reviews, not just during emergencies. Patterns appear quickly: flags changed at odd hours, changes made without a ticket, or flags that were flipped many times in a day. Each pattern points to an improvement in process, training or tooling.

!
Watch out

Do not allow shared logins for flag management. When everyone uses one account, the audit log can say what changed but never who changed it, and that defeats much of its value.

Measure the health of your flag practice

A few simple measures keep a flag practice honest. Count how many flags are older than ninety days. Count how many have no owner. Track how often production flags are changed without review, and how long it takes to reverse a flag in an emergency. You do not need fancy tools. A short table updated each quarter is enough to show whether things are improving.

A one-page cheat sheet

If you remember only a handful of rules from this guide, make them these. They fit on a single sticky note and prevent most of the trouble teams run into with edge-served flags.

  • Know your half. Editing goes through the core and the dashboard. Reading goes through the edge. Do not mix them up when you plan automation.
  • Pick the key by place. Public client-side key for apps and sites, secret server-side key for trusted servers only.
  • Default to safe. Every flag needs a default that keeps the stable behaviour alive when no answer arrives.
  • Fetch once, reuse often. Hold flags in memory, refresh on a calm timer, and never call the network inside loops.
  • Always set a time limit. A slow answer should become a default, not a frozen screen.
  • Expect a short delay. Allow a few seconds between saving a change and seeing it everywhere.
  • Keep identities steady. Stable IDs give stable rollouts, stable overrides and fair experiments.
  • Share less data. Small, coarse, non-sensitive traits only.
  • Watch from your side. Track request time, error rate and fallback rate, and mark flag changes on your graphs.
  • Clean as you go. Give every flag an owner and a planned removal, and sweep old ones every quarter.

Stick this list next to your team’s runbook. New joiners can read it in two minutes, and experienced engineers will find that it settles most design arguments quickly. Good habits around a fast service are what turn raw speed into a calm, dependable experience for the people who use your product, wherever in the world they happen to be.

One last piece of advice concerns patience with yourself. Nobody designs the perfect flag setup on the first attempt. Begin with a single environment, a couple of flags, safe defaults and a basic dashboard marker. Observe how the system behaves for a few weeks, note the surprises, and improve one habit at a time. Teams that grow their practice gradually end up with simpler, sturdier setups than teams that try to build everything before launch, because every addition is justified by a real need they have already seen.

27Frequently Asked Questions

Quick answers to the questions beginners ask most often.

Q1Do I have to do anything to use the Edge API?
On Flagsmith’s hosted service, SDKs normally point at the edge by default, so using an environment key and keeping the default address is usually enough. Always confirm current defaults in the documentation for your SDK.
Q2How quickly does a change reach my users?
The change must be saved, copied to the edge store and then picked up by each app. The copying step is usually brief, and the app step depends on its refresh timer or real-time updates. Plan for seconds, and for longer if your app uses long refresh timers.
Q3Is the Edge API the same as a content delivery network?
No, but it follows a similar idea. A content delivery network copies files such as images. The Edge API copies flag settings and evaluates rules for each request near the user.
Q4What happens if the Flagsmith core is down?
Editing and the dashboard may be affected, but apps asking the edge can keep receiving flags from the copied data. This separation is one of the main reasons the design exists.
Q5What happens if the edge itself cannot be reached?
Your app should fall back to cached values and then to safe defaults. This is why choosing defaults carefully and setting timeouts are essential parts of using flags.
Q6Can I use the Edge API if I self-host Flagsmith?
The global edge is part of the hosted offering. Self-hosted teams usually use the Edge Proxy and local evaluation to get similar speed close to their own applications. Check the documentation for your version.
Q7Which key should I put in my mobile app?
Only the client-side environment key. It is designed to be public and limited to reading flags. Never place a server-side key in an app or website.
Q8Why does my test app disagree with the dashboard?
Common reasons are the short copy delay, an older cached copy in your SDK, the wrong environment key, or a segment or override that applies to your test user. Work through the troubleshooting order in this guide.
Q9Should I use remote evaluation or local evaluation?
Use remote evaluation through the edge for browsers and phones. Consider local evaluation for trusted, high-volume backend services, accepting that changes appear only after the next refresh.
Q10How often should my app refresh flags?
Often enough that stale flags do no harm, and rarely enough to avoid wasted requests. Minutes are typical for ordinary features. Use live updates or shorter timers only for parts that truly need fast change.
Q11Will users see the same flags on every device?
If you send the same stable identity from each device, they will receive the same results, since the rules and the user split are repeatable. If each device invents its own anonymous ID, results may differ.
Q12Is it safe to store user traits at the edge?
It is safe to store small, non-sensitive facts, but remember that data is held in several places. Avoid secrets and personal details, follow your privacy rules, and ask about regional requirements if you have them.
Q13Can flags protect sensitive features?
Not by themselves. A value on a user’s device can be inspected. Protect sensitive actions with permission checks on your server and use flags to decide what the screen shows.
Q14How do I know whether the edge is the cause of a slowdown?
Measure flag call duration from your own app, compare regions, check the status page, and look at your fallback rate. If other calls are slow too, the cause is probably your network rather than the flag service.
Q15What is the single most important habit?
Choose safe defaults and test them. If your app behaves well when it cannot get an answer, almost every other problem becomes mild.

28Summary and Key Takeaways

The whole guide on one page.

Key Takeaways

  • The edge shortens distance. The Edge API answers flag questions from locations near your users, using copied data, so apps get fast answers without a long trip to a central server.
  • Serving and editing are separate. The core handles editing, permissions and the audit log. The edge handles reading. Core problems do not interrupt serving.
  • Copies lag slightly. Changes reach the edge after a short delay. Design for seconds of difference, never for a perfectly simultaneous worldwide switch.
  • Nodes are stateless. Any copy can answer any request, which makes scaling smooth and failures quiet.
  • Keys and data need care. Use client-side keys in apps, server-side keys only on servers, and send only small, non-sensitive traits.
  • Cache, time out, and default. Fetch once, reuse from memory, set timeouts, and choose safe defaults so network trouble stays invisible to users.
  • Choose the right route. Use remote evaluation through the edge for browsers and phones, local evaluation for busy trusted backends, and the Edge Proxy when self-hosting.