Creating Your First Flag in Flagsmith

Creating Your First Flag in Flagsmith

Creating Your First Flag in Flagsmith

A complete, beginner-friendly walk from an empty account to a working feature flag: what a flag is, how Flagsmith is organised, how to create and test your first flag, how to connect an application, and how to avoid the habits that make flags painful later.

Imagine you have just finished a new checkout page. It looks wonderful and the tests pass, but you are nervous. What if a hidden bug appears when thousands of real customers use it? In the old way of working, you would release the page to everyone at once and hope for the best. If something broke, you would scramble to release an older version, which could take an hour or more while customers struggled.

Now imagine the new page was wrapped in a switch. You release the code with the switch turned off, so nobody sees the new page. Later you turn the switch on for your own team, then for one in twenty customers, then for everyone. If anything looks wrong, you flip the switch back in seconds, without releasing any code. That switch is a feature flag, and Flagsmith is a tool that gives you the switchboard.

This guide takes you from nothing to your first working flag. We assume you know nothing about feature flags or about Flagsmith. We explain each new word when it first appears, use everyday comparisons, and walk through every step in plain language. We deliberately avoid code listings so that the ideas stay clear, and so that the guide stays correct as screens and libraries change. Where the exact wording of a button or setting might differ in your version, we say so, and we suggest you confirm it in the current Flagsmith documentation.

1What a Feature Flag Really Is

Before clicking anything, let us make sure the idea is clear. A flag is simpler than it sounds.

A switch outside the code

A feature flag is a named switch that lives outside your program. Your program asks a simple question, such as “is the new checkout page on?”, and the flag service answers yes or no. Because the answer comes from the service and not from the code, you can change the answer at any moment without building or releasing anything. The code contains both versions of the behaviour, the old and the new, and the flag decides which one runs.

Analogy

Think of the lights in a theatre. The electricians installed all the wiring and lamps long before the show. During the performance, the lighting operator sits at a control desk and raises or lowers the lights with sliders. Nobody climbs a ladder or rewires anything. A feature flag is the slider, your software is the stage, and Flagsmith is the control desk.

Why teams use flags

Safety

Release without fear

Ship code switched off, then turn it on gradually. If something goes wrong, turn it off in seconds.

Control

Separate deploying from releasing

Engineers deploy code whenever it is ready. Product people decide when customers see it.

Learning

Test with real users

Show a change to a small group first, watch what happens, and then decide whether to expand.

Targeting

Different users, different experiences

Give beta testers, paying customers or one country a different experience from everyone else.

Rescue

Kill switches

Turn off a risky or expensive feature instantly during an incident or a traffic spike.

Settings

Change values without releases

Adjust text, limits and thresholds remotely, with no new version of the app.

Two flavours in Flagsmith

Flagsmith treats a feature as having two parts that can be used together or separately. The first part is the enabled state, which is simply on or off. The second part is an optional value, which can be text, a number or a small piece of structured data. A feature used only for its on or off state is a plain flag. A feature used mainly for its value is often called remote configuration. A single feature can use both, for example “the banner is enabled, and its message says Welcome back.”

i
Remember

A flag is a decision made outside the code. It does not make a feature good or bad. It only gives you control over when and to whom the feature appears.

1
name identifies each flag across your whole system
2
parts of a feature: the on or off state and an optional value
0
releases needed to change a flag once the code is in place

2Meet Flagsmith

Let us get to know the tool before we use it.

What Flagsmith is

Flagsmith is a feature flag and remote configuration service. It gives you a web dashboard where people manage flags, and it gives your applications small code libraries, called SDKs, that ask Flagsmith for the current state of each flag. An SDK, short for software development kit, is a ready-made helper for a particular language or platform, so you do not have to write the network requests yourself. There are SDKs for web pages, mobile apps and many server languages.

Hosted or self-hosted

You can use the hosted service, where the Flagsmith team runs everything and you simply sign in, or you can run the open-source software yourself on your own servers. For a first flag, the hosted service is the quickest path, because there is nothing to install. Everything in this guide applies to both, apart from the sign-up and the address your applications use to reach the service.

The two kinds of traffic

It helps to picture two streams. The first is people using the dashboard to create and change flags. That stream is small and human. The second is applications asking what each flag should be for each user. That stream can be large, because a busy product asks all day long. Creating your first flag is about the first stream, and connecting your application is about the second.

Analogy

Flagsmith is like a restaurant’s menu board and the waiters who read it. The manager changes the board in the office, which is the dashboard. The waiters, which are your applications, glance at the board each time a customer orders, so they always describe today’s menu correctly. When the manager changes the board, every waiter sees the new menu at once.

i
Good to know

Screens, labels and plan limits change over time. Treat the steps in this guide as a map of the ideas. If a button has a slightly different name in your version, look for the closest match, and check the current documentation when in doubt.

3How Flagsmith Is Organised

Flagsmith arranges everything in layers. Learning them first makes every later screen make sense.

The layers

At the top is the organisation, which usually represents your company or team. It holds the people, the billing and the overall history. Inside an organisation live projects. A project usually represents one product or application, such as your website or your mobile app. Inside a project live environments. An environment is a separate copy of the world, such as development, staging and production. Inside the project you also define features, which are your flags and configuration values. Each environment keeps its own state for every feature.

flowchart TB
    O["Organisation: Your Company"] --> P1["Project: Website"]
    O --> P2["Project: Mobile App"]
    P1 --> E1["Environment: Development"]
    P1 --> E2["Environment: Staging"]
    P1 --> E3["Environment: Production"]
    P1 --> F["Features defined once for the project"]
    F --> F1["Feature: new_checkout"]
    F --> F2["Feature: welcome_banner"]
    E1 --> S1["new_checkout is ON"]
    E2 --> S2["new_checkout is ON"]
    E3 --> S3["new_checkout is OFF"]
Figure 1. One organisation, projects inside it, and environments that each hold their own state for the same features.

Reading the picture

The organisation at the top contains two projects, a website and a mobile app. Looking at the website project, you see three environments and a list of features. The important idea is on the right: a feature such as new_checkout is defined once for the project, but each environment stores its own on or off state for it. In the picture, the new checkout is on in development and staging, where the team tests it, and off in production, where customers are. This is the safety that makes flags useful.

Analogy

Think of a hotel chain. The chain is the organisation. Each hotel is a project. Each floor in a hotel is an environment. Each light switch type, such as the corridor lights or the sign outside, is a feature. The same type of switch exists on every floor, but each floor’s switch can be on or off independently.

Why environments matter so much

Environments let you try things safely. You create a flag, switch it on in development, test the behaviour, repeat in staging and only then switch it on in production. Mistakes made in development hurt nobody. Production stays calm until you decide otherwise. Many beginners underestimate this, and then learn it the hard way the first time they change something live by accident.

Top

Organisation

Your company. Holds people, billing and the overall audit history.

Middle

Project

One product or application. Holds its features, segments and environments.

Safe space

Environment

A separate copy of the world, such as development or production, with its own keys and states.

Content

Feature

A flag or configuration value, defined once and given a state in each environment.

!
Heads up

Always check which environment is selected before you change a flag. Many “I broke production” stories begin with someone who believed they were in development.

4Before You Start: Planning Your First Flag

Five minutes of thinking now saves hours of confusion later. Decide these things before you click the button.

Choose something small and safe

Your first flag should be easy to understand and harmless to get wrong. A good example is a welcome banner on a test page, a small new button or a non-critical message. Avoid choosing something tied to payments, security or data deletion for your very first attempt. The goal is to learn the workflow, not to take risks.

Decide the question the flag answers

Write the flag’s purpose as a short question that has a clear yes or no answer, for example “Should this user see the new welcome banner?” If you cannot phrase it that way, the idea may be too vague. A flag that tries to control many things at once becomes hard to reason about.

Pick a good name

The name is how your code and your colleagues refer to the flag, so it must be clear. Good names are short, descriptive and consistent. Many teams use lowercase words joined by underscores, such as welcome_banner. Avoid names like test1 or new_thing, which tell nobody anything after a month. Avoid putting a date or a person’s name in the flag. A name that describes the behaviour stays useful longer.

Decide who owns it and when it ends

Every flag should have an owner, the person responsible for it, and an expected end date. Most flags are meant to be temporary: once a feature is fully released and stable, the flag should be removed along with the old code path. Flags that never die pile up and make the code harder to understand. Writing the owner and the plan in the description from the start prevents this.

Planning questionGood exampleWeak example
What question does it answer?Should this user see the new welcome banner?Make things better
What is its name?welcome_bannertest1
Who owns it?The web team, contact named in the descriptionNobody decided
When should it end?Remove after full release plus two weeksNever considered
What happens if the service is unreachable?Fall back to the banner being offApplication errors out
Analogy

Planning a flag is like labelling a jar before you put food in it. A clear label with the contents and the date means anyone can use the jar properly a month later. A blank jar full of unknown contents is a problem waiting to happen.

i
Tip

Decide the safe default before you start. If your application cannot reach Flagsmith, which behaviour is safest: the feature on or off? For new, untested features, the answer is almost always off.

5Setting Up Your Account, Organisation and Project

Before a flag can exist, it needs a home. Here is how to create one from nothing.

1

Sign up or sign in

Create an account on the hosted service or sign in to your own installation. Use your work email, and enable extra sign-in protection if it is offered.

2

Create or choose an organisation

On first use you are usually asked to name an organisation. Use your company or team name. Others can be invited later.

3

Create a project

Give the project the name of the product it serves, such as the website or the mobile app.

4

Look at the environments

New projects typically begin with at least a development and a production environment already created. Confirm what you have, and add a staging environment if your team uses one.

5

Open the features area

Choose the development environment and open the section that lists features. For a new project it will be empty, waiting for your first flag.

Choosing names that last

Names of organisations, projects and environments appear everywhere: in the dashboard, in logs and in conversations. Pick clear, boring names. Avoid clever names that only you understand. Keep the environment names consistent across all your projects, so that “production” always means the same thing.

Inviting teammates

Flagsmith lets you invite colleagues and give them roles. Early on, you might be tempted to share one login. Please do not. Individual accounts give you a trustworthy history of who changed what, and let you remove access cleanly when someone leaves. Features such as finer roles and single sign-on may depend on your plan or edition, so check what is available to you.

Analogy

Setting up the organisation, project and environments is like preparing a new kitchen before cooking. You choose the room, set out separate stations for practice and for service, and put each cook’s name on their apron. Only then do you start cooking real dishes.

!
Heads up

Treat production access carefully from the beginning. Even in a small team, decide who is allowed to change flags in production and write it down. It is much harder to tighten access later than to start careful.

6Creating Your First Flag, Step by Step

This is the heart of the guide. Follow these steps slowly, and notice the choice at each one.

1

Select the development environment

Make sure the environment shown is development, not production. Look for the environment name near the top or side of the screen.

2

Open the features list

Find the section named features. In a new project, it shows an empty list and an invitation to create your first feature.

3

Choose to create a feature

Use the create button. A form or panel opens asking for the details of the new feature.

4

Enter the name

Type your planned name, such as welcome_banner. Names usually cannot be changed casually later, so check the spelling.

5

Write a description

State the purpose, the owner and the planned end, for example “Shows the welcome banner on the home page. Owner: web team. Remove after full release.”

6

Decide the starting state

Choose whether the feature starts enabled or disabled. For a first flag, start it disabled, then switch it on deliberately.

7

Optionally add a value

If you want remote configuration as well, such as the banner message, enter it now. For a pure on or off flag, leave the value empty.

8

Add tags if you like

Tags are labels, such as web or experiment, that help you search and group flags later.

9

Save

Confirm the creation. The feature now appears in the list for every environment of the project.

What just happened

You created a feature, and Flagsmith placed it in every environment of the project, each with its own state. The state you chose in the form applies to the environment you were in when you created it, and other environments typically start with the default state. Open the production environment and look at your new feature. Confirm that it is disabled there. This habit of checking the other environments after a change will serve you for years.

The fields explained

FieldWhat it meansAdvice
Name (ID)The identifier that code and people use to refer to the flagShort, clear, lowercase with underscores; treat it as permanent
DescriptionA free-text note for humansWrite purpose, owner and planned end date
Enabled by defaultWhether the feature starts on or offStart off for new, untested behaviour
ValueAn optional piece of text, number or structured dataUse only when you need remote configuration
TagsLabels for grouping and searchingAgree a small, shared set of tags with your team
Options for variationsExtra values used to split users into groups for experimentsLeave alone for the first flag
Analogy

Creating the flag is like adding a new switch plate to the control panel of that theatre. First you decide what it controls and write a clear label. Then you install it, and it appears on every floor’s panel. Only afterwards do you decide which floors turn it on, and when.

i
Tip

Resist adding every optional setting on day one. A first flag with only a name, a description and an off switch is enough. Complexity can be added when you understand the basics.

7Switching a Flag On and Off

Your flag exists. Now let us learn to control it, safely and with confidence.

The toggle

Next to each feature in the list for an environment, you will find a toggle, a small switch that shows the current state. Click it to turn the feature on or off for that environment. In most versions you are asked to confirm the change. Once confirmed, the new state is saved immediately, and applications asking for the flag will receive the new answer the next time they ask, or the next time their cached copy refreshes.

How quickly does a change take effect?

The dashboard saves the change at once. How soon an application notices depends on how that application’s SDK is set up. Some ask the service on every request and notice immediately. Others keep a cached copy for a short time to reduce traffic and refresh it at intervals, so the change appears within that interval. Some server setups use local evaluation, where rules are downloaded and refreshed periodically. Understanding this stops you from panicking when a change does not appear in the same second.

sequenceDiagram
    participant P as Person in Dashboard
    participant F as Flagsmith Service
    participant S as Application SDK
    participant A as Your Application
    participant U as User
    P->>F: Turn welcome_banner ON in Development
    F->>F: Save new state and record in audit log
    F-->>P: Change confirmed
    U->>A: Opens the home page
    A->>S: Is welcome_banner on for this user
    alt SDK holds a fresh cached answer
        S-->>A: Returns cached answer
    else Cache expired or empty
        S->>F: Ask for current flags
        F-->>S: Returns latest state
        S-->>A: Returns new answer
    end
    A-->>U: Shows the page with or without the banner
Figure 2. A change is saved at once, but the application sees it when its SDK next asks, or its cached answer expires.

Reading the sequence

At the top, a person turns the flag on in the development environment. Flagsmith saves the new state, writes an entry in its audit log and confirms to the person. Later, a user opens the home page. The application asks its SDK whether the banner is on. If the SDK holds a fresh cached answer, it replies instantly with whatever it last learned. If the cached answer has expired or is empty, the SDK asks Flagsmith for the latest state and passes the new answer back. The page is then shown with or without the banner.

Analogy

It is like changing the opening hours on a shop’s website. The change is saved the moment you press the button, but a customer who loaded the page ten minutes ago may still see the old hours until they refresh. The cache is the customer’s memory of what they last saw.

Good habits when switching

  • Confirm the environment name every single time you click.
  • Change one thing at a time, so you know what caused any effect.
  • Tell your team in a chat channel when you change something in production.
  • Watch your monitoring for a few minutes after turning on a significant flag.
  • Know in advance how you will turn it off, and who will do it.
!
Heads up

Do not test in production first. Switch your flag on in development, test it there, then in staging, and only then in production. Each stage is an inexpensive chance to find a mistake.

8Flag Values and Remote Configuration

A flag can do more than say yes or no. It can carry information, and that makes it a remote control for your application’s settings.

What a value is

Besides its on or off state, a feature can hold a value. A value can be a short piece of text, a number, or structured data in a common format. Your application reads the value and uses it. For example, the welcome banner feature could carry the message text, so that marketing can change the wording without waiting for a release. Another feature might carry a number, such as the maximum number of items shown in a list, so that engineers can tune it as they watch performance.

Flag state and value together

The two parts are independent but can be combined. The state controls whether the feature is active, and the value controls how it behaves when active. A well-designed feature often has both: the banner is enabled, and its message reads whatever the value says. If the feature is disabled, your application ignores the value and behaves as if the banner does not exist.

Text

Messages and labels

Banner wording, button captions or notices that non-engineers may want to adjust.

Number

Limits and thresholds

Page sizes, retry counts, timeouts or discount percentages that can be tuned live.

Structured

Small bundles of settings

Several related settings grouped together in a standard text format, read as a whole.

Switch

Plain on or off

No value at all. The state alone answers the question.

Analogy

Think of a thermostat. The on and off button is the flag state. The temperature you dial in is the value. When the heating is switched off, the number on the dial does not matter. When it is on, the dial decides how warm the room becomes. Both together give you full control from the wall.

Cautions about values

  • Never store passwords, keys or other secrets in a value. Values can appear in logs, in client applications and in webhook messages.
  • Remember that values read by browsers and mobile apps are visible to anyone who inspects the traffic.
  • Validate values in your application, so a typing error in the dashboard cannot break a page.
  • Keep values small and clear. Large or complicated values become hard to review and risky to edit.
!
Heads up

Treat every value as untrusted input. Your application should check that a number is within a sensible range and that text is safe to display, because a mistake in the dashboard should never be able to break your product.

9Connecting Your Application

A flag in the dashboard does nothing until an application asks about it. This chapter explains how the connection works, without any code.

Environment keys

Each environment has keys that applications use to identify which environment’s flags they should read. A client-side key is designed for browsers and mobile apps and is safe to include in them, because it can only read flags. A server-side key is for trusted servers and unlocks additional abilities, such as local evaluation. Server-side keys must be kept secret. Find the keys in the environment’s settings, copy the correct one for the type of application you are building and store it in your application’s configuration, not in public code.

Choosing an SDK

Flagsmith offers SDKs for many platforms. Choose the one that matches the language or platform of your application. Installing it follows the normal process for that platform, and the documentation lists the exact steps. In every case, you give the SDK the environment key and, if you self-host, the address of your installation.

The four things every application does

1

Set up the SDK

Provide the environment key, and the service address if self-hosting, usually once when the application starts.

2

Ask for the flag

At the point where behaviour should differ, ask the SDK whether the named flag is enabled, and read its value if you use one.

3

Branch on the answer

If the flag is on, run the new behaviour. If it is off, run the existing behaviour.

4

Handle failure safely

If the answer cannot be obtained, fall back to a sensible default that you chose in advance.

Defaults protect you

Networks fail, services restart and requests time out. Your application must decide what to do when it cannot get an answer. The best practice is to define a default for every flag in your code. For a new feature the safe default is usually off, so a failure simply hides the new behaviour. Test this by deliberately blocking access to Flagsmith in a development environment and watching what your application does.

Analogy

An SDK is like a waiter who checks the specials board before describing the menu. The environment key is the waiter’s badge showing which restaurant branch they work in. The default is the standard menu the waiter falls back on if the specials board is missing. The customer is never left without a menu.

i
Tip

Write a tiny wrapper in your code so that all flag questions go through one place. If you ever change how flags are fetched, or even change tools, you edit one file instead of hundreds.

10Testing Your First Flag End to End

A flag is only trustworthy when you have watched it work. Here is a simple test routine you can repeat for every flag you ever create.

flowchart TD
    A["Create flag disabled in Development"] --> B["Run app and confirm old behaviour appears"]
    B --> C["Switch flag ON in Development"]
    C --> D{"New behaviour appears after refresh"}
    D -- No --> E["Check key, environment, name spelling and cache"]
    E --> B
    D -- Yes --> F["Switch flag OFF again and confirm old behaviour returns"]
    F --> G["Block access to Flagsmith and confirm safe default"]
    G --> H["Repeat the routine in Staging"]
    H --> I["Release to Production with flag still OFF"]
    I --> J["Turn ON gradually and watch monitoring"]
Figure 3. A repeatable test routine: prove off, prove on, prove off again, prove the fallback, then climb the environments.

Reading the routine

Start with the flag disabled in development and confirm that your application shows the old behaviour. Switch the flag on, refresh and confirm that the new behaviour appears. If it does not, work through the usual suspects: the wrong key, the wrong environment, a misspelled name or a cached answer. When it works, switch the flag off again and confirm that the old behaviour returns. Many people forget this step, and discover too late that turning a flag off does not actually restore the old state.

Next, test the failure case. Block your application’s access to Flagsmith, and confirm that it falls back to the safe default and keeps working. Then repeat the routine in staging. Finally, release the code to production with the flag still off, confirm that nothing changed for users, and turn the flag on gradually while watching your monitoring.

Analogy

This routine is like testing a new fire exit. You do not just admire the door. You open it, walk through it, close it, check that the alarm sounds and that the lights guide people out. Only a tested exit can be trusted when it matters.

If the flag does not seem to work

SymptomLikely causeWhat to try
Flag always appears offWrong environment key or flag disabled in that environmentCompare the key’s environment with the one you changed
Change does not appear immediatelySDK cache or refresh intervalWait for the interval or refresh the application
Flag not foundName misspelled in code or dashboardCompare the names character by character
Works in development, not in productionFlag still off in production or different keyCheck production’s state and key
Application errors when service is downNo default value definedAdd a default and retest the failure case
Everyone sees the feature, not just testersTargeting not configured, flag simply onUse segments or identity overrides, covered next
i
Good to know

Keep this test routine written down where your team can find it. The more consistently everyone tests, the fewer surprises appear on release day.

11Targeting: Showing a Flag to Some Users

So far your flag is on or off for everybody. The real power appears when you decide who sees what.

Identities

An identity is one particular user known to Flagsmith, identified by an ID that your application supplies, such as a user number. When your application asks for flags on behalf of an identity, Flagsmith can give that person different answers from everyone else. You can override a flag for a single identity, which is perfect for letting one colleague or one customer see a feature early.

Traits

A trait is a small fact about an identity that your application sends, such as plan type, country or app version. Traits are the raw material for targeting. They let you say things like “show this to users on the premium plan” without naming every person.

Segments

A segment is a saved group of users defined by rules on their traits. For example, a segment called beta testers might include everyone whose trait says they joined the beta programme. Once defined, a segment can be reused across many flags. In a feature’s settings, you add a segment override, which says “for this segment, give this flag a different state or value from the default.”

Analogy

Imagine a cinema that runs a special preview screening. The doorman has a list of names for individual guests, which are identity overrides. He also has a rule such as “everyone with a loyalty card,” which is a segment. Everybody else who arrives simply gets the normal film. The film is the same, but the door staff decide who gets which experience.

A typical rollout path

1

Default off for everyone

The flag is disabled in production. Nobody sees the new behaviour.

2

Enable for individuals

Add identity overrides for the people building and testing the feature, so they can see it in production safely.

3

Enable for a segment

Create a segment such as internal staff or beta testers and turn the flag on for it.

4

Roll out by percentage

Where supported, enable the flag for a growing share of users, watching quality measures at each step.

5

Enable for everyone

Once confident, turn the flag on by default. Keep it for a short safety period, then remove it.

Targeting toolWhat it targetsGood for
Default stateEveryone who matches nothing elseThe baseline for the whole population
Identity overrideOne specific userEarly access for named testers or a support case
Segment overrideAny user who matches the segment rulesBeta groups, plans, regions or app versions
Percentage rolloutA random but stable share of usersGradual release and risk control
i
Tip

Do not send more personal data than you need. Use opaque identifiers and only the traits required for targeting. It keeps privacy reviews simple and limits risk if anything leaks.

12Gradual Rollouts and Experiments

Instead of a risky switch from nothing to everything, you can turn a flag up like a volume knob.

Percentage rollouts

A percentage rollout enables a feature for a chosen share of users. Flagsmith assigns each user a stable position, so the same user keeps getting the same answer as you raise the percentage. A user in the first five percent stays in as you move to ten percent. This matters because a feature that appears and vanishes for the same person would feel broken.

How to ramp up

A careful ramp might go from internal staff, to one percent, five percent, twenty-five percent, half and then everyone, pausing at each step to look at errors, speed and business measures. If anything worsens, you stop or step back down. The pace depends on your risk. A cosmetic change can ramp quickly. A change to payments deserves a slow climb.

Multivariate options and experiments

Beyond simple on and off, Flagsmith supports multivariate features, where a flag has several possible values with a share of users assigned to each. This lets you compare variations, for example three different banner messages, and see which performs better using your own analytics. Flagsmith handles the assignment, and your analytics tool measures the result. Experimentation needs care to interpret correctly, so start with the basics before trying it.

Analogy

A gradual rollout is like opening a new restaurant menu in one section of the dining room first. You watch how the waiters cope and how guests react. If the dishes sell and nothing goes wrong, you extend the menu to the next section. You never switch the entire restaurant at once on opening night.

Watch

Errors

Does the error rate rise as you increase exposure? That is the first and clearest warning sign.

Watch

Speed

Do pages or actions get slower for users who have the feature?

Watch

Behaviour

Do users complete tasks as before? Look at signups, purchases or whatever matters to your product.

Watch

Feedback

Do support tickets or comments change? Human reactions often arrive before the numbers show it.

!
Heads up

Availability of percentage rollouts, multivariate features and related tools can depend on your edition and plan. Check what yours includes before designing a rollout plan around them.

13Naming, Tags and Descriptions

Ten flags are easy to manage by memory. Two hundred are not. Good habits at the start keep a growing collection tidy.

Naming conventions

Agree a naming style with your team and use it every time. A consistent style might be lowercase words joined by underscores, beginning with the area of the product, for example checkout_new_payment_form. Descriptive names help people search and understand. Avoid abbreviations that only one person knows, and avoid negative names such as disable_old_search, which make on and off confusing. A flag called new_search that is on means the new search is active, which is easy to read.

Descriptions that help

The description should answer four questions: what does it control, who owns it, when was it created and when should it be removed? A sentence or two is enough. In a year, when somebody wonders whether a flag is still needed, the description is the first and often the only clue.

Tags for grouping

Tags are short labels attached to features. Use them for dimensions you will want to filter on, such as the team, the type of flag or the related project. Keep the set of tags small and agreed, because tags that multiply without control lose their value. Some useful tag ideas are release, experiment, kill-switch and permanent.

Flag lifetimes

It helps to tell people what kind of flag each one is. Release flags exist to roll out a feature and should be short lived. Experiment flags exist to test ideas and end when the test ends. Kill switches exist to turn things off in emergencies and may live long. Permission or plan flags control access to paid features and may be permanent. Labelling the kind makes it clear which flags should be cleaned up and which should be kept.

Flag typePurposeExpected lifetimeCleanup rule
Release flagRoll out a new feature safelyDays to weeksRemove after full release and a safe period
Experiment flagCompare variationsLength of the experimentRemove after a decision is made
Kill switchTurn off a risky or costly feature in an emergencyLongReview yearly and test occasionally
Permission flagControl access by plan or rolePermanentKeep, but document clearly
Configuration valueTune settings remotelyLongReview when settings change meaning
Analogy

Naming and tagging flags is like organising a toolbox. If each tool has a clear place and a clear label, you find the right one in seconds. If tools are thrown in at random, you waste time every day and eventually buy a second hammer because you cannot find the first.

i
Tip

Write your naming and tagging rules on one page and link it from your team’s handbook. New teammates will follow the pattern without being told, and the dashboard will stay readable.

14The Flag Lifecycle

A flag has a life: it is born, used, finished and, ideally, removed. Understanding the whole cycle keeps your system clean.

flowchart LR
    A["Plan: purpose, owner, end date"] --> B["Create: disabled in all environments"]
    B --> C["Build: code with both paths and a safe default"]
    C --> D["Test: dev then staging"]
    D --> E["Release code with flag OFF"]
    E --> F["Roll out: individuals, segments, percentages"]
    F --> G["Full on: monitor for a safe period"]
    G --> H["Clean up: remove flag and old code path"]
    H --> I["Archive the flag in Flagsmith"]
Figure 4. The life of a release flag, from plan to cleanup.

Reading the lifecycle

The cycle begins with a plan: the purpose, an owner and a planned end. The flag is then created, disabled in every environment, and the code is written with both paths and a safe default. Testing happens in development and staging. The code is released to production with the flag still off, so the release itself changes nothing for users. After that, the rollout begins, first for individuals, then for segments and percentages, until the flag is on for everyone. Then there is a safe period in which you watch for trouble. Finally comes the step many teams skip: cleanup, where the flag is removed from the code along with the old path, and the flag is archived in Flagsmith.

Why cleanup matters

Every flag left in the code is a branch that someone must understand. Over time, forgotten flags make the code confusing, make tests more complex and hide bugs in rarely used paths. Teams that never clean up find themselves afraid to touch old flags because nobody remembers what they do. Make cleanup part of the definition of done for any feature that used a release flag.

Analogy

A release flag is like the scaffolding around a building under construction. It is essential while the work is going on. But once the building is complete and safe, the scaffolding must come down. A town full of abandoned scaffolding is ugly, dangerous and expensive to maintain.

Archiving

Flagsmith lets you archive a feature that is no longer needed, which removes it from the active list while keeping the history. Archive only after the code no longer asks for the flag, otherwise applications will receive unexpected answers. A good routine is to remove the code first, deploy, confirm nothing asks for the flag, and then archive it.

!
Heads up

Never delete or archive a flag while any running version of your application still asks for it. Mobile apps are especially tricky, because old versions can live on users’ phones for months.

15Teamwork, Permissions and the Audit Log

A flag is a powerful lever, so it matters who can pull it, and who can see who pulled it.

Who should be allowed to change what

Not everyone needs the power to change production flags. A common arrangement lets many people view flags, a smaller group change flags in development and staging, and an even smaller group change them in production. Flagsmith supports roles and permissions at several levels, though the finer controls may depend on your plan. Set these up early, while the team is small and the habit is easy to build.

Change approval and scheduling

Some editions offer change requests, where a flag change in a sensitive environment must be approved by another person before it takes effect, and scheduling, where a change is set to occur at a chosen time. These features add a second pair of eyes and let you prepare changes calmly in advance. If they are available to you, consider turning them on for production.

The audit log

The audit log is Flagsmith’s diary. It records who changed what and when, for flags, segments and settings. It answers the most common question in any incident: what changed recently? Make a habit of checking it first when something unexpected happens. Some plans allow the log to be sent onward to other systems through webhooks, which is useful for compliance and for chat notifications.

Analogy

The audit log is like the sign-in book at an office reception. It does not stop anyone from entering, but it records who came, when and why. When something goes missing, the book often tells you where to look.

Access

Roles

Different permissions for viewers, editors and administrators at the organisation, project and environment levels.

Approval

Change requests

Where available, require a second person to approve changes in sensitive environments.

Timing

Scheduled changes

Where available, plan a flag change for a particular time, such as the start of a campaign.

History

Audit log

A diary of changes that answers who, what and when during reviews and incidents.

i
Good to know

Many teams send flag changes to a chat channel, so everyone sees production changes as they happen. It is a simple way to build trust and to catch mistakes early.

16Security and Privacy Basics

Flags look harmless, but they control what your product does. A few simple habits keep them safe.

Protect the keys

Server-side keys can read configuration that you may not want public, and they enable local evaluation. Keep them in a secrets manager or protected configuration, never in code repositories, public pages or chat messages. Client-side keys are designed to be visible in browsers and apps, but they should still be tied to the correct environment, and you should never place secrets in values read by clients.

Protect the dashboard

Give each person an individual account, use strong passwords, enable multi-factor authentication if it is offered and use single sign-on if your plan includes it. Review the user list regularly and remove people who have left or changed roles. Limit who can change production.

Minimise personal data

If you use identities and traits, send only what is needed. Use opaque identifiers instead of names and email addresses, and avoid sensitive information in traits. Smaller data means smaller risk, and simpler privacy reviews.

Do not hide secrets in flags

Never store passwords, tokens or private keys in flag values. Values can travel in network responses, appear in logs and be included in webhook messages. Flags are for behaviour and non-sensitive settings.

Analogy

The control desk in a theatre is not secret, but you would not leave it open to anyone who wanders backstage. You keep the door locked, you know who has the key, and you do not scribble the safe combination on the desk. The same ordinary care applies to a flag dashboard.

Do

  • Give every person an individual account.
  • Restrict production changes to a few trusted people.
  • Keep server-side keys in a secrets manager.
  • Send opaque identifiers and minimal traits.
  • Review the audit log and user list regularly.

Do not

  • Share one login among the whole team.
  • Commit server-side keys to a code repository.
  • Store passwords or tokens in flag values.
  • Send names, emails or sensitive details as traits without need.
  • Leave former employees with access.

17Performance and Reliability Considerations

A flag service sits close to the heart of your product. These habits make sure it helps and never hurts.

Ask less often

Every flag question that leaves your application costs a little time and adds a little load. Good SDK settings reduce this. Caching keeps recent answers in memory for a short time. Local evaluation, available on server-side SDKs, downloads the rules and decides flags inside your own server, so most questions never touch the network. Choose refresh intervals that match how quickly you need changes to appear.

Expect the service to be briefly unavailable

No service is perfect. Design your application so that a flag outage does not become your outage. Set defaults in code, use short timeouts so a slow answer never makes a page slow, and let SDKs keep the last known answers. Test the failure on purpose.

Keep flag checks cheap and few

Avoid asking about the same flag many times in a single request. Read it once and reuse the answer. Avoid wrapping tight loops with flag checks. Keep the logic around a flag simple, because complicated branching makes behaviour hard to predict and test.

Analogy

Checking a flag is like glancing at a clock. One glance is quick and cheap. If you phoned the town hall every few seconds to ask the time, you would waste effort and annoy the clerk. Look at the clock once, remember the answer for a moment and carry on.

TechniqueWhat it doesTrade-off
In-memory cachingRemembers answers for a short periodChanges appear after the cache interval
Local evaluation on serversDecides flags inside your own server from downloaded rulesRules refresh periodically, so changes take a moment
Safe defaults in codeProvide an answer when the service cannotDefaults must be chosen and kept up to date
Short timeoutsStop slow answers from slowing your pagesMore reliance on defaults during slow periods
Single wrapper for flag readsCentralises behaviour and makes changes easyA small amount of extra code to maintain
i
Tip

Once a quarter, deliberately block access to Flagsmith in a test environment and watch your product. You will learn more from that ten-minute exercise than from many pages of theory.

18Common Mistakes First-Time Flag Users Make

Almost everyone makes the same handful of mistakes at the start. You can skip them by knowing them in advance.

MISTAKE 01Avoid
What it looks like

The person changes a flag believing they are in development, but the production environment is selected.

Why it hurts

Real customers see an untested change immediately, and nobody knows why.

Better approach

Check the environment name before every change, restrict production access and use change approval where available.

MISTAKE 02Avoid
What it looks like

The application has no default value, so when Flagsmith is unreachable, it errors or shows a broken page.

Why it hurts

A flag service outage becomes a full product outage.

Better approach

Define a safe default for every flag, use short timeouts and test the failure case on purpose.

MISTAKE 03Avoid
What it looks like

Flags are created with names like test1 and no description, and never removed.

Why it hurts

Nobody knows what they do, so nobody dares to delete them, and the code fills with dead branches.

Better approach

Use clear names, write owner and end date in the description and make cleanup part of finishing a feature.

MISTAKE 04Avoid
What it looks like

One flag controls many unrelated things, or flags depend on each other in confusing chains.

Why it hurts

Behaviour becomes impossible to predict, and testing every combination is unrealistic.

Better approach

Keep each flag focused on one decision, and avoid hidden dependencies between flags.

MISTAKE 05Avoid
What it looks like

A server-side key is committed into a public repository, or a secret is placed in a flag value.

Why it hurts

Anyone who finds it can read configuration that was meant to be private.

Better approach

Keep keys in a secrets manager, rotate any that leak and never store secrets in values.

MISTAKE 06Avoid
What it looks like

A flag is archived while an old mobile app version still asks for it.

Why it hurts

Those users suddenly get fallback behaviour that nobody planned for.

Better approach

Remove the code first, wait until old versions have faded away and only then archive the flag.

19A Worked Example: The Welcome Banner

Let us put everything together by following an imaginary team through the creation, testing and release of one small flag.

The team and the idea

A small online bookshop wants to add a welcome banner to its home page, offering free delivery on a first order. The marketing team wants to change the wording and switch the banner off after a campaign. The developers want to release the code early without showing the banner until marketing is ready. A flag is the perfect tool.

Planning

The team decides the question: should this visitor see the welcome banner? They name the flag welcome_banner, write a description with the owner and an expected end date, and agree that the safe default in code is off. They also decide that the message text will be stored as the flag’s value, so marketing can edit it without a release.

Creating and building

In the development environment, a developer creates the feature, leaves it disabled, enters a placeholder message as its value and adds a tag showing it is a release flag. The code is written so that if the flag is on, the banner appears with the stored message, and if it is off or unavailable, nothing changes. They test with the flag off, then on, then off again, and finally with Flagsmith blocked.

Rolling out

sequenceDiagram
    participant D as Developer
    participant M as Marketing
    participant F as Flagsmith
    participant S as Shop Website
    participant V as Visitors
    D->>F: Create welcome_banner, disabled in all environments
    D->>S: Release code with banner path and safe default off
    S-->>V: Site looks exactly as before
    M->>F: Enter final message text as the value in Production
    M->>F: Enable for internal staff segment only
    S-->>V: Staff see the banner, everyone else does not
    M->>F: Raise rollout to 25 percent of visitors
    S-->>V: A quarter of visitors see the banner
    M->>F: Enable for everyone
    S-->>V: All visitors see the banner
    M->>F: Campaign ends, switch the flag off
    S-->>V: Banner disappears with no release
    D->>S: Remove banner code and flag check later
    D->>F: Archive welcome_banner
Figure 5. The welcome banner from creation to cleanup: code ships first, marketing controls timing, developers clean up at the end.

Reading the story

At the top, the developer creates the flag and ships the code with the flag off. Visitors notice nothing, which proves that the release itself was safe. Marketing then enters the final message and enables the banner for the internal staff segment, so colleagues can check it on the real site. After that, marketing raises the rollout to a quarter of visitors, watches the numbers and finally enables it for everyone. When the campaign ends, one click removes the banner from the site without any release. Later, the developer removes the dead code and archives the flag.

Analogy

The welcome banner story is like a shop window display. The shop fitters install the lighting and shelves in advance, and the window stays covered with paper. When the manager is ready, the paper comes down for staff to check, then for passers-by on one side of the street, then for everyone. When the sale ends, the display is removed, and the fittings are taken away.

What went well

Result

Release without risk

The code shipped days before the campaign, with no visible change until the right moment.

Result

Marketing in control

The people who owned the message controlled when and what, without waiting for engineers.

Result

Easy rollback

Switching the banner off took seconds and needed no deployment.

Result

Clean finish

The team removed the code and archived the flag, so nothing stale was left behind.

20Troubleshooting Your First Flag

When your flag does not behave, work through these questions in order. Most problems are simple.

1

Is the right environment selected?

Confirm that the environment where you changed the flag is the same environment your application’s key belongs to.

2

Is the key correct and of the right type?

Check that the application uses the key of the right environment, and a client-side key in browsers and apps.

3

Does the name match exactly?

Compare the name in the dashboard and in the code character by character, including underscores and capitals.

4

Is the flag actually enabled?

Look at the toggle for the environment, and check whether a segment or identity override changes the answer for the user you are testing.

5

Is a cache hiding the change?

Wait for the refresh interval, restart the application in development or refresh the page.

6

Can the application reach Flagsmith?

Check the service address, network rules and any browser or server errors. If it cannot, you are seeing the default value.

Which user are you testing as?

A frequent source of confusion is that the answer depends on who is asking. If you added an identity override or a segment rule, the answer for your test user may differ from the answer for a different user. When results look strange, check which identity the application is sending and what overrides apply to it. The dashboard lets you look at an identity and see exactly what Flagsmith would return for it.

Analogy

Debugging a flag is like working out why a guest was refused entry to a club. You check the date, the door, the list, the guest’s name spelling and whether they were looking at the right sign. It is almost always something simple, not a sinister failure.

i
Tip

Keep a small test page or internal screen that shows the current value of each important flag for the current user. It turns many mysteries into a five-second glance.

21Best Practices Checklist

A compact list of habits that keep flags useful for years instead of turning into clutter.

Best practices

  • Plan the purpose, owner and end date before you create a flag.
  • Use clear, consistent names and write useful descriptions.
  • Start new flags disabled in every environment.
  • Test in development, then staging, then production.
  • Set a safe default in code for every flag.
  • Route all flag reads through one small wrapper.
  • Roll out gradually and watch errors, speed and behaviour.
  • Restrict who can change production, and use approval where available.
  • Check the audit log first when something unexpected happens.
  • Remove flags and old code when a release is finished.

Habits to avoid

  • Changing production without checking the environment.
  • Using vague names and leaving descriptions empty.
  • Letting one flag control many unrelated behaviours.
  • Skipping the failure test with Flagsmith unreachable.
  • Storing secrets in values or committing server keys to code.
  • Leaving finished flags in place for months.
  • Sharing one dashboard login across the team.
  • Archiving a flag while old app versions still ask for it.
  • Making many changes at once and losing track of cause.
  • Ignoring the cost of flags that accumulate.

Measure the health of your flags

A few simple counts reveal whether your flags are healthy. How many flags exist? How many are older than their planned end date? How many have no owner or description? How many have been fully on or fully off for months? Review these numbers each quarter and clean up what no longer earns its place. A tidy collection of flags is a sign of a disciplined team.

Analogy

Flag hygiene is like tidying a kitchen after cooking. A quick wipe and put-away each time keeps the room usable. If you leave every pan and ingredient out for weeks, the next meal becomes a battle, and nobody wants to be the one who starts cleaning.

i
Tip

Schedule a short flag review on the calendar once a month. Fifteen minutes with the list is enough to catch forgotten flags before they become a burden.

22Lessons from the Wider Software World

Feature flags are not a new idea. Many famous companies have used them for years, and their experience offers useful lessons.

Social platforms: ship constantly, reveal gradually

Large social networks such as Facebook have long described releasing new features to small groups of users first, and widening exposure as confidence grows. The lesson: separating deploying code from showing it to users lets teams ship frequently without exposing everyone to every change.

Streaming services: experiments as a habit

Netflix is widely known for running controlled experiments on how its service looks and behaves, showing different groups of members different versions and measuring results. The lesson: flags and variations turn opinions into evidence, but only if you define success before you start.

Code hosting platforms: dark launches

GitHub and similar platforms have described launching new systems quietly behind flags, running them alongside the old ones and comparing results before users ever notice. The lesson: a flag lets you rehearse a change in the real world with almost no risk.

Ride-hailing and delivery apps: kill switches in busy moments

Companies such as Uber depend on switches that can disable non-essential features when demand spikes or a dependency struggles. The lesson: decide in advance which features can be turned off to protect the core experience, and test those switches before you need them.

The cost of forgotten flags

A well-known cautionary tale in the industry involves a trading firm that lost an enormous sum in minutes after old code controlled by a reused flag was accidentally activated during a deployment. The lesson: stale flags and reused names are dangerous. Remove finished flags, never reuse an old name for a new purpose and make deployments consistent across all servers.

Ship the code when it is ready, show it to users when you are ready, and remove the switch when it is done.
i
Good to know

These examples summarise widely discussed industry stories, and details change over time. Treat them as illustrations of good and bad practice, not as exact historical records.

23Where to Go Next

Your first flag is the start of a journey. Here is a sensible path for learning more, one step at a time.

1

Create two or three more simple flags

Repeat the routine until planning, naming, testing and switching feel natural.

2

Practise targeting

Create a segment of internal staff and use it to preview a flag in production safely.

3

Try a percentage rollout

Release a low-risk change to a small share of users and watch the effect.

4

Add remote configuration

Move a setting such as a limit or message out of code and into a value.

5

Connect notifications

Send flag changes to a chat channel or other tools using webhooks or built-in integrations.

6

Decide on hosting and scale

If your needs grow, consider whether to stay on the hosted service or run Flagsmith yourself, and plan for reliability.

Next topic

Segments and targeting

Learn to build reusable groups from traits and apply them across many flags.

Next topic

Webhooks and integrations

Tell chat, caches and archives whenever a flag changes.

Next topic

Local evaluation

Make server-side flag decisions fast and resilient.

Next topic

Hosting choices

Compare the hosted service and self-hosting, including container deployment.

i
Tip

Keep a short notes file as you learn: what worked, what confused you and what you would do differently. Within a month it becomes the best onboarding guide your next teammate could ask for.

24Flags in Different Kinds of Applications

The flag you create in the dashboard is the same everywhere, but the way an application uses it depends on where the application runs.

Websites in the browser

A page running in a visitor’s browser is visible to that visitor. Anyone can open the developer tools and inspect what the page receives. For this reason, browser applications use the client-side key and receive only the flags and values meant for display. Because every page view may need an answer, browser applications benefit from caching and from keeping the number of flag questions small. A common approach is to fetch all the flags once when the page loads and then read them from memory as needed.

Mobile apps

Mobile apps live on people’s phones, and different people run different versions. A flag that works for your newest release must also behave sensibly for a version released six months ago. Mobile apps often have unreliable connections, so they depend even more on cached answers and safe defaults. Many teams store the last known flag values on the device, so that the app can start instantly and update in the background. Because old versions can linger, be careful about removing flags that old versions still ask for.

Server applications

Servers are trusted places that you control, so they can use the server-side key and take advantage of local evaluation. With local evaluation, the server downloads the flag rules and decides answers itself, so most questions never touch the network. A server may serve thousands of users at once, so it must pass the right identity to each question, because different users can receive different answers. Servers should also be prepared for rolling restarts and brief network failures.

Background jobs and scheduled tasks

Flags are not only for user interfaces. A nightly job might use a flag to switch between an old and a new way of processing data. Because jobs run without a person watching, extra care is needed. Log which flag state a job used, so you can explain its results later, and avoid changing a flag in the middle of a long-running job unless the job is designed to handle it.

Analogy

Different applications are like different kinds of shops reading the same price list. A street stall glances at the list once in the morning, a department store has staff checking it constantly, and a mail-order catalogue prints its copy weeks in advance. The list is the same, but how often each shop looks, and how stale its copy may be, differs according to its nature.

Application typeKey typeSpecial care
Website in a browserClient-side keyEverything received is visible to the visitor; keep values non-sensitive
Mobile appClient-side keyOld versions persist; store last known values; plan for poor connections
Server applicationServer-side keyUse local evaluation where possible; pass the right identity for each user
Background jobServer-side keyLog the flag state used; avoid mid-run changes
Command-line or internal toolDepends on trust levelTreat keys as secrets if the tool can be shared
i
Tip

When you plan a flag, ask which kinds of application will read it. A flag that touches a website, a mobile app and a server needs a rollout plan for each, and a cleanup plan that respects the slowest to update.

25Flags and Automated Testing

A flag doubles the number of paths through your code. Good testing habits make sure both paths keep working.

Two paths, two sets of checks

Every flag creates at least two behaviours: the old one and the new one. A change that works only when the flag is on, or only when it is off, is a trap. Your automated tests should confirm that the application behaves correctly with the flag off, which is the existing behaviour that must not break, and with the flag on, which is the new behaviour you are building. As flags multiply, the number of combinations grows, so keep each flag focused and avoid unnecessary connections between flags.

Controlling flags in tests

Tests should not depend on a live flag service or on the current dashboard state. A test that passes today and fails tomorrow because someone changed a flag is worse than useless. Instead, tests should supply the flag state directly, using a simple replacement for the SDK that returns whatever the test needs. This is another reason to route all flag reads through one small wrapper: in tests, you replace that single wrapper, and every flag check behaves as the test requires.

Testing the fallback

Include a test that simulates the flag service being unavailable and confirm that the application uses its safe default. It is a quick test to write and it catches a whole family of production surprises.

Testing in real environments

Beyond automated tests, use your development and staging environments in Flagsmith for end-to-end checks. A test environment with realistic flag settings can reveal problems that isolated tests miss, such as a misspelled name or the wrong key. Some teams keep a dedicated project or environment for automated end-to-end tests, with flags set to known values, so that the tests do not interfere with the work of others.

Analogy

Testing both paths of a flag is like checking both the old bridge and the new bridge before closing the old one. You walk across each, in both directions, in good weather and in bad. Closing the old bridge without checking the new one is how people end up stranded.

Test

Flag off

Confirm that existing behaviour is unchanged. This protects current users while the feature is still hidden.

Test

Flag on

Confirm that the new behaviour works as intended, including its edge cases.

Test

Service unavailable

Confirm that the application uses its safe default and keeps working.

Test

Unexpected value

Confirm that a missing or invalid value cannot break the page or the process.

!
Heads up

Never let automated tests change flags in a shared environment that other people use. Tests that flip real flags can disturb colleagues, confuse monitoring and, in the worst case, reach customers.

26Promoting Changes Across Environments

A flag’s journey from development to production should be deliberate and repeatable. This chapter shows how to keep environments in step.

The usual path

Most teams move a feature through development, staging and production. In development, engineers experiment freely. In staging, the team checks the feature in conditions that resemble production. In production, real users arrive. Each environment has its own state for the flag, so you change them one at a time as confidence grows. The danger is drift: staging and production slowly differ in ways that nobody remembers, and tests in staging stop predicting what will happen in production.

Keeping environments aligned

To limit drift, use the same flag names in every environment, and make a habit of looking at the environments side by side before a release. Flagsmith provides ways to compare environments and, depending on your plan, to copy settings from one environment to another. Where the management interface is available, teams sometimes script the creation of flags and their initial states so that every environment starts consistently.

Order of operations for a release

1

Create the flag first

Create the flag, disabled, so that it exists in every environment before any code asks for it.

2

Deploy the code

Release code that contains both paths and a safe default. Because the flag is off, nothing changes for users.

3

Enable in development and staging

Turn the flag on and run your tests and manual checks.

4

Enable in production gradually

Use individuals, segments and percentages, watching your monitoring at each step.

5

Clean up

Remove the flag and the old path from the code, deploy and archive the flag.

Why the flag must exist before the code

If code is deployed that asks for a flag that does not yet exist, the application receives no answer for it, and your default value takes over. That may be harmless, but it may also hide a mistake, such as a misspelled name. Creating the flag first, then deploying, removes this uncertainty and lets you confirm the connection before any user is involved.

Analogy

Promoting a flag through environments is like rehearsing a play. The cast practises in the rehearsal room, then in a dress rehearsal on the real stage with costumes, and only then performs for the paying audience. Skipping a stage may save an afternoon, but it risks a very public mistake.

i
Tip

Before every production change, open the staging environment next to production and compare the flag’s state and any overrides. A thirty-second comparison catches many surprises.

27Flag Debt and Keeping Things Healthy

Flags are cheap to create and surprisingly costly to forget. This chapter explains flag debt and how to keep it small.

What flag debt is

Technical debt is the accumulated cost of shortcuts in software. Flag debt is the share of that cost caused by flags that have outlived their purpose. Each stale flag leaves behind code branches that nobody needs, tests that check behaviours nobody uses and questions that nobody can answer. A new engineer reading the code must work out which branch is real. A bug fix must be made in both branches. A dashboard full of unknown flags becomes something to fear.

How flag debt grows

Debt grows quietly. A flag is created for a release and the release succeeds. Everyone celebrates, moves on to the next project and forgets the cleanup. The flag stays on for everyone, but the code still contains the old path. Multiply this by dozens of releases and a year, and the code is full of dead branches.

How to keep it small

Habit

Plan the ending

Record the owner and the intended removal date in the description when you create the flag.

Habit

Make cleanup part of done

Include a cleanup task in the original piece of work, so the feature is not finished until the flag is gone.

Habit

Review regularly

Once a month, list flags that have been fully on or fully off for a long time and decide what to do.

Habit

Limit the number in flight

Agree a sensible number of active release flags per team, so growth is noticed before it hurts.

Spotting stale flags

  • The flag has been on for everyone for many weeks with no problems.
  • The flag has been off everywhere for a long time, and the feature seems abandoned.
  • The owner has left the company or changed teams.
  • The description is empty or says nothing useful.
  • Nobody can explain what happens if the flag is switched.
Analogy

Flag debt is like clutter in a garage. Each box seemed sensible when it was put there. A decade later, you cannot park the car, and nobody dares throw anything away in case it is important. A regular tidy, done in small sessions, prevents the great clearout that nobody has time for.

SignWhat it suggestsSuggested action
Fully on for weeks, no incidentsThe release succeededRemove the old code path and the flag
Fully off for monthsThe feature was abandonedRemove the new code or confirm the plan, then clean up
No ownerNobody feels responsibleAssign an owner or retire the flag
Mystery descriptionKnowledge has been lostInvestigate carefully, document, then decide
Many nested flagsLogic is entangledSimplify, merge or remove flags in small steps
!
Heads up

Clean up with care. Before removing a flag that looks stale, check the audit log and search the code in every application and every active version. A flag that looks dead may still guard something that matters.

28How Flagsmith Decides the Answer

When an application asks about a flag for a user, Flagsmith follows a clear order of rules. Knowing the order removes most of the mystery from unexpected results.

The order of precedence

Imagine several rules that could apply to the same user and the same flag. Flagsmith resolves them from the most specific to the most general. First it checks whether an override exists for that exact identity. If one exists, it wins. If not, Flagsmith checks the segments that the user belongs to, and uses a segment override if there is one. When several segments match, a priority order decides which one applies. If no segment override applies, Flagsmith checks whether a percentage rollout or multivariate split gives this user a particular value. Finally, if nothing else applies, the answer is the default state and value set for the environment.

flowchart TD
    A["Application asks about a flag for a user"] --> B{"Identity override exists"}
    B -- Yes --> R1["Return the identity's own state and value"]
    B -- No --> C{"User matches a segment with an override"}
    C -- Yes --> R2["Return the highest priority matching segment's state and value"]
    C -- No --> D{"Percentage or multivariate split applies"}
    D -- Yes --> R3["Return the value assigned to this user's bucket"]
    D -- No --> R4["Return the environment default state and value"]
    R1 --> Z["Answer sent to the application"]
    R2 --> Z
    R3 --> Z
    R4 --> Z
Figure 6. From most specific to most general: identity, then segment, then split, then the environment default.

Reading the decision

The first question is the narrowest: has someone set a special rule for this exact person? If so, nothing else matters. The second question is broader: does the person belong to a group with a special rule? The third question introduces fairness across the population: has this person been placed in a bucket by a percentage or a split? The last box is the fallback: what everybody else gets. Because the most specific rule always wins, you can make a single exception without disturbing anyone else, and you can predict the result of any combination of rules by walking down the chart.

Analogy

The order of rules is like a school canteen. If a pupil has a personal dietary card, the kitchen follows the card. Otherwise, the kitchen follows the rule for the pupil’s year group. Otherwise, it follows whichever tray of the day has been assigned to the pupil’s table. If none of these applies, the pupil gets the standard lunch. The more personal the instruction, the more it counts.

Why this explains most surprises

Surprise

The default is on but my user sees it off

A more specific rule, such as an identity or segment override, may be turning it off for that user.

Surprise

My tester sees it but nobody else does

An identity or segment override is enabling it for the tester while the default remains off, which is exactly the intended preview.

Surprise

Two segments disagree

Segment priority decides which one wins. Check the order and reorder if needed.

Surprise

Different answers on different visits

The application may not be sending a stable identity, so the user is treated as someone new each time.

Stable identities matter

Percentage rollouts and overrides depend on recognising the same user each time. If your application sends a different identifier on every visit, such as a random value generated at each page load, the user may land in different buckets and see the feature appear and disappear. Use a stable identifier, such as an internal user number, and for anonymous visitors consider a stable random identifier stored on the device.

i
Tip

When a result puzzles you, look at the identity in the dashboard and read the answer Flagsmith gives for it. Then walk down the decision chart. The cause is usually found in two or three steps.

29Flags for Product, Marketing and Support Teams

Flags are not only a tool for engineers. When used well, they give many teams a safe way to take part in releases.

Product managers

Product managers decide what to release and to whom. Flags let them request a gradual rollout, observe the effect and decide the next step without waiting for a deployment. They can preview a feature in production using an identity or a segment, show it to stakeholders and prepare a launch for a particular day. The key discipline is to agree with engineering which flags product people may change, and which are reserved for engineers.

Marketing and content teams

When values carry text and settings, marketing teams can adjust banners, labels and promotions without a release. This turns a request that used to take days into one that takes minutes. To keep this safe, limit the editable values to those designed for it, validate them in the application and keep production changes visible to the wider team through notifications.

Support and operations teams

During an incident, support and operations teams often need to switch off a troublesome feature quickly. A kill switch flag, with clear instructions on when and how to use it, puts that power in the right hands. Operations teams can also use flags to protect the system during traffic spikes by disabling expensive, non-essential features temporarily. Practice makes this reliable, so rehearse it before you need it.

Sales and customer success teams

Sometimes a customer needs early access or a special arrangement. An identity or segment override makes this possible without special code. Record who requested it and why in the description or in your ticket system, so that the arrangement can be reviewed and ended properly.

Analogy

Giving different teams the right access to flags is like giving different staff the right keys in a hotel. The cleaner has keys to the rooms, the receptionist to the front desk, the manager to the safe and the engineer to the plant room. Everyone has what they need, nobody has everything, and the key register records who holds what.

TeamTypical use of flagsSuggested guardrail
EngineeringCreate flags, release code safely, run rollouts and clean upFollow naming rules, test every path and remove finished flags
ProductDecide rollout pace and preview featuresAgree which flags they may change, use approval for production
MarketingEdit messages and promotions through valuesLimit to designed values, validate input, notify the team
Support and operationsUse kill switches during incidentsWrite clear instructions and rehearse them
Sales and customer successGrant early access to named customersRecord the reason and review regularly

Communicating about flags

Flags work best when everyone speaks about them in the same way. Use the flag name in tickets, release notes and chat messages, so there is no ambiguity about what changed. Post production changes in a shared channel with the flag name, the environment, who changed it and why. A short, consistent message takes ten seconds and saves many confused conversations.

!
Heads up

Power without visibility invites mistakes. The more people who can change flags, the more important it becomes to use roles, approvals, notifications and the audit log, so that every change is traceable and reversible.

30A One-Page Quick Reference

When you create your next flag, you will not want to reread a whole guide. Keep this page nearby and follow it in order.

Before you click

  • Write the question the flag answers in one sentence with a clear yes or no.
  • Choose a short, descriptive, lowercase name and agree it with your team.
  • Name an owner and a planned removal date, and write both in the description.
  • Decide the safe default behaviour for when Flagsmith cannot be reached.

While creating

  • Check that the environment shown is development, not production.
  • Create the feature disabled, with a clear description and any agreed tags.
  • Add a value only if you truly need remote configuration.
  • Open the other environments and confirm the flag is disabled there too.

While building and testing

  • Route every flag read through your wrapper and define the default in code.
  • Test with the flag off, on, off again and with Flagsmith unreachable.
  • Repeat the routine in staging before touching production.

While releasing

  • Deploy the code with the flag still off and confirm nothing changed for users.
  • Enable for individuals or a segment first, then a small percentage, then everyone.
  • Tell the team about each production change and watch errors, speed and behaviour.
  • Know exactly how to turn the flag off and who will do it.

After the release

  • Leave the flag on for a safe period and watch for problems.
  • Remove the flag check and the old code path, and deploy.
  • Confirm no running version still asks for the flag, then archive it.
Analogy

This page is the pilot’s pocket checklist. An experienced pilot knows every step by heart, yet still reads the list before each flight, because the one forgotten step is the one that causes the trouble. A short list used every time beats a perfect memory used most times.

StageMain questionProof you are ready to move on
PlanDo we know the purpose, owner and end date?They are written in the description
CreateIs the flag disabled everywhere?You checked every environment
BuildDoes the code have both paths and a default?A test passes with Flagsmith blocked
TestDoes off, on and off again work?You watched each state in development and staging
ReleaseDid deploying change nothing for users?Monitoring is calm with the flag off
RolloutIs each step safe before the next?Errors, speed and behaviour look normal
CleanupIs the old path gone and nothing asking?The flag is archived with no complaints
i
Tip

Print this page or pin it in your team chat. A checklist that is easy to find gets used. A checklist hidden in a long document gets forgotten.

31Glossary of Terms

Every important word used in this guide, in plain language, for quick lookup.

TermPlain meaning
Feature flagA named switch outside the code that turns a feature on or off without a release.
Remote configurationStoring values such as text or numbers outside the code so they can be changed live.
FeatureFlagsmith’s name for a flag or configuration value, defined once per project.
OrganisationThe top-level container for your company, people and billing.
ProjectA container for one product or application, holding its features and environments.
EnvironmentA separate copy of the world, such as development, staging or production, with its own states and keys.
Environment keyA code that tells an SDK which environment’s flags to read.
Client-side keyA key meant for browsers and mobile apps that can only read flags.
Server-side keyA secret key for trusted servers that unlocks extra abilities such as local evaluation.
SDKA ready-made code library that lets an application talk to Flagsmith.
Default valueThe answer your code uses when it cannot obtain one from Flagsmith.
IdentityOne specific user known to Flagsmith, identified by an ID from your application.
TraitA small fact about an identity, such as plan or country, used for targeting.
SegmentA saved group of users defined by rules on their traits.
OverrideA setting that gives a flag a different state or value for a segment or identity.
Percentage rolloutEnabling a feature for a chosen share of users, stable for each user.
Multivariate featureA feature with several possible values, each given to a share of users.
Kill switchA flag used to turn off a risky or costly feature quickly.
Release flagA short-lived flag used to roll out a feature safely.
CacheA short-term memory of recent answers that avoids repeated questions.
Local evaluationLetting a server SDK hold the rules and decide flags without a network call.
Audit logA diary of who changed what and when in Flagsmith.
WebhookAn automatic message Flagsmith sends to another system when something changes.
ArchiveRemoving a finished feature from the active list while keeping its history.
TagA label attached to a feature to help group and search.

32Frequently Asked Questions

Short answers to the questions beginners ask most often.

Q1What is the difference between a feature flag and remote configuration?
A flag is an on or off decision. Remote configuration is a value, such as text or a number, that your application reads. In Flagsmith a single feature can have both an enabled state and a value.
Q2Do I need to release new code every time I change a flag?
No. You release the code once, with both paths and a safe default. After that, changing the flag in the dashboard changes behaviour without a new release.
Q3Why did I create a flag in one environment but see it in all?
Features are defined once for the project, and each environment keeps its own state for them. The flag exists everywhere, but it can be on in one environment and off in another.
Q4Should a new flag start on or off?
Almost always off. Release the code with the flag off, test, and then turn it on deliberately, ideally for a small group first.
Q5How quickly does a change reach my application?
The dashboard saves it at once. The application sees it the next time its SDK asks, or when its cached answer expires, which depends on your SDK settings.
Q6What happens if Flagsmith is unreachable?
Your application should fall back to the default value defined in code, and may use recently cached answers. Test this on purpose so you know how your product behaves.
Q7Is it safe to put the environment key in a web page?
A client-side key is designed to be visible, because it can only read flags. Server-side keys must be kept secret. Never place secrets in flag values that browsers can read.
Q8What is a segment and when should I use one?
A segment is a reusable group of users defined by rules on their traits, such as plan or country. Use one when you want a flag to behave differently for a whole group without listing individuals.
Q9How do I roll out to only some users?
Use identity overrides for named people, segment overrides for groups and, where your plan supports it, percentage rollouts for a growing share of users.
Q10When should I delete a flag?
After a release is fully on and stable, remove the code that asks for the flag, deploy, confirm nothing still asks for it and then archive it. Never remove a flag that a running version of your application still uses.
Q11Can I see who changed a flag?
Yes. The audit log records who changed what and when. Check it first when something unexpected happens.
Q12Should I use the hosted service or run Flagsmith myself?
For a first flag, the hosted service is the quickest. Self-hosting suits teams with strict data rules or a strong operations capability. The flag concepts are identical in both.
Q13How many flags is too many?
There is no fixed number. The warning sign is flags without owners, descriptions or end dates, and flags that have been fully on or off for months. Review and clean up regularly.
Q14Where can I confirm exact button names and current limits?
In the current Flagsmith documentation and in the dashboard itself. Screens, labels, editions and plan limits change over time, so verify details before relying on them.

33Summary and Key Takeaways

Everything in this guide comes down to a handful of ideas you can carry into your first flag and every flag after it.

A feature flag is a switch outside your code, and Flagsmith is the control desk where you manage it. Creating your first flag is simple: plan its purpose, name it clearly, create it disabled, test it in development, connect an application with a safe default and switch it on carefully. The habits around the flag matter more than the clicks. Plan the owner and the end date, test in every environment, release gradually, watch the results and clean up when you are done.

Key Takeaways

  • A flag separates deploying from releasing. Ship the code switched off, then decide when and to whom the feature appears, and switch it off in seconds if needed.
  • Understand the layers. Organisations contain projects, projects contain environments and features, and each environment keeps its own state for each feature.
  • Plan before you click. Write the question the flag answers, a clear name, an owner, an end date and a safe default.
  • Start disabled and test the climb. Prove off, prove on, prove off again, prove the fallback, then move from development to staging to production.
  • Always set a default in code. Your product must keep working when the flag service cannot answer, so choose the safe behaviour in advance.
  • Target and roll out gradually. Use identities, segments and percentages to expose a feature to a few people first, and watch errors, speed and behaviour at each step.
  • Keep flags tidy. Use clear names, useful descriptions and tags, restrict production changes, check the audit log and remove finished flags and their old code.