Coder Social home page Coder Social logo

cdonnellytx / launchdarkly-openfeature-js-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from launchdarkly/openfeature-node-server

0.0 0.0 0.0 39 KB

[EXPERIMENTAL] An open feature provider for the LaunchDarkly browser SDK.

License: Other

JavaScript 2.44% TypeScript 97.56%

launchdarkly-openfeature-js-client's Introduction

LaunchDarkly OpenFeature provider for the Server-Side SDK for Node.js

This provider allows for using LaunchDarkly with the OpenFeature JS SDK.

This provider 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.

This provider is a beta version and should not be considered ready for production use while this message is visible.

LaunchDarkly overview

LaunchDarkly is a feature management platform that serves over 100 billion feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!

Twitter Follow

Supported Node versions

This version of the LaunchDarkly OpenFeature provider is compatible with Node.js versions 14 and above.

Getting started

Installation

npm install @openfeature/js-sdk
npm install launchdarkly-node-server-sdk
npm install @launchdarkly/openfeature-node-server

Usage

import { OpenFeature } from '@openfeature/js-sdk';
import { init } from 'launchdarkly-node-server-sdk';
import { LaunchDarklyProvider } from '@launchdarkly/openfeature-node-server';


const ldClient = init('<your-sdk-key>');
await ldClient.waitForInitialization();
OpenFeature.setProvider(new LaunchDarklyProvider(ldClient));
const client = OpenFeature.getClient();
const value = await client.getBooleanValue('app-enabled', false, {targetingKey: 'my-key'});

Refer to the SDK reference guide for instructions on getting started with using the SDK.

OpenFeature Specific Considerations

When evaluating an LDUser with the LaunchDarkly Node SDK a string key attribute would normally be required. When using OpenFeature the targetingKey attribute should be used instead of key. If a key attribute is provided in the EvaluationContext, then it will be discarded in favor of targetingKey. If a targetingKey is not provided, or if the EvaluationContext is omitted entirely, then the defaultValue will be returned from OpenFeature evaluation methods.

Other fields normally included in an LDUser may be added to the EvaluationContext. Any custom attributes can be added to the top level of the evaluation context, and they will operate as if they were custom attributes on an LDUser. Attributes which are typically top level on an LDUser should be of the same types that are specified for an LDUser or they will not operate as intended.

If a top level custom attribute is defined on the EvaluationContext, then that will be a custom attribute inside custom for an LDUser.

If a custom attribute is provided, whose value is an object, then that attribute will be discarded.

Learn more

Check out 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.

Contributing

We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out our documentation for a complete list.
  • Explore LaunchDarkly

launchdarkly-openfeature-js-client's People

Contributors

beeme1mr avatar kinyoklion avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.