Quickstart

Quickstart

This guide creates a boolean flag, assigns it a production value, and evaluates it in a JavaScript application.

What you’ll do

Create the smallest safe release control: a flag named new-checkout that is off in production until your team is ready to enable it.

When to use this guide

Use this guide when every user in an environment should receive the same value. For rules based on user or request attributes, use the targeting guide once it is available. For stable control/treatment variants, use an experiment instead.

Before you begin

You need access to the FujiFlag dashboard and an application that can install npm packages. Use a demo project or a non-production environment while learning.

1. Create a project and environment

In the FujiFlag dashboard, create a project for your application. Add the environments where it runs, such as development, staging, and production.

2. Create a feature flag

Create a boolean flag with a clear, stable key such as new-checkout. Set its value for each environment. Start with false in production until you are ready to release the feature.

3. Create a read API key

Open the environment’s API-key settings and create a read key. Client-side SDKs use keys beginning with ff-pk-.

Treat API keys as environment-specific. Do not place a production key in source control or reuse it outside its intended environment.

4. Install the JavaScript SDK

npm install @fujiflag/js

5. Evaluate the flag

import { createFujiFlagClient } from "@fujiflag/js";
const client = createFujiFlagClient({
apiKey: "ff-pk-your-api-key-here",
baseURL: "https://api.fujiflag.com",
});
const enabled = await client.getFlagValue<boolean>("new-checkout");
if (enabled) {
// Render the new checkout experience.
}

Verify the result

With the flag set to false in the selected environment, enabled should be false. Change the environment value to true, then evaluate it again to confirm your application receives the new value.

Next steps