Socket
Book a DemoInstallSign in
Socket

configbee-openfeature-provider-web

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configbee-openfeature-provider-web

The **ConfigBee OpenFeature Provider (Web)** enables you to use [ConfigBee](https://configbee.com/) as the backend for managing feature flags in a web environment, utilizing the [OpenFeature](https://openfeature.dev/) specification. This provider integrat

alpha
latest
Source
npmnpm
Version
0.0.0-alpha.6
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

ConfigBee OpenFeature Provider (Web)

The ConfigBee OpenFeature Provider (Web) enables you to use ConfigBee as the backend for managing feature flags in a web environment, utilizing the OpenFeature specification. This provider integrates seamlessly with your application, offering dynamic configuration and feature flagging capabilities with the flexibility of ConfigBee.

Features

  • Real-time feature flagging using ConfigBee's backend.
  • Dynamic configuration capabilities for contextual and targeted feature delivery.
  • Contextual targeting support using OpenFeature’s context API.
  • Seamless integration with OpenFeature-compliant systems.
  • Supports web applications built with JavaScript/TypeScript.

Installation

You can install the configbee-openfeature-provider-web via npm or yarn:

Using npm:

npm install configbee-openfeature-provider-web

Using yarn:

yarn add configbee-openfeature-provider-web

Getting Started

Prerequisites

Usage

Here’s a simple example of how to use the ConfigBee provider with OpenFeature in a web application:

import { OpenFeature } from '@openfeature/js-sdk';
import { ConfigbeeWebProvider } from 'configbee-openfeature-provider-web';

// Initialize the provider with your ConfigBee account, project, and environment information
const configBeeProvider = new ConfigbeeWebProvider({
  accountId: 'your-account-id',
  projectId: 'your-project-id',
  environmentId: 'your-environment-id',
});

// Set the ConfigBee provider for OpenFeature
OpenFeature.setProvider(configBeeProvider);

// Optionally set context for contextual targeting
await OpenFeature.setContext({ key: 'my-key' });

// Example: Fetching a feature flag based on the context
(async () => {
  const flagValue = await OpenFeature.getClient().getBooleanValue('new_feature', false);
  console.log(`New Feature Flag: ${flagValue}`);
})();

Contextual Targeting

ConfigBee supports contextual targeting, which allows you to deliver personalized feature configurations based on custom context data. You can use OpenFeature's context API to provide this data:

await OpenFeature.setContext({ userId: 'your-user-id' });

The context can include various properties (e.g., user identifiers) to ensure targeted delivery of features and configurations based on the current application state.

Framework Support

The ConfigBee OpenFeature Provider (Web) is compatible with any framework based on the OpenFeature Web SDK, including React and Angular. As OpenFeature continues to expand, additional frameworks will be supported in the future.

For more information:

Contributing

We welcome contributions to the ConfigBee OpenFeature Provider (Web)! Whether you're fixing bugs, adding new features, improving documentation, or enhancing test coverage, your input is valuable.

How to Contribute

  • Fork the repository: Start by forking the ConfigBee OpenFeature Provider (Web) repository to your GitHub account.
  • (Optional) Create a branch: You can create a new branch for your feature or bug fix, though it's not mandatory.
  • Make your changes: Develop and test your changes locally.
  • Run tests: Ensure that all existing and new tests pass before submitting.
  • Submit a pull request: Once your changes are ready and tested, submit a pull request to the main repository.

Building

To build the project locally, run:

nx package

This will generate the distributable package for the library.

Running unit tests

Unit tests ensure that your changes don't break existing functionality. To execute the tests, run:

nx test

We use Jest for testing. Make sure your new code is covered by unit tests and that all tests pass before submitting your pull request.

Guidelines

  • Ensure that your code adheres to the repository's coding style and guidelines.
  • Write clear and concise commit messages.
  • Provide detailed information in your pull request description, including what changes were made and why.

Resources

FAQs

Package last updated on 03 Oct 2024

Did you know?

Socket

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.

Install

Related posts