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';
const configBeeProvider = new ConfigbeeWebProvider({
accountId: 'your-account-id',
projectId: 'your-project-id',
environmentId: 'your-environment-id',
});
OpenFeature.setProvider(configBeeProvider);
await OpenFeature.setContext({ key: 'my-key' });
(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
0.0.0-alpha.6 (2024-10-03)
This was a version bump only, there were no code changes.