Skip to main content

Getting Started with the JavaScript SDK

appflags GitHub Repo stars

Configuring the AppFlags client

To configure and initialize the AppFlags client, you need to provide a user object and the client-side SDK key for the correct environment.

info

For more information on the client-side SDK key, see SDK Keys.

User key

The user object contains a key, which is a unique identifier for the user. This key must be unique for each user and stay the same for a particular user.

const user = {
key: "UNIQUE_USER_KEY"
}

Initializing the client

To initialize the client, call initialize as follows:

AppFlags.initialize("CLIENT_SDK_KEY", user);

This function returns immediately and the client will initialize in the background. For the best performance, initialize the AppFlags client as early as possible.

info

The AppFlags client takes about 100ms to initialize while it fetches feature flags from the AppFlags edge servers.