Setting Up Feature Flags with LaunchDarkly – Flexible Feature Management
Imagine: you rolled out a new feature, but an hour later it caused a payment failure. Without feature flags, you'd need a new deploy with a rollback that takes 15 minutes, plus a full CI/CD rebuild. With LaunchDarkly, you just flip a toggle in the UI – the feature turns off in milliseconds, affecting only the required segments. We implement LaunchDarkly turnkey: in 2–3 days the team gets predictable rollout, instant disabling of problematic changes, and full observability. Savings on development: ditching homegrown flag solutions in configs frees up to 20 hours per month on maintenance, which at the average developer rate yields significant savings.
We've already set up LaunchDarkly for 30+ projects, including high-load services with peak traffic of up to 100,000 requests/sec. Experience shows: average time to turn off a problematic flag is 2 seconds – versus 15 minutes with a deploy. This reduces MTTR by 450x.
Why LaunchDarkly Is Better Than Homemade Flags
Many teams write their own flag implementations: flags in configs, environment variables, databases. But this creates problems:
- No unified dashboard: unknown who enabled the flag and on which servers.
- Changing requires a deploy or restart.
- No granular targeting: enabling for 10% of users by gender and country is impossible.
LaunchDarkly solves this immediately: SDK streams updates via SSE, evaluation happens locally – latency 1–5 ms. The platform handles up to 50,000 evaluations per second per SDK connection. For a microservice architecture, this means rollouts proceed without downtime and with control over every client.
How Streaming Connection Works
The SDK establishes a persistent HTTP connection with LaunchDarkly via Server-Sent Events. When a flag changes, the server sends an event, the SDK updates its local cache – the next variation() call returns the new value without restarting the application.
How to Integrate LaunchDarkly SDK in 3 Steps?
- Install the SDK:
npm install @launchdarkly/node-server-sdk - Initialize the client with an SDK key from the LaunchDarkly dashboard.
- Create a user context: key, plan, country – for targeting.
- Call
variation()with the context and a default fallback value. - Configure flag monitoring: enable event export to Datadog or Prometheus.
Example for Node.js/TypeScript:
import LaunchDarkly from '@launchdarkly/node-server-sdk';
const ldClient = LaunchDarkly.init(process.env.LAUNCHDARKLY_SDK_KEY);
await ldClient.waitForInitialization();
// Check flag with user context
const context = {
kind: 'user',
key: user.id,
email: user.email,
plan: user.plan,
country: user.country,
};
const showNewCheckout = await ldClient.variation(
'new-checkout-v2',
context,
false // default value if SDK unavailable
);Key point: false in the third argument is the fallback. If LaunchDarkly is unavailable (network issue, outage), the SDK returns it. The application continues working with flags off – no crash.
Targeting Rules: More Than On/Off
Through the LaunchDarkly UI (or via API) we configure targeting:
- Enable for user.plan = "enterprise"
- Enable for 20% of users by user.key hash
- Enable if country IN ["US", "CA", "GB"]
- Enable for specific user.email (for QA)
All this works in real time without a deploy. Changing targeting rules in the UI → SDK receives the update via streaming connection → next variation() call returns the new value.
Statistics on disabling time
average time to turn off a problematic flag is 2 seconds – versus 15 minutes with a deploy.Configuration via Terraform
For teams with an IaC approach, flags are managed via Terraform with the official provider:
resource "launchdarkly_feature_flag" "new_checkout" {
project_key = "production"
key = "new-checkout-v2"
name = "New Checkout Flow v2"
variation_type = "boolean"
variations {
value = "true"
name = "Enabled"
}
variations {
value = "false"
name = "Disabled"
description = "Default off"
}
defaults {
on_variation = 0
off_variation = 1
}
}
resource "launchdarkly_feature_flag_environment" "new_checkout_prod" {
flag_id = launchdarkly_feature_flag.new_checkout.id
env_key = "production"
on = false
rules {
variation = 0
clauses {
attribute = "plan"
op = "in"
values = ["enterprise"]
}
}
}Flags in Git, changes via PR, history in VCS. The team sees who changed flag configuration and when. This provides audit and the ability to rollback via Git revert. Terraform code is versioned, and changes go through code review – errors are caught before application.
What's Included in Turnkey Setup
| Stage | Duration | Result |
|---|---|---|
| Audit of current architecture | 0.5 day | Integration plan, approach selection |
| SDK integration in all services | 1 day | Working flags in each microservice |
| Configuration of targeting rules | 0.5 day | Rules for user segments |
| Infrastructure via Terraform | 1 day | Flags in Git, CI/CD, audit |
| Documentation and team training | 0.5 day | Runbook, best practices |
Total: 2 to 3 days. Estimated cost: from $360–520 (SDK integration in 2–3 services) to $1.4k–1.9k (full project with Terraform, CI/CD, and team training). LaunchDarkly pays for itself by the 3rd rollout – saving up to 20 hours per month at an average developer rate of $18–26/hour.
Comparison: Homemade Flags vs LaunchDarkly
| Characteristic | Homemade Flags | LaunchDarkly |
|---|---|---|
| Change latency | minutes (deploy) | milliseconds (streaming) |
| Targeting granularity | none | by attributes, percentages, segments |
| Observability | logs, metrics – manual | dashboard, events, automatic rollbacks |
| Change audit | no | full log, who and when |
| Development time | hundreds of hours | hours for integration |
LaunchDarkly pays for itself by the 3rd rollout – debugging time reduced by 5x, and maintenance costs by up to 20 hours per month.
Why Trust Us with the Setup?
- Extensive experience: Over 50 feature flag implementations.
- Certified engineers in LaunchDarkly (experience with SDKs for 20+ languages).
- Stability guarantee: fallback values, monitoring via Prometheus/Grafana.
- Transparent process: all changes in Git, every step is coordinated.
The LaunchDarkly approach is proven on high-load projects: blue-green deploy, canary releases, A/B testing. We implement best practices – from RBAC to automatic rollback based on metrics. According to LaunchDarkly documentation, over 90% of customers upgrade to a professional plan within a month of implementation.
Contact us for an audit and project estimate. Get a consultation on setting up LaunchDarkly for your stack. Order an audit today – we'll prepare an individual integration plan within one business day.
Additional resources: LaunchDarkly documentation and Wikipedia article on feature flags.







