@flagsio/js-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Build Status Npmjs Contributors Forks Stargazers Issues License LinkedIn Twitter


Flagsio JavaScript SDK

A JavaScript & TypeScript SDK for NodeJS and Browser Clients
Explore the docs »

Report Bug · Request Feature

Table of Contents

Overview

Flagsio is an easy-to-use, real-time feature management platform that helps teams build better software, faster.
Get started using Flagsio today!

(back to top)

Getting started

To run any of the example client apps locally follow these steps.

Prerequisites

Installation

  1. Install the SDK package
    npm install @flagsio/js-sdk
  2. Build
    npm run build
    

(back to top)

Local development

  1. Clone the repo
    git clone https://github.com/flagsio/js-sdk.git
  2. Install NPM packages
    npm install
  3. Build
    npm run build
    

(back to top)

Usage

Browser Client:

Import SDK

// /browser path contains a polyfilled bundle of the SDK for browsers 
import FlagsioSdk from "@flagsio/js-sdk/browser"; 

Connect once in the entry point of your app

app.js:

const ENV_ID = 'ENTER YOUR ENVIRONMENT ID';
const API_KEY = 'ENTER YOUR API KEY';

FlagsioSdk.connect(ENV_ID, API_KEY, {
    debug: true, // enabling will print logs to the console during runtime
});

Anywhere in your application

const isEnabled = FlagsioSdk.hasFeature("example-feature", false);

if (isEnabled) {
    // do something when example feature is enabled
} else {
    // do something else
}

NodeJS Client:

Import SDK

// root path contains a bundle of the SDK for NodeJS 
import FlagsioSdk from "@flagsio/js-sdk"; 

Connect once in the entry point of your app

app.js:

const ENV_ID = 'ENTER YOUR ENVIRONMENT ID';
const API_KEY = 'ENTER YOUR API KEY';

FlagsioSdk.connect(ENV_ID, API_KEY, {
    debug: true, // enabling will print logs to the console during runtime
});

Anywhere in your application

const isEnabled = FlagsioSdk.hasFeature("example-feature", false);

if (isEnabled) {
    // do something when example feature is enabled
} else {
    // do something else
}

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • [ ] TODO

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this project better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

See CONTRIBUTING.md for more information on how to contribute to our project.

(back to top)

License

Distributed under the Apache License, Version 2.0 License.See LICENSE.txt for more information.

(back to top)

Contact

Flagsio Team - @FlagsioDotCom - github@flagsio.com

Project Link: https://github.com/flagsio/js-sdk/

Website Link: https://www.flagsio.com/

(back to top)

Acknowledgments

(back to top)

Readme

Keywords

none

Package Sidebar

Install

npm i @flagsio/js-sdk

Weekly Downloads

2

Version

0.1.5

License

Apache-2.0

Unpacked Size

304 kB

Total Files

17

Last publish

Collaborators

  • flagsio-cicd