Set up Node.js (server-side) SDK

Install the package

$yarn add @launchdarkly/node-server-sdk

Initialize the SDK

Node.js (server-side) SDK initialization
1import * as LaunchDarkly from '@launchdarkly/node-server-sdk';
2
3// Set your LaunchDarkly SDK key.
4// This is inlined as example only for onboarding.
5// Never hardcode your SDK key in production.
6const client = LaunchDarkly.init('YOUR_SDK_KEY');
7
8client.once('ready', function () {
9 // For onboarding purposes only we flush events as soon as
10 // possible so we quickly detect your connection.
11 // You don't have to do this in practice because events are automatically flushed.
12 client.flush();
13 console.log('SDK successfully initialized!');
14});

You can find your server-side SDK key, client-side ID, and mobile key in the “Resources” section of the help menu. Click the help icon at the bottom left corner of the LaunchDarkly UI, then choose SDK keys:

The SDK keys option in the help menu.

The SDK keys option in the help menu.

To learn more, read Initialize the client in the Node.js (server-side) SDK reference guide.