featureflow

The featureflow Developer Hub

Welcome to the featureflow developer hub. You'll find comprehensive guides and documentation to help you start working with featureflow as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Quick start - Server

This Quick start is designed to get featureflow into your existing application as quickly as possible.

Install the Featureflow client

<dependency>
  <groupId>io.featureflow</groupId>
  <artifactId>featureflow-java-sdk</artifactId>
  <version>1.0.1</version>
</dependency>
npm install featureflow-node-sdk
Install-Package Featureflow
# Without bundler
$ gem install featureflow

# With bundler
# in your Gemfile
gem 'featureflow'
# then
$ bundle install
package main

import {
  "github.com/featureflow/featureflow-go-sdk/featureflow"
}

Create a Featureflow client and register features

FeatureflowClient client = new           FeatureflowClient.Builder(Server Environment Api Key)
  .withFeatures(Arrays.asList(
    new Feature("logout-button", Variant.off),
    new Feature("example-feature", Variant.off)),   
	));

//The client is a singleton, so for example if you use spring you might declare it in a @Configuration class.

//we recommend that you use an enum for your feature keys - this helps you track them in your IDE and reduces debt.
var Featureflow = require('featureflow-node-sdk');

var withFeatures = [
	new Featureflow.Feature("logout-button").build(),
	new Featureflow.Feature("example-button").build(),
]

new Featureflow.Client({
    apiKey: "server-api-key",
    withFeatures: withFeatures
}, function(error, featureflow) {
  if (!error) {
    throw error;
  }
  // featureflow is now initialized
  featureflow
});

//You should only create one instance of a Featureflow.Client
using Featureflow.Client;
var client = new FeatureflowClient("srv-env-your-server-api-key");

//NOTE The client should be a singleton.
require 'featureflow'

with_features = [
  Featureflow::Feature.create('logout-button'),
  Featureflow::Feature.create('example-button')
]

featureflow = Featureflow::Client.new(api_key: "server api key", with_features: with_features)
featureflowClient, error := featureflow.Client("server api", featureflow.Config{
  WithFeatures: []featureflow.FeatureRegistration{
    featureflow.WithFeature("logout-button", "off").Build(),
    featureflow.WithFeature("example-button", "off").Build(),
  }
})

Your 'Server Environment Api Key' is available on your environment page in featureflow.

You may wish to register your features at startup. This provides additional benefits - we know immediately when a feature is available in an environment, you can provide an alternative failover variant (the default is 'off') - it also helps as a central place to refer to all your currently deployed features.

Evaluate a feature

//Without User
if(featureflowClient.evaluate("example-feature").isOn())) {
  //do something
} else {
  //do not do something
}

//With a User
FeatureflowUser user = new FeatureflowUser("uniqueUserId")
  .withAttribute("tier", "silver")
  .withAttribute("age", 32)
  .withAttribute("signup_date", new DateTime(2017, 1, 1, 12, 0, 0, 0));

if(featureflowClient.evaluate("example-feature", user).isOn()) {
 	//do something
}
//Without Context Values
if (featureflow.evaluate("example-feature", "uniqueuserkey1").isOn())) {
    //do something
} else {
    //do not do something
}

//With a User
var UserBuilder = require("featureflow-node-sdk").UserBuilder;
var user = new UserBuilder('uniqueuserkey1')
										.withAttribute('tier', 'silver')
										.withAttribute('age', 32)
										.withAttribute('signup_date', new Date(2017, 0, 1, 12, 0, 0, 0))

if (featureflow.evaluate("example-feature", user).isOn()) {
    //do something
}
var user = new User();
user.WithAttribute("tier", "silver");
user.WithAttribute("age", 32l);
user.WithAttribute("days", new List<object> {11l, 1l, 4l, 29l});

user.WithSessionAttribute("dayofweek", 2l); //session attributes are not saved against the user

if (client.Evaluate("example-feature", user).IsOn())
{
  //do something
}
else
{
  //do not do something
}
# without user attributes
if featureflow.evaluate("example-feature", "uniqueuserkey1").on?
  # do something
end

#with user attributes
user = Featureflow::UserBuilder.new('uniqueuserkey1')
.withAttributes(
                                        tier: 'silver',
                                        age: 32,
                                        signup_date: Time.new(2017, 1, 1, 12).iso8601
                                       ).build

if featureflow.evaluate("example-feature", user).on?
  # do something
end
// without context values
if featureflowClient.EvaluateBasic("example-feature", "uniqueuserkey1").IsOn() {
	//do something
}

// with context values
user := featureflow.NewUserBuilder("uniqueuserkey1").
  WithAttribute("tier", "silver").
  WithAttribute("age", 23).
  WithAttribute("signup_date", "2017-01-01T12:00:00+00:00").
  Build()

if featureflowClient.Evaluate("example-feature", user).IsOn() {
	//do something
}

In the Server-side SDK's we create a FeatureFlow User and pass that into the 'evaluate' method.
The FeatureflowUser contains a a set of name/value pairs which give featureflow information on which you can base your feature rules. If you do not provide a user we will assume the user is 'anonymous'.

Try it out!

You may now fire up your application - keep an eye on the features list in the featureflow admin panel and you will see your features appear with default on/off settings.

Congratulations you're done!

If you wish of course you can create the features via the featureflow UI - featureflow will make the connection using the feature Key.
To do this click 'New Feature' (in any environment) and enter a name and key:

You will see your feature in the list - you will notice that it has an empty green circle next to it - this means we have not seen the feature in the environment.
If you add the key to your applications feature registration code and start your app again you will find that it will change to a ticked green circle as soon as we detect it (ensure you're looking at the environment that matches your codes environment key). In the future, this turns grey if your feature becomes 'stale' - prompting you to think about removing the code if it is unused.

Thats the basics to get started. Check out the User guide for to learn how to manage gradual rollouts, targeting, and multiple feature variants. You may wish to try the javascript client SDK started to manage your front-end.


What's Next

Check out the User guide

Overview

Quick start - Server

This Quick start is designed to get featureflow into your existing application as quickly as possible.