
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
launchdarkly-node-server-sdk
Advanced tools
The launchdarkly-node-server-sdk is a feature flag management tool that allows developers to control the release of features to users. It provides a way to manage feature flags, target specific user segments, and perform A/B testing. This SDK is designed for server-side applications.
Initialize the SDK
This code initializes the LaunchDarkly client with your SDK key and waits for the client to be fully initialized before proceeding.
const LaunchDarkly = require('launchdarkly-node-server-sdk');
const client = LaunchDarkly.init('YOUR_SDK_KEY');
client.waitForInitialization().then(() => {
console.log('LaunchDarkly client initialized');
}).catch(err => {
console.error('LaunchDarkly client failed to initialize', err);
});
Evaluate a feature flag
This code evaluates a feature flag for a specific user and returns the flag's value. The default value is used if the flag is not found.
const user = { key: 'user-key-123' };
client.variation('your-feature-flag-key', user, false).then(flagValue => {
if (flagValue) {
console.log('Feature is enabled for this user');
} else {
console.log('Feature is disabled for this user');
}
});
Track custom events
This code tracks a custom event for a specific user, which can be used for analytics and A/B testing purposes.
client.track('custom-event-key', user, { customData: 'value' });
Close the client
This code gracefully shuts down the LaunchDarkly client, ensuring that all pending events are sent before closing.
client.close().then(() => {
console.log('LaunchDarkly client closed');
});
Flagr is another open-source feature flagging and A/B testing tool. It offers similar capabilities to LaunchDarkly, including feature flag evaluation and user targeting. Flagr is also self-hosted, requiring you to handle the deployment and maintenance of the service.
Optimizely is a feature flagging and experimentation platform. It provides robust A/B testing and feature management capabilities. Compared to LaunchDarkly, Optimizely offers more advanced experimentation features but can be more expensive.
As mentioned in the repository changelog, the launchdarkly-node-server-sdk
project has been renamed to @launchdarkly/node-server-sdk
. All future releases will be made from the new repository. Please consider upgrading and filing potential requests in that repository's issue tracker.
The LaunchDarkly Server-Side SDK for Node.js is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
For using LaunchDarkly in client-side Node.js applications, refer to our Client-side Node.js SDK.
LaunchDarkly is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!
This version of the LaunchDarkly SDK is compatible with Node.js versions 12 and above.
Refer to the SDK reference guide for instructions on getting started with using the SDK.
Read our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.
The authoritative description of all properties and methods is in the TypeScript documentation.
We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.
We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.
[7.0.4] - 2024-03-01
This release contains no code changes. It updates the README file to emphasize that this is not the most recent package.
FAQs
LaunchDarkly Server-Side SDK for Node.js
The npm package launchdarkly-node-server-sdk receives a total of 512,670 weekly downloads. As such, launchdarkly-node-server-sdk popularity was classified as popular.
We found that launchdarkly-node-server-sdk demonstrated a not healthy version release cadence and project activity because the last version was released 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.