Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Prerequisite flags

Coordinate releases for tightly coupled applications using prerequisite flags. Prerequisites enable teams to maintain autonomy over their releases while managing technical and business dependencies.

Overview

Prerequisite flags create dependencies between feature flags within a single project. When a flag has a prerequisite, the prerequisite must evaluate to a specific variation before the dependent flag can be enabled.

When to use prerequisite flags

Use prerequisite flags when:

  • Applications execute in the same project
  • Teams need to coordinate releases with minimal overhead
  • Dependencies exist between frontend and backend components
  • Multiple teams contribute to a single product release

How prerequisite flags work

Each coordination strategy has two parts:

Platform

What teams do in LaunchDarkly: Create prerequisites and allow teams to request, review, and apply targeting changes through approval workflows.

Application

What developers implement: Evaluate flags in the application. LaunchDarkly handles the prerequisite logic automatically. No additional code is required.

Prerequisites scope

Prerequisite flags work within specific boundaries:

ArchitectureSupported
Within a single projectYes
Across multiple projectsNo
Outside of projectsNo

Use cases

Technical dependencies

Coordinate releases when backend changes must be deployed before frontend changes.

Example scenario:

Release a new widget that requires both API and frontend changes.

Setup:

  1. Create flag: Release: Widget API
  2. Create flag: Release: Widget Mobile
  3. Add prerequisite to Release: Widget Mobile: requires Release: Widget API to be On

Result:

Teams maintain autonomy over their own domains without coordination overhead. The mobile team can enable their flag when ready, knowing the prerequisite ensures the API is available.

Business dependencies

Group multiple releases under a keystone flag to coordinate a product launch.

Example scenario:

Spring product launch requires new reporting features and AI assistant functionality.

Setup:

  1. Create keystone flag: Release: Spring Launch Event
  2. Create flag: Release: Advanced Reporting
  3. Create flag: Release: AI Assistant
  4. Add prerequisite to both feature flags: requires Release: Spring Launch Event to be On
  5. Delegate authority to product and marketing teams to control the keystone flag

Result:

Engineering teams can develop and test features independently. Product and marketing teams control the coordinated launch by managing only the keystone flag.

Implementation steps

Step 1: Create feature flags

Create flags for each component or feature that needs coordination:

  1. Navigate to the project in LaunchDarkly
  2. Click Create flag
  3. Provide a descriptive name and key
  4. Select the appropriate flag type
  5. Click Save flag

Step 2: Configure prerequisites

Add prerequisites to flags that depend on other flags:

  1. Navigate to the dependent flag’s settings
  2. Locate the Prerequisites section
  3. Click Add prerequisite
  4. Select the prerequisite flag
  5. Choose the required variation
  6. Click Save

Step 3: Test coordination

Verify that prerequisites work correctly:

  1. Ensure the prerequisite flag is Off
  2. Attempt to enable the dependent flag
  3. Verify that the dependent flag remains Off or serves the fallback variation
  4. Enable the prerequisite flag
  5. Verify that the dependent flag now evaluates correctly

Step 4: Document dependencies

Create documentation for your team:

  • List all prerequisite relationships
  • Document the intended release order
  • Identify the owners of each flag
  • Specify the communication plan for coordinated releases

Example configuration

Scenario: E-commerce checkout redesign

Flags:

FlagDescriptionPrerequisites
Release: CheckoutKeystone flag for the overall releaseNone
Release: Checkout APIBackend API changesRelease: Checkout must be On
Release: Checkout WebWeb frontend changesRelease: Checkout and Release: Checkout API must be On
Release: Checkout MobileMobile app changesRelease: Checkout and Release: Checkout API must be On

Configuration in LaunchDarkly:

Release: Checkout (Keystone)
├── Release: Checkout API
│   └── Release: Checkout Web
│   └── Release: Checkout Mobile

Release process:

  1. Backend team enables Release: Checkout API when ready
  2. Web team enables Release: Checkout Web when ready
  3. Mobile team enables Release: Checkout Mobile when ready
  4. Product team controls the overall release through Release: Checkout

Best practices

Use clear naming conventions

Name flags to indicate their role in the dependency chain:

  • Keystone flags: Release: [Feature Name]
  • Component flags: Release: [Feature Name] [Component]

Avoid deep chains

Limit prerequisite chains to 2-3 levels deep. Deeper chains increase complexity and make troubleshooting difficult.

Document ownership

Clearly document who owns each flag in the prerequisite chain. Teams should know who to contact when coordinating releases.

Test in lower environments first

Verify prerequisite relationships in development and staging environments before configuring them in production.

Use flag statuses

Track prerequisite flags with flag statuses to monitor when they are safe to remove.

To learn more, read Flag statuses.

Troubleshooting

Dependent flag not evaluating correctly

Symptom: A flag with a prerequisite does not evaluate as expected even though the prerequisite appears to be enabled.

Possible causes:

  1. Prerequisite is enabled in a different environment
  2. Prerequisite requires a specific variation that is not being served
  3. Targeting rules conflict with the prerequisite

Solution:

  1. Verify the prerequisite flag is On in the same environment
  2. Check that the prerequisite serves the required variation
  3. Review targeting rules for conflicts

Unable to create prerequisite

Symptom: LaunchDarkly prevents creating a prerequisite relationship.

Possible causes:

  1. Creating a circular dependency
  2. Flags are in different projects
  3. Insufficient permissions

Solution:

  1. Review the dependency chain for circular references
  2. Ensure both flags are in the same project
  3. Verify you have permission to modify both flags

Combine prerequisite flags with other coordination strategies:

  • Delegated authority: Grant product teams permission to control keystone flags
  • Request metadata: Use request metadata to coordinate with external services while using prerequisites internally

To learn more about project architecture, read Projects.