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:
| Architecture | Supported |
|---|---|
| Within a single project | Yes |
| Across multiple projects | No |
| Outside of projects | No |
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:
- Create flag: Release: Widget API
- Create flag: Release: Widget Mobile
- 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:
- Create keystone flag: Release: Spring Launch Event
- Create flag: Release: Advanced Reporting
- Create flag: Release: AI Assistant
- Add prerequisite to both feature flags: requires Release: Spring Launch Event to be On
- 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:
- Navigate to the project in LaunchDarkly
- Click Create flag
- Provide a descriptive name and key
- Select the appropriate flag type
- Click Save flag
Step 2: Configure prerequisites
Add prerequisites to flags that depend on other flags:
- Navigate to the dependent flag’s settings
- Locate the Prerequisites section
- Click Add prerequisite
- Select the prerequisite flag
- Choose the required variation
- Click Save
Step 3: Test coordination
Verify that prerequisites work correctly:
- Ensure the prerequisite flag is Off
- Attempt to enable the dependent flag
- Verify that the dependent flag remains Off or serves the fallback variation
- Enable the prerequisite flag
- 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:
| Flag | Description | Prerequisites |
|---|---|---|
| Release: Checkout | Keystone flag for the overall release | None |
| Release: Checkout API | Backend API changes | Release: Checkout must be On |
| Release: Checkout Web | Web frontend changes | Release: Checkout and Release: Checkout API must be On |
| Release: Checkout Mobile | Mobile app changes | Release: 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:
- Backend team enables Release: Checkout API when ready
- Web team enables Release: Checkout Web when ready
- Mobile team enables Release: Checkout Mobile when ready
- 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:
- Prerequisite is enabled in a different environment
- Prerequisite requires a specific variation that is not being served
- Targeting rules conflict with the prerequisite
Solution:
- Verify the prerequisite flag is On in the same environment
- Check that the prerequisite serves the required variation
- Review targeting rules for conflicts
Unable to create prerequisite
Symptom: LaunchDarkly prevents creating a prerequisite relationship.
Possible causes:
- Creating a circular dependency
- Flags are in different projects
- Insufficient permissions
Solution:
- Review the dependency chain for circular references
- Ensure both flags are in the same project
- Verify you have permission to modify both flags
Related strategies
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.