Skip to content

Migrate from LaunchDarkly

featureflip import launchdarkly reads a LaunchDarkly project and writes it into a Featureflip project. For each flag it brings across the individual targets, rules, default rule, prerequisites and percentage rollouts in every environment, and it brings the segments too. Before it writes anything, it prints a report of what translates differently and what can’t translate at all.

The command is part of the featureflip CLI, version 0.3.0 or later. This guide walks through a migration from the token to the cutover, and spends most of its time on the places where LaunchDarkly and Featureflip disagree, since those decide whether anyone notices the switch.

The importer reads through LaunchDarkly’s REST API with an access token, and a token with the Reader role is enough, since nothing is ever written back to LaunchDarkly. Create one in LaunchDarkly under Organization settings, then Authorization.

Terminal window
export LAUNCHDARKLY_ACCESS_TOKEN=api-...

The importer talks to app.launchdarkly.com by default. On another LaunchDarkly instance, point it there:

InstanceLAUNCHDARKLY_API_URL
EUhttps://app.eu.launchdarkly.com
Federalhttps://app.launchdarkly.us

Name the LaunchDarkly project by its key (Account settings, then Projects):

Terminal window
featureflip import launchdarkly --ld-project default

A dry run writes nothing anywhere and needs no Featureflip account, so you can run it as often as you like while you tidy things up in LaunchDarkly. Add --json to get the same report as one JSON document, with the full translated project inside.

LaunchDarkly environment keys become Featureflip environment keys. When yours differ (LaunchDarkly’s test against a Featureflip development, say), map them:

Terminal window
featureflip import launchdarkly --ld-project default --env-map test=development

The report opens with the mapping and the counts, then groups every problem:

LaunchDarkly import: dry run, nothing was written.
Environments
test -> development
production -> production
Flags 38 read: 35 ready (6 with warnings), 3 blocked
Segments 3 read: 2 ready, 1 blocked
Blocked: these are not imported
segment big: it is a big segment, and LaunchDarkly's API doesn't list its members
flag kind-clause: rule 1: it checks the context kind, and Featureflip contexts have no kinds
flag uses-big: rule 1: it uses the segment "big", which can't be translated (it is a big segment, and LaunchDarkly's API doesn't list its members)
Warnings: imported, but check these
flag My.Flag: imported with the key "my-flag", so the code that reads "My.Flag" must use the new key
flag soft-kill: its off variation in LaunchDarkly is true, and Featureflip serves false while a boolean flag is off, so turning the flag off in Featureflip changes what it serves
flag targeted: it reads organization contexts. Featureflip contexts are flat, so it reads their key as "organization.key" and their other attributes as "organization.<attribute>", which your app must send
Notes
flag uses-vip: rule 1: its segments are inlined as 2 Featureflip rules
Skipped the archived flag "gone".
Rollouts keep their percentages but not their membership: Featureflip buckets contexts with its own hash, so a 30% rollout reaches a different 30%.
Context attributes the imported rules read (your evaluation context must carry them):
user_id, country, email, organization.key, organization.plan, plan

Each blocked line says why that item would behave differently in Featureflip and stays out. Warnings import but ask something of you, and notes are for the record. The attribute list at the end names every attribute your evaluation context has to carry.

When the dry run looks right, add --apply and say which Featureflip project to write to. This needs a Featureflip token with the Member role or higher (see Sign in):

Terminal window
featureflip import launchdarkly --ld-project default --env-map test=development --project web --apply

Every environment you import must already exist in the Featureflip project, and if one is missing, the importer stops before writing and lists the environments the project does have.

By default:

  • Flags arrive off in every environment. --carry-state turns each one on wherever it is on in LaunchDarkly.
  • Anything that already exists and differs is left alone. --overwrite replaces its targeting. Variations are never changed. A flag whose variations conflict is reported, and you rename or delete it in Featureflip first.
  • A re-run is a no-op. Items that already match read as unchanged.
  • Prerequisites are written first. Each flag is created after the flags it depends on.

Client-side availability carries over. A flag LaunchDarkly offers to client-side or mobile SDKs is created client-side in Featureflip, and --client-side marks every created flag. The importer checks the plan’s flag cap first. It asks you to type the environment key wherever it would change live flags in an environment that requires confirmation. On a large project it waits out the API rate limit and prints each wait.

LaunchDarkly gives each flag environment an off variation, served while the flag is off, plus a default rule (the fallthrough) for contexts that match nothing. Featureflip has one default variation, which a flag serves both when it is off and when no rule matches.

For a boolean flag, Featureflip serves false while it is off, and the LaunchDarkly default rule becomes the Featureflip default, so a flag that is on and matches nothing behaves as it did. When a boolean flag’s LaunchDarkly off variation is true, the report says so:

  • If the flag is on in that environment, it imports with a warning. Turning it off in Featureflip will serve false, not true.
  • If the flag is off there, it is blocked, because importing it would change what users get today. Change the off variation in LaunchDarkly, or turn the flag on there, and re-run.

For string, number and JSON flags, the off variation becomes the Featureflip default variation. When the LaunchDarkly default rule serves something else, the importer adds a final rule named “Default rule” with no conditions that serves it. A flag with no off variation set is reported the same way as a boolean one (a warning where it is on, blocked where it is off), because LaunchDarkly then serves your code’s fallback value while the flag is off.

Featureflip contexts are flat. They have no kinds, so the importer keeps the names of user attributes (except key, which becomes user_id) and prefixes every other kind’s attributes with the kind’s name. An organization context’s key becomes organization.key and its plan becomes organization.plan. A rule that checks the context kind itself is blocked, and so is one that reads a nested attribute such as /address/city.

So the SDK change looks like this:

// LaunchDarkly
const ldContext = {
kind: 'multi',
user: { key: 'u-123', email: 'ana@example.com' },
organization: { key: 'org-9', plan: 'enterprise' },
};
// Featureflip
const context = {
user_id: 'u-123',
email: 'ana@example.com',
'organization.key': 'org-9',
'organization.plan': 'enterprise',
};

Calls change from variation(key, context, fallback) to the typed accessor for the flag’s type: boolVariation, stringVariation, numberVariation or jsonVariation in Node.js. Each language’s names are on its SDK reference page.

A Featureflip segment is one set of ANDed conditions, and it is the same in every environment. LaunchDarkly segments are per environment and can match in several ways: an included list, several rules, excluded contexts. When a segment fits the Featureflip shape, it becomes a segment. When it doesn’t, the importer doesn’t create it. Its conditions get copied into each flag rule that uses it, which can turn one LaunchDarkly rule into several Featureflip rules. The report notes each one.

Three kinds of segment can’t come across, and neither can the flags that use them. Big segments are out, since LaunchDarkly’s API doesn’t list their members. So are segments with a weighted rule (a Featureflip segment includes everyone it matches) and segments that refer to other segments.

A Featureflip rollout serves one variation to a percentage and splits everyone else evenly across the other variations. A two-variation split such as 30/70 translates exactly. A three-way split translates only when the remainder is even. A 33.333/33.333/33.334 split rounds to whole percentages with a warning, while 50/50/0 is blocked. An experiment rule keeps its split, but the experiment and its results stay behind.

A context without the attribute a rollout buckets by skips the rollout in Featureflip and moves on to the next rule. LaunchDarkly would have put it in a bucket. The report warns about each rollout this affects.

LaunchDarkly compares strings exactly and never treats "1" as the number 1, while Featureflip ignores case in In, StartsWith, EndsWith and Contains and compares numbers by value. A rule or individual target can therefore match contexts in Featureflip that it didn’t match in LaunchDarkly. For most projects that changes nothing. Check any rule that relies on two values differing only by case.

Two value formats also need care. Featureflip reads dates as ISO 8601 or Unix seconds, where LaunchDarkly also takes milliseconds. Version comparisons need full semantic versions (2.0.0, not 2.0).

Prerequisites come across one to one, and the importer orders writes so each prerequisite exists before the flag that needs it. A flag whose prerequisite is blocked or archived is blocked too. LaunchDarkly also fails any prerequisite that is off. Featureflip passes an off prerequisite when its off value is the variation required. The report warns about each flag where that matters.

Featureflip hashes contexts with its own algorithm, so a flag at 30% reaches 30% of users, though a different 30%. Cut over at 0% or 100% and nobody notices. For a partial rollout that users would notice, either finish it in LaunchDarkly first or import it at 0% and ramp it again with a rollout ramp.

Individual targets aren’t affected. They become rules at the top of each flag, in the order LaunchDarkly checks them.

Run both systems for a release before Featureflip serves anything that matters:

  1. Apply the import. Flags arrive off.
  2. Ship code that evaluates both SDKs, returns LaunchDarkly’s value and logs every mismatch.
  3. Re-run with --carry-state --overwrite to turn flags on where they are on in LaunchDarkly. Where only on/off differs, that’s all it changes.
  4. Read the mismatch log. Partial rollouts will differ by design. Any other mismatch is usually a context attribute your app isn’t sending yet.
  5. Serve Featureflip’s value, then remove the LaunchDarkly SDK.

The import is a one-time copy. If someone edits targeting in LaunchDarkly during the comparison, run the import again with --overwrite, or ask the team to hold off on LaunchDarkly edits until the switch is done.

The importer brings flags, their targeting and segments. It doesn’t read experiment results, metrics, scheduled changes, approvals, flag triggers, workflows, release pipelines, holdouts, code references, teams or custom roles. Archived flags are skipped, and deprecated flags import as ordinary flags.

Most of those have a Featureflip counterpart you set up by hand. Scheduled changes, flag triggers and team roles each have their own guide. For code references, the flag cleanup Action finds where a finished flag is read and opens a pull request that removes it. Experiment analysis goes to the analytics tool you choose, through an evaluation inspector.