Getting Your Team Started with Feature Management
We understand the challenges of managing feature flags at scale, so we've built a platform that will help you get there. LaunchDarkly is developer-friendly and easy to integrate. Use our quick start guide to create a simple app in the language of your choice, and easily create and test a flag in your local dev environment.
Quick Setup Time
In just minutes you can set up and start to manage your first feature flag. Teams at organizations like GoPro and Atlassian have used LaunchDarkly to deliver code weeks faster and safely test in production.
Partial Implementation
Outcome driven development with feature flags is not all or nothing. Many of our customers start by using our feature management platform within in a single team before expanding to other teams/apps across their organizations.
LaunchDarkly has been easy to on-board and integrate into our existing development cycle, which has helped us move faster with less risk.
Lawrence Yuan, VP Engineering, Ten-X
Implement LaunchDarkly in Minutes
See what a feature flag looks like in your stack.
Android
Apex
C
Electron
Erlang
Flutter
Gatsby
Go
Haskell
iOS
Java
JavaScript
Lua
.NET
Node
PHP
Python
React
Roku
Ruby
Xamarin
Add the LaunchDarkly SDK to your project.
implementation 'com.launchdarkly:launchdarkly-android-client:3.0.0'
Import the LaunchDarkly client in your application code.
import com.launchdarkly.sdk.*;
import com.launchdarkly.sdk.android.*;
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
LDConfig ldConfig = new LDConfig.Builder().mobileKey("YOUR_MOBILE_KEY").build();
Create a feature flag on your dashboard, then use your unique feature key in your application code.
LDConfig ldConfig = new LDConfig.Builder()
.mobileKey("MOBILE_KEY")
.build();
LDUser user = new LDUser.Builder("user key")
.email("fake@example.com")
.build();
LDClient client = LDClient.init(getApplication(), ldConfig, user, 5);
if (client.boolVariation(FLAG_KEY, false)) {
Log.i(TAG, "Showing feature");
} else {
Log.i(TAG, "Not Showing feature");
}
Create the client with a default configuration.
LDClient client = new LDClient();
Create a user context that will be used for evaluation.
LDUser user = new LDUser.Builder('YOUR_USER_KEY').build();
Create a feature flag on your dashboard, then use your unique feature key in your application code.
if (client.boolVariation(user, 'YOUR_FEATURE_KEY', false)) {
System.debug('feature is on');
} else {
System.debug('feature is off');
}
Include the LaunchDarkly SDK headers.
include "ldapi.h"
Create a new LDClient instance and user with your SDK key.
LDConfig *config = LDConfigNew("YOUR_CLIENT_SIDE_KEY");
LDUser *user = LDUserNew("YOUR_USER_KEY");
LDClient *client = LDClientInit(config, user);
In most cases, you should create a single LDClient instance for the lifecycle of your program (a singleton pattern can be helpful here). When finished with the client (or prior to program exit), you should close the client.
LDClientClose(client);
Create a feature flag on your dashboard. In your application code, use the feature's key to check whether the flag is on for each user.
show_feature = LDBoolVariation(client, "your.flag.key", false);
if (show_feature) {
// application code to show the feature
} else {
// the code to run if the feature is off
}
You'll also want to ensure that the client is initialized before checking the flag.
initialized = LDClientIsInitialized(client);
Add the LaunchDarkly SDK to your project.
npm install --save ldclient-electron
Import the LaunchDarkly client, user and optional config properties in your main process.
var LDElectron = require('ldclient-electron');
var user = { key: 'example' };
var options = {};
var client = LDElectron.initializeInMain('YOUR_CLIENT_SIDE_ID', user, options);
Create the LaunchDarkly Client in your renderer process.
var LDElectron = require('ldclient-electron');
var client = LDElectron.initializeInRenderer();
Create a feature flag on your dashboard, then use your unique feature key in your application code.
var showFeature = client.variation("YOUR_FEATURE_KEY", false);
if (showFeature) {
// feature flag is on
} else {
// feature flag is off
}
Download the dependency using Rebar.
{deps, [
{ldclient, "1.0.0", {pkg, launchdarkly_server_sdk}}
]}.
Then add it to your app.src file.
{applications,
[kernel,
stdlib,
ldclient
]},
Create an instance of the SDK.
% This starts an instance with the default options
ldclient:start_instance("YOUR_SDK_KEY")
Check which flag variation a specific user should receive.
Flag = ldclient:variation(<<"YOUR_FLAG_KEY">>, #{key => <<"123">>}, false)
Add the dependency to pubspec.yaml.
launchdarkly_flutter_client_sdk: ^0.1.0
Then add it to your Dart file.
import 'package:launchdarkly_flutter_client_sdk/launchdarkly_flutter_client_sdk.dart';
Initialize the SDK.
LDClient.start(LDConfigBuilder('YOUR_MOBILE_KEY').build(), LDUserBuilder('YOUR_USER_KEY').build());
Check which flag variation a specific user should receive.
bool showFeature = await LDClient.boolVariation('YOUR_FLAG_KEY', false);
Add plugin to your Gatsby site:
npm install gatsby-plugin-launchdarkly
Then in your gatsby-config.js:
// gatsby-config.js
...
plugins: [
...
{
resolve: 'gatsby-plugin-launchdarkly',
options: {
clientSideID: '<your-launchdarkly-project-client-side-id>',
options: {
// any LaunchDarkly options you may want to implement
bootstrap: 'localstorage', // caches flag values in localstorage
},
},
},
...
]
...
In order to use a LaunchDarkly feature flag in your component, you’ll need to first import the LaunchDarklyContext. This plugin makes use of React Context to make the LaunchDarkly SDK available to your Gatbsy components:
import { useFlags } from 'gatsby-plugin-launchdarkly'
Then within your component, you can do the following:
// In a functional component...
const Header = ({ siteTitle }) => {
// The following contains all of the client-side flags. Flag names are
// automatically converted to snake-case which will allow you to pull out
// one or more flags directly through destructuring.
const flags = useFlags()
return (
<header
style={{
background: flags.someNewFeature ? 'green' : 'gray'
}}
>
...
Add the LaunchDarkly SDK to your project.
go get gopkg.in/launchdarkly/go-client.v2
Import the LaunchDarkly client in your application code.
import ld "gopkg.in/launchdarkly/go-client.v2"
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
ld_client := ld.MakeClient(YOUR_SDK_KEY, 5*time.Second)
Create a feature flag on your dashboard, then use your unique feature key in your application code.
show_feature := ld_client.BoolVariation("your.flag.key", ld.NewUser("user@test.com"), false)
if (show_feature) {
// application code to show the feature
} else {
// the code to run if the feature is off
}
Import the code into your application:
import LaunchDarkly.Server
Configure the LaunchDarkly Client with your SDK key and create the client.
client <- makeClient $ makeConfig "YOUR_SDK_KEY"
Create a feature flag on your dashboard, then use your unique feature key in your application code:
showFeature <- boolVariation client "your.flag.key" (makeUser "user@test.com") False
Add the LaunchDarkly SDK to your project.
pod 'LaunchDarkly'
Import the LaunchDarkly SDK in your application code.
import LaunchDarkly
Configure the LaunchDarkly client with your mobile SDK key and the current user.
let config = LDConfig(mobileKey: "YOUR_MOBILE_KEY")
let user = LDUser(key: "YOUR_USER_KEY")
LDClient.start(config: config, user: user)
let ldClient = LDClient.get()!
Create a feature flag on your dashboard, then use the client to get the flag value in your application.
let showFeature = ldClient.variation(forKey: "YOUR_FLAG_KEY", defaultValue: false)
if showFeature {
// application code to show the feature
} else {
// the code to run if the feature is off
}
Objective-C bindings are also available for the iOS SDK, see our SDK docs for more information.
Add the LaunchDarkly SDK to your project.
<dependency>
<groupId>com.launchdarkly</groupId>
<artifactId>launchdarkly-client</artifactId>
<version>2.5.1</version>
</dependency>
Import the LaunchDarkly client in your application code.
import com.launchdarkly.client.*;
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
LDClient ldClient = new LDClient(YOUR_SDK_KEY);
Create a feature flag on your dashboard, then use your unique feature key in your application code.
LDUser user = new LDUser("user@test.com");
boolean showFeature = ldClient.boolVariation("your.feature.key", user, false);
if (showFeature) {
// application code to show the feature
}
else {
// the code to run if the feature is off
}
Add the LaunchDarkly SDK snippet to your pages.
<head>
<script src="https://app.launchdarkly.com/snippet/ldclient.min.js"></script>
</head>
Configure the LaunchDarkly Client with your client-side id and initialize the client.
var user = {
"key": "aa0ceb",
"firstName": "Ernestina",
"lastName": "Evans",
"email": "ernestina@example.com",
"custom": {
"groups": ["Google", "Microsoft"]
}
};
var ldclient = LDClient.initialize('YOUR_CLIENT_SIDE_ID_HERE', user);
Create a feature flag on your dashboard, then use your unique feature key in your application code.
var showFeature = ldclient.variation("YOUR-FLAG-KEY", false);
if (showFeature) {
// Show "One Click Checkout" feature
} else {
// the code to run if the feature is off
}
Add the LaunchDarkly SDK to your project.
local ld = require("launchdarkly_server_sdk")
Configure the LaunchDarkly Client with your SDK key and create the client.
local config = {
key = YOUR_SDK_KEY
}
local client = ld.clientInit(config, 1000)
Create a feature flag on your dashboard, then use your unique feature key in your application code.
if client:boolVariation(user, YOUR_FEATURE_KEY, false) then
print "feature is enabled"
else
print "feature is disabled"
end
Add the LaunchDarkly SDK to your project.
Install-Package LaunchDarkly.ServerSdk
Import the LaunchDarkly namespaces in your application code.
using LaunchDarkly.Sdk;
using LaunchDarkly.Sdk.Server;
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
var ldClient = new LdClient("YOUR_SDK_KEY");
Create a feature flag on your dashboard, then use your unique feature key in your application code.
var user = User.WithKey(username);
bool showFeature = ldClient.BoolVariation("your.feature.key", user, false);
if (showFeature) {
// application code to show the feature
}
else {
// the code to run if the feature is off
}
Add the LaunchDarkly SDK to your project.
npm install ldclient-node --save
Import the LaunchDarkly client in your application code.
var LaunchDarkly = require('ldclient-node');
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
ldclient = LaunchDarkly.init(YOUR_SDK_KEY)
Create a feature flag on your dashboard, then use your unique feature key in your application code.
ldclient.once('ready', function() {
ldclient.variation("your.flag.key", {"key": "user@test.com"}, false,
function(err, showFeature) {
if (showFeature) {
// application code to show the feature
} else {
// the code to run if the feature is off
}
});
});
Add the LaunchDarkly SDK to your project.
php composer.phar require launchdarkly/launchdarkly-php
Import the LaunchDarkly client in your application code.
require 'vendor/autoload.php';
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
$client = new LaunchDarkly\LDClient(YOUR_SDK_KEY);
Create a feature flag on your dashboard, then use your unique feature key in your application code.
$user = new LaunchDarkly\LDUser("user@test.com");
if ($client->variation("your.flag.key", $user)) {
} else {
}
Add the LaunchDarkly SDK to your project.
pip install ldclient-py
Import the LaunchDarkly client in your application code.
import ldclient
from ldclient.config import Config
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
ldclient.set_config(Config("YOUR_SDK_KEY"))
ld_client = ldclient.get()
Create a feature flag on your dashboard, then use your unique feature key in your application code.
show_feature = ld_client.variation("your.flag.key", {"key": "user@test.com"}, False)
if show_feature:
else:
Add the LaunchDarkly React SDK to your project.
npm i --save launchdarkly-react-client-sdk
Import the LaunchDarkly provider and wrap your root component.
import { withLDProvider } from 'ldclient-react';
const App = () =>
<div>
<Home />
</div>;
export default withLDProvider({
clientSideID: 'your-client-side-id',
options: { /* ... */ }
})(App);
Anywhere you need flags, import the LaunchDarkly consumer, wrap your component and flags will be available in props.
import { withLDConsumer } from 'ldclient-react';
const Home = ({ flags }) => {
return flags.devTestFlag ? <div>Flag on</div> : <div>Flag off</div>;
};
export default withLDConsumer()(Home);
Add a LaunchDarklyTask node to your scene then initialize the SDK.
REM get a reference to to task
launchDarklyNode = m.top.findNode("my-node-name")
REM create configuration
config = LaunchDarklyConfig("MY_MOBILE_KEY", launchDarklyNode)
REM create a user
user = LaunchDarklyUser("user-key")
REM initialize the client
LaunchDarklySGInit(config, user)
For each component you want to use the SDK with initialize an interface to talk to the SceneGraph.
REM create the scenegraph communication wrapper
launchDarkly = LaunchDarklySG(launchDarklyNode)
REM use the client
value = launchDarkly.boolVariation("MY_FLAG_KEY", false)
Add the LaunchDarkly SDK to your project.
gem install ldclient-rb --prerelease
Import the LaunchDarkly client in your application code.
require 'ldclient-rb'
Configure the LaunchDarkly Client with your SDK or Mobile key and create the client.
ld_client = LaunchDarkly::LDClient.new(YOUR_SDK_KEY)
Create a feature flag on your dashboard, then use your unique feature key in your application code.
show_feature = ld_client.variation("your.flag.key", {:key => "user@test.com"}, false)
if show_feature
else
Use NuGet to add the Xamarin SDK to your project.
Install-Package LaunchDarkly.XamarinSdk
Import the LaunchDarkly packages.
using LaunchDarkly.Client;
using LaunchDarkly.Xamarin;
Initialize the LDClient with your Mobile key and user.
User user = User.WithKey(username);
LdClient ldClient = await LdClient.InitAsync("YOUR_MOBILE_KEY", username);
Create a new feature flag on your dashboard. In your application code, use the feature's key to check whether the flag is on for each user.
bool showFeature = ldClient.BoolVariation("your.feature.key", false);
if (showFeature) {
// application code to show the feature
}
else {
// the code to run if the feature is off
}
When we added LaunchDarkly to our stack, feature toggles quickly became easy and delightful to use. It's fundamentally changed the way we build, rollout and test features.
Scott Ringwelski
Co-founder and CTO, Handshake
Scalable to Benefit Your Team
Scale to your team, scale to your users.
Starting to feature flag is easy, managing them is hard. Managing multiple features across different environments is no easy feat—especially when you want to keep everyone in sync and compliant.
LaunchDarkly's feature management platform is built for teams. Organize work spaces with projects and environments. Support security requirements with team controls, including custom roles and multi-factor authentication. Get real time visibility into the full lifecycle of features with an audit log. And an intuitive dashboard that is easy for anyone in your organization to use.
Our feature management platform is also built for scale. Companies like Atlassian and Microsoft use LaunchDarkly to manage features in multiple products across their organizations. We serve over 200 billion features daily.
Ready to Get Your Hands on the Platform?
Get started today, and talk to an expert.