LaunchDarkly Feature Flags

Sync LaunchDarkly feature flags to your Convex backend, enabling server-side flag evaluation directly in Convex functions.

Installation

npm install @convex-dev/launchdarkly

About LaunchDarkly Feature Flags

This is a Convex component for feature flagging and experimentation using [LaunchDarkly](https://launchdarkly.com/).

It syncs your LaunchDarkly environment to your Convex deployment, allowing you to use your feature flags in Convex.

Why use LaunchDarkly with Convex?
Feature flags in your backend: Use feature flags in your Convex functions to dynamically control the behavior of your app.
Experimentation: Run A/B tests and feature experiments in Convex using LaunchDarkly.
Real-time updates: Your LaunchDarkly flags and segments are synced to Convex in real-time, so you can use them in your app without needing to make additional API requests

Benefits

Use cases

how to use feature flags in Convex functions

The @convex-dev/launchdarkly component syncs your LaunchDarkly flags to Convex, letting you evaluate flags directly in queries and mutations. You can access flag values using the provided hooks without making external API calls from your functions.

server-side feature flag evaluation with LaunchDarkly

This component enables server-side feature flag evaluation by syncing LaunchDarkly flags to your Convex database. Your backend functions can check flag states locally instead of making HTTP requests to LaunchDarkly's API during function execution.

sync LaunchDarkly flags with Convex backend

The component automatically syncs flag configurations and values from LaunchDarkly to your Convex database. This ensures your Convex functions always have access to the latest flag states for server-side decision making.

Frequently asked questions

How does the LaunchDarkly Feature Flags component handle flag updates?

The @convex-dev/launchdarkly component automatically syncs flag changes from LaunchDarkly to your Convex database. When flags are updated in LaunchDarkly, the component receives these changes and updates the corresponding records in Convex, ensuring your functions always use current flag values.

Can I evaluate feature flags for specific users in Convex functions?

Yes, the LaunchDarkly Feature Flags component supports user-targeted flag evaluation within Convex functions. You can pass user context to the flag evaluation functions, enabling personalized feature experiences based on user attributes or segments defined in LaunchDarkly.

Does this component require LaunchDarkly API calls during function execution?

No, the @convex-dev/launchdarkly component eliminates the need for LaunchDarkly API calls during function execution. Flag values are synced to your Convex database beforehand, so your functions can evaluate flags locally without external HTTP requests, improving performance and reliability.

What happens if LaunchDarkly is unavailable when my Convex functions run?

Since the LaunchDarkly Feature Flags component stores flag values in your Convex database, your functions continue working even if LaunchDarkly is unavailable. The component uses the last synced flag values, ensuring your application remains functional during LaunchDarkly outages.

Links