> ## Documentation Index
> Fetch the complete documentation index at: https://docs.westyx.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Feature Flags

> Boolean flags with scheduling, A/B rollout, and targeting rules.

## What are feature flags?

Feature flags let you toggle behaviour in your application without a deployment. Nexus flags support:

* **Boolean on/off** - the simplest use case
* **Scheduling** - automatically enable or disable at a specified time (`starts_at` / `ends_at`)
* **A/B rollout** - enable for a percentage of users with optional targeting rules
* **Live push** - changes propagate to connected SDK instances within milliseconds

## Reading flags

All SDKs expose a `GetFlag` / `getFlag` / `get_flag` method that returns a boolean with a default fallback if the flag is not found.

<CodeGroup>
  ```go Go theme={null}
  enabled := client.GetFlag("new.checkout", false)
  ```

  ```typescript Node.js theme={null}
  const enabled = client.getFlag('new-checkout', false);
  ```

  ```python Python theme={null}
  enabled = client.get_flag('new-checkout', False)
  ```

  ```typescript Angular / React / Vue theme={null}
  const enabled = nexus.getFlag('new-checkout', false);
  ```
</CodeGroup>

## A/B rollout

The **AB Testing add-on** (available on `s` tier and above) enables percentage-based rollout with optional targeting rules.

Use `evaluateAB` to evaluate multiple flags at once for a specific user:

<CodeGroup>
  ```go Go theme={null}
  results, err := client.EvaluateAB(ctx, []string{"checkout-v2", "new-sidebar"}, userID, map[string]string{
      "plan": "pro",
      "country": "HU",
  })
  ```

  ```typescript Node.js theme={null}
  const results = await client.evaluateAB(
    ['checkout-v2', 'new-sidebar'],
    userID,
    { plan: 'pro', country: 'HU' },
  );
  ```

  ```python Python theme={null}
  results = await client.evaluate_ab(
      keys=['checkout-v2', 'new-sidebar'],
      user_id=user_id,
      attributes={'plan': 'pro', 'country': 'HU'},
  )
  ```
</CodeGroup>

`evaluateAB` returns `{ "checkout-v2": true, "new-sidebar": false }` - stable for the same `userID` across calls (FNV-64 bucket).

<Note>
  A/B Testing requires the **AB Testing add-on** to be active on the project. A `403` response with `ab_addon_not_active` indicates the add-on is not enabled.
</Note>

## Scheduling

Flags can be scheduled to turn on or off automatically:

* **`starts_at`** - enable the flag at this UTC timestamp
* **`ends_at`** - disable the flag at this UTC timestamp

The schedule is enforced server-side; the SDK always returns the current state.

## Key names

Flag keys follow the same pattern as secrets and configs: `^[a-zA-Z]([a-zA-Z0-9_.:-]*[a-zA-Z0-9])?$`

## Targeting rules

When the AB Testing add-on is active, you can configure JSONB targeting rules on a flag. Rules are evaluated by the server during `evaluateAB`. Supported operators include `eq`, `in`, `gt`, `lt`, and `contains`.

## Live updates

Flag changes pushed from the console are delivered to connected SDK clients within milliseconds via SSE. See [Quickstart → Enable live updates](/quickstart#4-enable-live-updates-recommended).
