
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@launchdarkly/cloudflare-server-sdk
Advanced tools
The LaunchDarkly Cloudflare SDK is designed primarily for use in multi-user Cloudflare workers. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
This SDK is a replacement of launchdarkly-cloudflare-edge-sdk. Please consider updating your application to use this package instead.
For more information, see the complete reference guide for this SDK.
# npm
npm i @launchdarkly/cloudflare-server-sdk
# yarn
yarn add @launchdarkly/cloudflare-server-sdk
# jsr
npx jsr add @launchdarkly/cloudflare-server-sdk
Then turn on the Node.js compatibility flag in your wrangler.toml. This allows the SDK to use node:events:
compatibility_flags = [ "nodejs_compat" ]
If you want to install this package as a JSR package, you will need to use esbuild version >= 19.7 to enable support for import attributes.
Initialize the ldClient with your client side sdk key and the Cloudflare KV namespace:
import { init as initLD } from '@launchdarkly/cloudflare-server-sdk';
export default {
async fetch(request: Request, env: Bindings): Promise<Response> {
const clientSideID = 'test-client-side-id';
const flagKey = 'testFlag1';
const context = { kind: 'user', key: 'test-user-key-1' };
// init the ldClient, wait and finally evaluate
const client = initLD(clientSideID, env.LD_KV);
await client.waitForInitialization();
const flagValue = await client.variation(flagKey, context, false);
return new Response(`${flagKey}: ${flagValue}`);
},
};
See the full example app.
# at js-core repo root
yarn && yarn build && cd packages/sdk/cloudflare
# run tests
yarn test
LaunchDarkly uses the SLSA framework (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the provenance guide.
FAQs
Cloudflare LaunchDarkly SDK
We found that @launchdarkly/cloudflare-server-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.