In this tutorial we will build a working web application that connects to CloudBees Unify Feature Management and demonstrates how feature flags control UI elements in real-time. Along the way we will encounter SDK integration, the CloudBees Unify Feature Management interface, and different types of feature flags working together.
By the end, you will have a running application that responds immediately to feature flag changes and experience with the core workflow of feature-driven development.
Before we begin
Before we begin, ensure you have:
-
Completed Get started with feature management.
-
Node.js and npm installed on your local machine.
-
Git installed for cloning repositories.
-
A code editor such as VS Code or WebStorm.
Choose and set up your web application framework
We will start by setting up a pre-built example application that already has feature flag integration configured. You can choose between an Angular or React application: both demonstrate the same feature flag concepts.
-
Choose your preferred framework and clone the corresponding repository:
Angular applicationgit clone https://github.com/cloudbees-io/angular-fm-example.git cd angular-fm-exampleReact applicationgit clone https://github.com/cloudbees-io/react-fm-example.git cd react-fm-example -
Open the project in your code editor. You will see a typical web application structure with components, configuration files, and build scripts.
Notice that the CloudBees Unify SDK is already integrated into the project structure. This means we can focus on seeing feature flags in action rather than configuring the integration from scratch.
Connect your application to CloudBees Unify Feature Management
Now we need to connect our local application to your CloudBees Unify Feature Management environment using an SDK key. The SDK key tells the application which feature flag configuration to use.
-
Navigate to in CloudBees Unify.
-
Select your application from the list. If you don’t see an application, you may need to create one following the getting started tutorial.
-
Select
next to the SDK key to copy it to your clipboard.
The SDK key is a long string that uniquely identifies your feature management environment. -
Add the SDK key to your application configuration:
Angular applicationOpen the file
src/app/app.component.tsand locate this line:sdkKey = "<Your CloudBees SDK key>";Replace
<Your CloudBees SDK key>with the SDK key you copied.React applicationOpen the file
src/feature-management/FeatureFlagsProvider.tsxand locate this line:const sdkKey = "<YOUR-SDK-KEY>";Replace
<YOUR-SDK-KEY>with the SDK key you copied. -
Save the file.
Your application is now configured to communicate with your CloudBees Unify Feature Management environment. The SDK will automatically connect and sync feature flag values when we start the application.
Run your application locally
Let’s start the development server and see our application running with its default configuration.
-
Install the project dependencies:
npm installThis will download all the libraries and tools needed to run the application.
-
Start the development server:
Angular applicationng serveReact applicationnpm run dev -
Open your web browser and navigate to the URL shown in the terminal output. For Angular this is typically
http://localhost:4200, for React it varies but will be displayed clearly.
You will see the example application running with a message displayed on the page. Notice the current message content, size, and color - we are about to take control of all these properties using feature flags.
Verify the feature flag connection
Now that our application is running and connected to CloudBees Unify, let’s confirm that the feature flags have been automatically imported and are ready for configuration.
-
Return to CloudBees Unify and navigate to .
-
Select your application. You should now see four feature flags that were automatically detected from your running application:
| Flag name | Flag type | Description |
|---|---|---|
|
Boolean |
Turns the message display on or off completely. |
|
String |
Controls the text content of the message. |
|
Number |
Sets the message font size in pixels (12, 16, or 24). |
|
String |
Sets the message color (red, green, or blue). |
Notice how each flag serves a different purpose and uses a different data type. This demonstrates how feature flags can control various aspects of application behavior beyond simple on/off switches.
If you don’t see these flags, the SDK connection may need a moment to establish. Refresh the page in CloudBees Unify and ensure your application is still running locally.
Control your application with feature flags
Now comes the exciting part: we will modify feature flag values in CloudBees Unify and watch our application change in real-time without any code deployments or application restarts.
-
In CloudBees Unify, select
next to the showMessageflag. -
Select Configure.
-
Select your environment from the list.
-
Change the flag value from its current setting to the opposite (if it’s currently
true, set it tofalse). -
Select Save.
-
Set the Configuration status to On if it isn’t already.
-
Return to your browser tab with the running application. Within a few seconds, you will see the message either appear or disappear completely.
Let’s try controlling the message appearance:
-
Configure the
messageflag and change its value to "Hello from feature flags!". -
Configure the
fontSizeflag and set it to24. -
Configure the
fontColorflag and set it toblue. -
Save each change and set the configuration status to On.
Watch your application as you make each change. The message text, size, and color will update automatically without refreshing the browser or restarting the application.
This immediate feedback loop is what makes feature flags so powerful for both development and production use. You can safely test changes, roll them out gradually, or instantly revert if something goes wrong.
Conclusion
We have built a web application that responds to feature flags in real-time, giving us complete control over the user interface through the CloudBees Unify Feature Management console. Along the way we encountered SDK integration, automatic flag detection, and the immediate feedback loop that makes feature flags valuable for development teams.
You now have hands-on experience with how feature flags work in practice and a foundation for implementing them in your own applications.
From here, you might want to:
-
Create and manage feature flags to build your own custom flags
-
Configure feature flag targeting to control which users see different flag values
-
Understanding feature management for a deeper look at feature flag concepts and strategies
Related pages
-
Install client-side SDKs for integrating feature flags into your own applications
-
Create and manage feature flags to start building custom feature flags
-
Understanding feature management for conceptual background on feature flag strategies