SDK quick linksLaunchDarkly SDKs are open source. In addition to this reference guide, we provide source, API reference documentation, and a sample application:
| Resource | Location |
|---|---|
| SDK API documentation | SDK API docs |
| Supported SDK Versions | Fastly SDK |
| GitHub repository | LaunchDarkly Fastly SDK |
| Sample application | Example app |
| Published module | npm |
This SDK requires the LaunchDarkly Fastly integrationConfigure the Fastly integration to use this SDK successfully. To learn more, read Fastly.The Fastly integration is only available to customers on select plans. To learn more, read about our pricing. To upgrade your plan, contact Sales.
Get started
After you complete the Create a Fastly integration process in an existing project, follow these instructions to start using the LaunchDarkly Fastly SDK:Install the SDK
First, install the Fastly SDK as a dependency in your application using your application’s dependency manager. Here’s how:Initialize the client
After you install and import the SDK, configure a Fastly KV Store. Then, initialize anLDClient using your LaunchDarkly client-side ID, the Fastly KV store name, and the Fastly backend name. The client must be initialized when processing requests, not during build-time initialization.
Here’s how:
Evaluate a flag
After you initialize the client, wait for thewaitForInitialization function to resolve. When waitForInitialization is resolved, the client can serve .
Using the client, you can check which a particular will receive for a given feature flag. In your Fastly application, place the variation code so that it is invoked as needed.
Here is an example: