Skip to main content
This guide takes you from zero to a flag you can read in your app.

Prerequisites

Create a flag

1

Sign in

Open the dashboard. A new account starts with an organization and two environments, Production and Staging.
2

Create a flag

Create a flag named checkout-redesign with the boolean type. Boolean flags return true or false — the simplest way to gate a feature.
3

Enable it

In an environment, turn the flag on and choose the variation it serves. Changes take effect for connected SDKs in real time.

Get your SDK key

Every environment has its own SDK keys. Open the Environments page and copy a key:
  • A client key (prefix slc_) is safe to ship in browsers, mobile apps, and other public clients.
  • A server key (prefix sls_) is for trusted backends only.
Use the client key for the examples below.
Keep server keys secret. Only client keys belong in code that runs on a user’s device.

Evaluate the flag

Install an SDK and read the flag. You always pass a default value — the SDK returns it while the configuration is loading, if the flag is missing, or if its type doesn’t match.
npm install @softlaunch/react
Wrap your app in the provider, then read the flag with a hook:
import { SoftlaunchProvider, useBooleanFlag } from "@softlaunch/react";

function App() {
  return (
    <SoftlaunchProvider sdkKey="slc_...">
      <Checkout />
    </SoftlaunchProvider>
  );
}

function Checkout() {
  const { value: showRedesign } = useBooleanFlag(
    "checkout-redesign", // flag key
    "user-123", // subject key (a stable user identifier)
    { plan: "pro" }, // attributes used for targeting
    false, // default value
  );

  return showRedesign ? <NewCheckout /> : <OldCheckout />;
}

Next steps

Core concepts

Learn about flag types, environments, and targeting.

SDK reference

Explore the full SDK API and available methods.