# Commands Source: https://docs.softlaunch.so/cli/commands Reference for every Softlaunch CLI command. Run `softlaunch --help`, or `softlaunch --help`, for usage at any time. Every command accepts `--json` and `--no-color`. ## Authentication ### `softlaunch login` Sign in with an email one-time code. ```bash theme={null} softlaunch login ``` ### `softlaunch logout` Remove your stored credentials. ```bash theme={null} softlaunch logout ``` ### `softlaunch whoami` Show the signed-in account and the selected organization. ```bash theme={null} softlaunch whoami ``` ## Organizations ### `softlaunch orgs list` List the organizations you belong to. ```bash theme={null} softlaunch orgs list ``` ### `softlaunch orgs use` Select the active organization for later commands. ```bash theme={null} softlaunch orgs use ``` ## Flags ### `softlaunch flags list` List flags with their status in each environment. ```bash theme={null} softlaunch flags list ``` ### `softlaunch flags get` Show a flag's variations and per-environment configuration. ```bash theme={null} softlaunch flags get checkout-redesign ``` ### `softlaunch flags create` Create a flag. Choose a `--type` of `boolean`, `string`, `integer`, `numeric`, or `json`. ```bash theme={null} softlaunch flags create --name "Checkout redesign" --key checkout-redesign --type boolean ``` ### `softlaunch flags toggle` Enable or disable a flag in one environment. ```bash theme={null} softlaunch flags toggle checkout-redesign on --env production ``` ## Environments ### `softlaunch envs list` List environments and their SDK keys. ```bash theme={null} softlaunch envs list ``` ## Evaluate ### `softlaunch eval` Evaluate a flag for a subject using the configuration an SDK key points to. This returns the same result an SDK would. Pass [targeting attributes](/concepts/targeting) with repeated `--attr key=value` flags. ```bash theme={null} softlaunch eval checkout-redesign --subject user-123 --attr plan=pro --sdk-key slc_... ``` Set `SOFTLAUNCH_SDK_KEY` to omit `--sdk-key`. `eval` needs only an SDK key, not a sign-in. Use a client key (`slc_`) to evaluate the obfuscated client configuration, or a server key (`sls_`) for the full configuration. # CLI overview Source: https://docs.softlaunch.so/cli/overview Manage feature flags and environments from your terminal. The Softlaunch CLI manages flags, environments, and organizations from your terminal, and evaluates flags without writing code. Use it for scripting, automation, and quick changes alongside the [dashboard](https://app.softlaunch.so). ## Install The CLI requires Node.js 22 or later. ```bash npm theme={null} npm install -g @softlaunch/cli ``` ```bash pnpm theme={null} pnpm add -g @softlaunch/cli ``` ```bash yarn theme={null} yarn global add @softlaunch/cli ``` The installed command is `softlaunch`. To run it without installing, use `npx @softlaunch/cli `. ## Sign in Authenticate with your email. The CLI sends a one-time code and stores your session locally. ```bash theme={null} softlaunch login ``` Confirm the account you're signed in as: ```bash theme={null} softlaunch whoami ``` ## Select an organization Most commands act on a single organization. List the ones you belong to, then select one: ```bash theme={null} softlaunch orgs list softlaunch orgs use ``` The CLI remembers your selection for later commands. Override it on any command with `--org `. ## Output Every command supports `--json` for machine-readable output, which is useful in scripts: ```bash theme={null} softlaunch flags list --json ``` Add `--no-color` to disable colored output. ## Configuration Set these environment variables to provide defaults: | Variable | Description | | -------------------- | ------------------------------------------------------ | | `SOFTLAUNCH_ORG` | Default organization id, used when `--org` is omitted. | | `SOFTLAUNCH_SDK_KEY` | Default SDK key for `softlaunch eval`. | Your credentials are stored under `~/.softlaunch`. ## Next steps See every command and its options. # Environments & SDK keys Source: https://docs.softlaunch.so/concepts/environments Isolate flag configuration per environment and connect SDKs securely. An **environment** is an isolated copy of your flag configuration. Every organization starts with **Production** and **Staging**, and you can add more. The same flags exist across all environments, but each environment configures them independently. You might enable a flag at 100% in Staging while it's still off in Production. ## SDK keys Each environment has its own **SDK keys**. A key tells an SDK which environment to read and how to connect. There are two kinds: Prefix `slc_`. Safe to ship in browsers, mobile apps, and other public clients. Its configuration is served in an obfuscated form. Prefix `sls_`. For trusted backends only. Reads the full configuration and must be kept secret. Find both keys on the **Environments** page. Choose the key that matches where your code runs. Never ship a server key (`sls_`) in client-side code. Use a client key (`slc_`) for anything that runs on a user's device. ## Choosing an environment Point your development and staging builds at a non-production environment's key, and your production build at the Production key. Because configuration is isolated per environment, you can test flag changes safely before they reach real users. An environment's configuration is independent. Changing a flag in Staging never affects Production. # Feature flags Source: https://docs.softlaunch.so/concepts/feature-flags What flags are, the types they support, and the values they return. A feature flag is a named switch in your code. Instead of hardcoding behavior, you ask Softlaunch what a flag should return for a given user, and change that answer from the dashboard — no redeploy. ## Flag types Every flag has a type, set when you create it. The type determines the shape of the value the SDK returns. | Type | Returns | Example use | | --------- | ------------------- | ------------------------------------- | | `boolean` | `true` or `false` | Gate a feature on or off | | `string` | A text value | Choose a variant name, theme, or copy | | `integer` | A whole number | A limit, count, or threshold | | `numeric` | A decimal number | A rate, multiplier, or price | | `json` | A structured object | A bundle of related settings | Each SDK exposes a typed method per flag type, so you read a flag with the same type you defined. If a flag's type doesn't match the method you call, the SDK returns your default value. ## Variations A **variation** is a value a flag can return. A boolean flag has two variations (`true` and `false`); other types can have as many as you need — for example a `string` flag with `control`, `treatment-a`, and `treatment-b`. When you evaluate a flag, Softlaunch resolves it to exactly one variation based on the flag's configuration in that environment. ## Default values Every SDK call requires a **default value**. The SDK returns it when: * The configuration hasn't loaded yet. * The flag doesn't exist in that environment. * The flag's type doesn't match the method you called. Choose a default that is safe to serve to every user. It's the value your app falls back to whenever Softlaunch can't return a definitive answer. ## Enabling and disabling A flag is enabled or disabled **per environment**. A disabled flag serves its configured off value to everyone, regardless of targeting. This lets you keep the same flag configured differently in Staging and Production. Learn how a flag can behave differently across environments. # How it works Source: https://docs.softlaunch.so/concepts/how-it-works How flag configuration flows from the dashboard to your app. Softlaunch is built around **local evaluation**. Your SDKs don't call an API for every flag check — they hold a snapshot of your configuration and evaluate flags in-process. This keeps evaluations instant and your app fast. ## The flow You define flags, environments, and targeting rules in the dashboard. Softlaunch compiles each environment's configuration into a compact snapshot whenever it changes. The snapshot is served from a global CDN, cached close to your users. Your SDK loads the snapshot once and evaluates flags locally — no network round trip per flag. When configuration changes, connected SDKs receive the new snapshot in real time and re-evaluate. ## Why it's built this way Flags are evaluated in-process. A flag check is a local function call, not a network request. Configuration is served from a CDN and cached in the SDK, so evaluation keeps working even through network blips. Changes propagate to connected SDKs immediately, without polling. Configuration for public clients is obfuscated, so your targeting logic isn't exposed in the browser. ## Data isolation Each organization's data lives in its own isolated, database-per-tenant store. Your flags, environments, and configuration are never colocated with another organization's data. Because evaluation happens locally against a cached snapshot, the user attributes you pass to an SDK stay in your application. Softlaunch evaluates flags without those attributes leaving your environment. # Targeting & rollouts Source: https://docs.softlaunch.so/concepts/targeting Serve different variations to different users and roll out gradually. Targeting decides which variation a flag returns for a given user. You evaluate a flag against a **subject** — identified by a stable **subject key** and optional **attributes** — and Softlaunch resolves it using the flag's rules. ```ts theme={null} client.getStringFlag( "pricing-experiment", "user-123", // subject key { plan: "pro", country: "US" }, // attributes "control", // default ); ``` The subject key should be stable for a user over time (for example, a user ID), so the same user consistently receives the same result. ## Targeting rules A flag's configuration is an ordered list of **targeting rules**. Each rule matches a set of users by their attributes and serves a variation. Rules are evaluated top to bottom, and the first one that matches wins. If no rule matches, the flag serves its default variation. A rule matches on **conditions** over attributes — for example, `plan is one of [pro, enterprise]` or `country is US`. Conditions support equality, comparison, list membership, and presence checks. ## Audiences An **audience** is a reusable, named group defined by conditions — for example, "Beta users" or "Internal staff." Reference an audience from any flag's targeting rules instead of redefining the same conditions each time. Update the audience once, and every flag that uses it reflects the change. ## Percentage rollouts A targeting rule can serve a variation to a percentage of matching users instead of all of them. This lets you release gradually: Roll a variation out to 5% of users and watch for issues. Increase the percentage over time. Bucketing is consistent — users already in the rollout stay in it as you ramp. Move to 100% once you're confident. Within a rule you can also split traffic across multiple variations by weight — for example, 50/50 between two options — to compare them on live traffic. Rollouts use deterministic bucketing keyed on the subject. The same user lands in the same bucket every time, so their experience stays consistent across evaluations. # Introduction Source: https://docs.softlaunch.so/index Ship features with confidence using real-time feature flags. Softlaunch is a feature flag platform. You wrap new code in a flag, then turn it on, roll it out gradually, or target specific users — all without redeploying. Your SDKs evaluate flags **locally** against a configuration snapshot served from a global CDN, so evaluations are instant and add no network latency to your app. When you change a flag, the update propagates to connected SDKs in real time. ## What you can do Turn features on or off per environment without a deploy. Release to a percentage of users and ramp up with consistent bucketing. Serve different variations to different users based on their attributes. Flag changes reach connected SDKs immediately — no polling required. ## Get started Create your first flag and read it from an SDK in a few minutes. Understand flags, environments, targeting, and how evaluation works. Install a client or server SDK and start evaluating flags. See how configuration flows from the dashboard to your app. # Quickstart Source: https://docs.softlaunch.so/quickstart Create your first flag and evaluate it from an SDK. This guide takes you from zero to a flag you can read in your app. ## Prerequisites * A [Softlaunch account](https://app.softlaunch.so) * Node.js 18 or later for the SDK examples ## Create a flag Open the [dashboard](https://app.softlaunch.so). A new account starts with an organization and two environments, **Production** and **Staging**. Create a flag named `checkout-redesign` with the **boolean** type. Boolean flags return `true` or `false` — the simplest way to gate a feature. 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. ```bash npm theme={null} npm install @softlaunch/react ``` ```bash pnpm theme={null} pnpm add @softlaunch/react ``` ```bash yarn theme={null} yarn add @softlaunch/react ``` Wrap your app in the provider, then read the flag with a hook: ```tsx theme={null} import { SoftlaunchProvider, useBooleanFlag } from "@softlaunch/react"; function App() { return ( ); } 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 ? : ; } ``` ```bash npm theme={null} npm install @softlaunch/js ``` ```bash pnpm theme={null} pnpm add @softlaunch/js ``` ```bash yarn theme={null} yarn add @softlaunch/js ``` Initialize a client, then read the flag: ```ts theme={null} import { init } from "@softlaunch/js"; const client = init({ sdkKey: "slc_..." }); await client.waitUntilReady(); const showRedesign = client.getBooleanFlag( "checkout-redesign", // flag key "user-123", // subject key (a stable user identifier) { plan: "pro" }, // attributes used for targeting false, // default value ); if (showRedesign) { renderNewCheckout(); } ``` ## Next steps Learn about flag types, environments, and targeting. Explore the full SDK API and available methods. # JavaScript Source: https://docs.softlaunch.so/sdks/javascript Add Softlaunch feature flags to any JavaScript app. The JavaScript SDK is a framework-agnostic client for browsers and other JavaScript runtimes. It loads your configuration, evaluates flags locally, and stays subscribed for real-time updates. ## Install ```bash npm theme={null} npm install @softlaunch/js ``` ```bash pnpm theme={null} pnpm add @softlaunch/js ``` ```bash yarn theme={null} yarn add @softlaunch/js ``` ## Initialize Create a client with a [client key](/concepts/environments) (`slc_`). `init` returns immediately and starts loading in the background. ```ts theme={null} import { init } from "@softlaunch/js"; const client = init({ sdkKey: "slc_..." }); ``` Flag reads work right away, returning your default value until the configuration is ready. To wait for the first load, await `waitUntilReady`: ```ts theme={null} await client.waitUntilReady(); ``` ## Read a flag Each [flag type](/concepts/feature-flags) has a method. Pass the flag key, a subject key, attributes, and a default value. ```ts theme={null} const showRedesign = client.getBooleanFlag( "checkout-redesign", "user-123", { plan: "pro" }, false, ); ``` Available methods: * `getBooleanFlag(flagKey, subjectKey, attributes, defaultValue)` * `getStringFlag(flagKey, subjectKey, attributes, defaultValue)` * `getIntegerFlag(flagKey, subjectKey, attributes, defaultValue)` * `getNumericFlag(flagKey, subjectKey, attributes, defaultValue)` * `getJsonFlag(flagKey, subjectKey, attributes, defaultValue)` ## React to changes The client stays subscribed after the first load. Use `subscribe` to run code whenever flag values may have changed — re-read the flags you care about inside the listener. ```ts theme={null} const unsubscribe = client.subscribe(() => { render(client.getBooleanFlag("checkout-redesign", "user-123", { plan: "pro" }, false)); }); // Later, stop listening: unsubscribe(); ``` ## Check status `getStatus` reports the current load state as a discriminated union: ```ts theme={null} const status = client.getStatus(); // { state: "initializing" } // { state: "ready" } // { state: "error", error: string } ``` ## Clean up Call `close` to tear down the subscription and release resources when the client is no longer needed. ```ts theme={null} client.close(); ``` Reads always return a value — your default until the configuration loads, and the resolved variation once it's ready. You never need to guard a read against an unready client. # SDK overview Source: https://docs.softlaunch.so/sdks/overview Choose an SDK and learn the API shared across all of them. Softlaunch SDKs load your configuration snapshot and evaluate flags locally. Pick the SDK that matches where your code runs. ## Client vs. server Run in browsers, mobile apps, and other public clients. Use a **client key** (`slc_`), which serves an obfuscated configuration. Run in trusted backends. Use a **server key** (`sls_`), which reads the full configuration. Keep it secret. ## Available SDKs `@softlaunch/react` — a provider and hooks for React apps. `@softlaunch/js` — a client for any JavaScript runtime. More SDKs are on the way: Coming soon Coming soon Coming soon ## A shared API Every SDK exposes one typed accessor per [flag type](/concepts/feature-flags). The arguments are the same everywhere: ```ts theme={null} getFlag(flagKey, subjectKey, attributes, defaultValue); ``` | Argument | Description | | -------------- | --------------------------------------------------------------- | | `flagKey` | The key of the flag to evaluate. | | `subjectKey` | A stable identifier for the user or entity. | | `attributes` | Key–value attributes used for [targeting](/concepts/targeting). | | `defaultValue` | Returned while loading, or if the flag is missing or mistyped. | The typed accessors are `getBooleanFlag`, `getStringFlag`, `getIntegerFlag`, `getNumericFlag`, and `getJsonFlag` (the React SDK exposes the same set as hooks: `useBooleanFlag`, and so on). SDKs stay subscribed after the first load. When you change a flag, connected SDKs receive the update in real time and re-evaluate. # React Source: https://docs.softlaunch.so/sdks/react Add Softlaunch feature flags to a React app. The React SDK provides a provider and a set of hooks. Flags re-evaluate automatically when your configuration changes, so your components always render the current value. ## Install ```bash npm theme={null} npm install @softlaunch/react ``` ```bash pnpm theme={null} pnpm add @softlaunch/react ``` ```bash yarn theme={null} yarn add @softlaunch/react ``` ## Set up the provider Wrap your app in `SoftlaunchProvider` with a [client key](/concepts/environments) (`slc_`). The provider loads your configuration and keeps it up to date. ```tsx theme={null} import { SoftlaunchProvider } from "@softlaunch/react"; export function App() { return ( ); } ``` ## Read a flag Each [flag type](/concepts/feature-flags) has a hook. Pass the flag key, a subject key, attributes, and a default value. ```tsx theme={null} import { useBooleanFlag } from "@softlaunch/react"; function Checkout() { const { value: showRedesign } = useBooleanFlag( "checkout-redesign", "user-123", { plan: "pro" }, false, ); return showRedesign ? : ; } ``` Available hooks: * `useBooleanFlag(flagKey, subjectKey, attributes, defaultValue)` * `useStringFlag(flagKey, subjectKey, attributes, defaultValue)` * `useIntegerFlag(flagKey, subjectKey, attributes, defaultValue)` * `useNumericFlag(flagKey, subjectKey, attributes, defaultValue)` * `useJsonFlag(flagKey, subjectKey, attributes, defaultValue)` ## The result object Every hook returns the same shape: ```ts theme={null} interface FlagResult { value: T; isLoading: boolean; isFetching: boolean; error: string | undefined; } ``` | Field | Description | | ------------ | ------------------------------------------------------------------------------------------------ | | `value` | The resolved variation, or your default value. | | `isLoading` | `true` during the first load, before any configuration is available. | | `isFetching` | `true` while refreshing in the background. `value` stays usable from the previous configuration. | | `error` | A message if the configuration failed to load, otherwise `undefined`. | ```tsx theme={null} function Banner() { const { value, isLoading } = useStringFlag("banner-message", "user-123", {}, ""); if (isLoading) return null; return value ?
{value}
: null; } ``` Hooks re-render when your configuration updates, so you don't need to poll or refresh. Just read `value`.