---
title: "nuxt-backend/flags"
description: "Every export of nuxt-backend/flags, with its signature and where it is defined."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/flags"
---
# nuxt-backend/flags

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### FlagDefinition

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

One flag, as the app declares it in code.

#### Extends

- `ExperimentShape`

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Overrides
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="default">
        
      </a>
      
       <code>
        default
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Its value for everyone while no override is stored.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="description">
        
      </a>
      
       <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      What it turns on, in a sentence: the admin console shows it.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="by">
        
      </a>
      
       <code>
        by?
      </code>
    </td>
    
    <td>
      <a href="#flagrolloutsubject">
        <code>
          FlagRolloutSubject
        </code>
      </a>
    </td>
    
    <td>
      Who a percentage rollout picks, and who an experiment's variant belongs to. Default <code>
        'user'
      </code>
      
      .
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="variants">
        
      </a>
      
       <code>
        variants?
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Make the flag an experiment: two to four variant names, the control (the version people see today) first. While the flag is on for someone, they get one variant, the same on every read, and the first read records <code>
        experiment.exposed
      </code>
      
      . Read it with <code>
        useExperiment(key)
      </code>
      
       and <code>
        flags.variant(ctx, key)
      </code>
      
      .
    </td>
    
    <td>
      <code>
        ExperimentShape.variants
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="weights">
        
      </a>
      
       <code>
        weights?
      </code>
    </td>
    
    <td>
      readonly <code>
        number
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Each variant's share, in its order: <code>
        [90, 10]
      </code>
      
       sends one in ten to the second. Default: even.
    </td>
    
    <td>
      <code>
        ExperimentShape.weights
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="goal">
        
      </a>
      
       <code>
        goal?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The event kind that counts as a conversion: a package kind (<code>
        billing.subscription_created
      </code>
      
      ) or one of yours (<code>
        app.strip_published
      </code>
      
      ).
    </td>
    
    <td>
      <code>
        ExperimentShape.goal
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="guardrails">
        
      </a>
      
       <code>
        guardrails?
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Event kinds that must not rise in a variant: a refund, a cancellation.
    </td>
    
    <td>
      <code>
        ExperimentShape.guardrails
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discounts">
        
      </a>
      
       <code>
        discounts?
      </code>
    </td>
    
    <td>
      <code>
        Readonly
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >>
    </td>
    
    <td>
      A price test: a variant (not the control) mapped to a public promotion of the billing catalog, shown and applied as that promotion.
    </td>
    
    <td>
      <code>
        ExperimentShape.discounts
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FlagSubject

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

Who a flag is evaluated for: the caller, or a subject a function names.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="userid">
        
      </a>
      
       <code>
        userId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The account.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid">
        
      </a>
      
       <code>
        workspaceId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The workspace it acts in.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="plans">
        
      </a>
      
       <code>
        plans?
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The catalog plan keys its billing entity is on.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### RateInterval

Defined in: [src/convex/funnel-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/funnel-rules.ts)

A rate with its 95% interval.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="rate">
        
      </a>
      
       <code>
        rate
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Conversions over exposures, 0 to 1; 0 with no exposures.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/funnel-rules.ts" rel="nofollow">
        src/convex/funnel-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="low">
        
      </a>
      
       <code>
        low
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The interval's low end.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/funnel-rules.ts" rel="nofollow">
        src/convex/funnel-rules.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="high">
        
      </a>
      
       <code>
        high
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The interval's high end.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/funnel-rules.ts" rel="nofollow">
        src/convex/funnel-rules.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FlagValues

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

Every flag's value for the caller, as `getFlags` answers it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="flags">
        
      </a>
      
       <code>
        flags
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Each flag by key, the app's own and the package's: <code>
        true
      </code>
      
       while it is on for the caller.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="maintenance">
        
      </a>
      
       <code>
        maintenance
      </code>
    </td>
    
    <td>
      | { <code>
        message
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
    </td>
    
    <td>
      The maintenance banner while it is on, with its message (<code>
        ''
      </code>
      
       for the default sentence); <code>
        null
      </code>
      
       while it is off.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="variants-1">
        
      </a>
      
       <code>
        variants
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      Each experiment's variant for the caller, by key: the control while it is off for them or they are signed out, the winner once one is picked.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="running">
        
      </a>
      
       <code>
        running
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The experiments the caller is in right now (running, signed in, exposure still to be recorded or recorded), by key.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discounts-1">
        
      </a>
      
       <code>
        discounts
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      A price test's promotion for the caller, by experiment key: the catalog promotion their variant shows and applies.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ExperimentVariantResult

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

One variant of an experiment, as the Experiments view reads it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="name">
        
      </a>
      
       <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="share">
        
      </a>
      
       <code>
        share
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      Its share of the people, 0 to 1.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="exposed">
        
      </a>
      
       <code>
        exposed
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      The people (or workspaces) exposed to it.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="goal-1">
        
      </a>
      
       <code>
        goal
      </code>
    </td>
    
    <td>
      | { <code>
        count
      </code>
      
      : <code>
        number
      </code>
      
      ; } & <a href="#rateinterval">
        <code>
          RateInterval
        </code>
      </a>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      How many of them reached the goal, and the rate with its 95% interval; <code>
        null
      </code>
      
       without a goal.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="guardrails-1">
        
      </a>
      
       <code>
        guardrails
      </code>
    </td>
    
    <td>
      ({ <code>
        kind
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        count
      </code>
      
      : <code>
        number
      </code>
      
      ; <code>
        worse
      </code>
      
      : <code>
        boolean
      </code>
      
      ; } & <a href="#rateinterval">
        <code>
          RateInterval
        </code>
      </a>
      
      )<span>
        
      </span>
    </td>
    
    <td>
      Each guardrail's count and rate, marked <code>
        worse
      </code>
      
       when it sits above the control's.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="discount">
        
      </a>
      
       <code>
        discount
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The price test's promotion it shows, when it is one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ExperimentResult

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

One experiment's results.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="key">
        
      </a>
      
       <code>
        key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="description-1">
        
      </a>
      
       <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="goal-2">
        
      </a>
      
       <code>
        goal
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The goal kind; <code>
        null
      </code>
      
       without one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="guardrails-2">
        
      </a>
      
       <code>
        guardrails
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="by-1">
        
      </a>
      
       <code>
        by
      </code>
    </td>
    
    <td>
      <a href="#flagrolloutsubject">
        <code>
          FlagRolloutSubject
        </code>
      </a>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="running-1">
        
      </a>
      
       <code>
        running
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether it runs now: its flag is on (for everyone or some) and no winner is picked.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="winner">
        
      </a>
      
       <code>
        winner
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The variant everyone sees since an administrator picked it; <code>
        null
      </code>
      
       while none is.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="override">
        
      </a>
      
       <code>
        override
      </code>
    </td>
    
    <td>
      | <a href="https://nuxt-backend.dev/docs/reference/api/use-flags#flagoverride">
        <code>
          FlagOverride
        </code>
      </a>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      The flag's stored override, which picking a winner keeps the rest of; <code>
        null
      </code>
      
       while it holds its default.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="startedat">
        
      </a>
      
       <code>
        startedAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      When it first exposed someone, epoch ms; <code>
        null
      </code>
      
       before. How long it has run is counted from it where it is shown.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="variants-2">
        
      </a>
      
       <code>
        variants
      </code>
    </td>
    
    <td>
      <a href="#experimentvariantresult">
        <code>
          ExperimentVariantResult
        </code>
      </a>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The variants, the control first.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="verdict">
        
      </a>
      
       <code>
        verdict
      </code>
    </td>
    
    <td>
      <a href="#experimentverdict">
        <code>
          ExperimentVerdict
        </code>
      </a>
    </td>
    
    <td>
      What the results say: too few exposures, no difference, or a variant leading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### AdminFlag

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

One flag as the admin console lists it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="key-1">
        
      </a>
      
       <code>
        key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="description-2">
        
      </a>
      
       <code>
        description
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      What it turns on.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="builtin">
        
      </a>
      
       <code>
        builtIn
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      One of the package's own: a kill switch, or the maintenance banner. It is on or off for everyone.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="default-1">
        
      </a>
      
       <code>
        default
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Its value for everyone while no override is stored.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="by-2">
        
      </a>
      
       <code>
        by
      </code>
    </td>
    
    <td>
      <a href="#flagrolloutsubject">
        <code>
          FlagRolloutSubject
        </code>
      </a>
    </td>
    
    <td>
      Who a percentage rollout picks.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="declared">
        
      </a>
      
       <code>
        declared
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether the code declares it (or it is one of the package's own). <code>
        false
      </code>
      
       for an override left behind by a flag the code no longer declares: it turns nothing on, and <code>
        setFlag(key, null)
      </code>
      
       removes it, so a flag declared again under the key starts from its default.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="override-1">
        
      </a>
      
       <code>
        override
      </code>
    </td>
    
    <td>
      | <a href="https://nuxt-backend.dev/docs/reference/api/use-flags#flagoverride">
        <code>
          FlagOverride
        </code>
      </a>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      What an administrator stored, or <code>
        null
      </code>
      
       while it holds its default.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="updatedat">
        
      </a>
      
       <code>
        updatedAt
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      When the override was stored, epoch ms; <code>
        null
      </code>
      
       without one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FlagsApi

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

The public functions `backend/flags.ts` re-exports.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="getflags">
        
      </a>
      
       <code>
        getFlags
      </code>
    </td>
    
    <td>
      <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        Promise
      </code>
      
      <<a href="#flagvalues">
        <code>
          FlagValues
        </code>
      </a>
      
      >>
    </td>
    
    <td>
      Every flag's value for the caller, and the maintenance banner. Anyone may read it, signed in or not.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="listflags">
        
      </a>
      
       <code>
        listFlags
      </code>
    </td>
    
    <td>
      <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        Promise
      </code>
      
      <<a href="#adminflag">
        <code>
          AdminFlag
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      Every flag with its default and its override, the package's own first, then the app's, then overrides of flags the code no longer declares. <code>
        null
      </code>
      
       for anyone who is not an administrator now.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="setflag">
        
      </a>
      
       <code>
        setFlag
      </code>
    </td>
    
    <td>
      <code>
        RegisteredMutation
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        override
      </code>
      
      : | <a href="https://nuxt-backend.dev/docs/reference/api/use-flags#flagoverride">
        <code>
          FlagOverride
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      <<code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      Store a flag's override, or remove it with <code>
        null
      </code>
      
       so the flag holds its default: any stored override, a flag the code no longer declares included. An administrator's, in person, with a recent sign-in.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="exposeexperiment">
        
      </a>
      
       <code>
        exposeExperiment
      </code>
    </td>
    
    <td>
      <code>
        RegisteredMutation
      </code>
      
      <<code>
        "public"
      </code>
      
      , { <code>
        key
      </code>
      
      : <code>
        string
      </code>
      
      ; }, <code>
        Promise
      </code>
      
      < | { <code>
        variant
      </code>
      
      : <code>
        string
      </code>
      
      ; } | <code>
        null
      </code>
      
      >>
    </td>
    
    <td>
      The caller's variant of an experiment, recording their exposure the first time a running one shows them a variant: what <code>
        useExperiment
      </code>
      
       calls once its read shows the experiment runs for them. <code>
        null
      </code>
      
       for a key without variants.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="getexperiments">
        
      </a>
      
       <code>
        getExperiments
      </code>
    </td>
    
    <td>
      <code>
        RegisteredQuery
      </code>
      
      <<code>
        "public"
      </code>
      
      , <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        never
      </code>
      
      >, <code>
        Promise
      </code>
      
      <<a href="#experimentresult">
        <code>
          ExperimentResult
        </code>
      </a>
      
      <span>
        
      </span>
      
      >>
    </td>
    
    <td>
      Every experiment the code declares, with its results per variant. Refused as <code>
        forbidden
      </code>
      
       (<code>
        admin_only
      </code>
      
      ) for anyone who is not an administrator.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FlagCtx

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

A context a flag is read in: any query, mutation or action.

#### Extended by

- [`FlagWriteCtx`](#flagwritectx)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="runquery">
        
      </a>
      
       <code>
        runQuery
      </code>
    </td>
    
    <td>
      <<code>
        Query
      </code>
      
      >(<code>
        query
      </code>
      
      , ...<code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        FunctionReturnType
      </code>
      
      <<code>
        Query
      </code>
      
      >>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="auth">
        
      </a>
      
       <code>
        auth
      </code>
    </td>
    
    <td>
      <code>
        Auth
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FlagWriteCtx

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

A context that records an exposure: a mutation or an action.

#### Extends

- [`FlagCtx`](#flagctx)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="runquery-1">
        
      </a>
      
       <code>
        runQuery
      </code>
    </td>
    
    <td>
      <<code>
        Query
      </code>
      
      >(<code>
        query
      </code>
      
      , ...<code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        FunctionReturnType
      </code>
      
      <<code>
        Query
      </code>
      
      >>
    </td>
    
    <td>
      <a href="#flagctx">
        <code>
          FlagCtx
        </code>
      </a>
      
      .<a href="#runquery">
        <code>
          runQuery
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="auth-1">
        
      </a>
      
       <code>
        auth
      </code>
    </td>
    
    <td>
      <code>
        Auth
      </code>
    </td>
    
    <td>
      <a href="#flagctx">
        <code>
          FlagCtx
        </code>
      </a>
      
      .<a href="#auth">
        <code>
          auth
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="runmutation">
        
      </a>
      
       <code>
        runMutation
      </code>
    </td>
    
    <td>
      <<code>
        Mutation
      </code>
      
      >(<code>
        mutation
      </code>
      
      , ...<code>
        args
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        FunctionReturnType
      </code>
      
      <<code>
        Mutation
      </code>
      
      >>
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### Flags

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

The app's flags, from [setupFlags](#setupflags).

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
    
    <th>
      Default type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-f">
        
      </a>
      
       <code>
        F
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#flagdefinitions">
        <code>
          FlagDefinitions
        </code>
      </a>
    </td>
    
    <td>
      <a href="#flagdefinitions">
        <code>
          FlagDefinitions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="definitions">
        
      </a>
      
       <code>
        definitions
      </code>
    </td>
    
    <td>
      <code>
        F
      </code>
    </td>
    
    <td>
      The flags as declared.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isenabled">
        
      </a>
      
       <code>
        isEnabled
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        key
      </code>
      
      , <code>
        subject?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Whether a flag is on: for the caller (its account, its active workspace and the plans its billing entity is on), or for the <code>
        subject
      </code>
      
       you name, such as in a webhook or a job. One of the package's own flags reads as on while its switch is.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="requireflag">
        
      </a>
      
       <code>
        requireFlag
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        key
      </code>
      
      , <code>
        subject?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Refuse the call unless the flag is on for the caller (or <code>
        subject
      </code>
      
      ): <code>
        forbidden
      </code>
      
      , reason <code>
        flag_off
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="variant">
        
      </a>
      
       <code>
        variant
      </code>
    </td>
    
    <td>
      (<code>
        ctx
      </code>
      
      , <code>
        key
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The caller's variant of an experiment, in a mutation or an action of yours, recording <code>
        experiment.exposed
      </code>
      
       the first time a running experiment shows them one, exactly as <code>
        useExperiment
      </code>
      
       does in a page: both hash the same key and id. The control for a flag that is off for them and for nobody signed in; <code>
        undefined
      </code>
      
       for a key without variants. An administrator's visit reads the variant and records nothing.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="api">
        
      </a>
      
       <code>
        api
      </code>
    </td>
    
    <td>
      <a href="#flagsapi">
        <code>
          FlagsApi
        </code>
      </a>
    </td>
    
    <td>
      The public functions <code>
        backend/flags.ts
      </code>
      
       re-exports.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SetupFlagsOptions

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-f-1">
        
      </a>
      
       <code>
        F
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#flagdefinitions">
        <code>
          FlagDefinitions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="flags-2">
        
      </a>
      
       <code>
        flags
      </code>
    </td>
    
    <td>
      <code>
        F
      </code>
    </td>
    
    <td>
      The app's flags, from <code>
        defineFlags
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="audit">
        
      </a>
      
       <code>
        audit
      </code>
    </td>
    
    <td>
      <code>
        Pick
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/audit#audit">
        <code>
          Audit
        </code>
      </a>
      
      , <code>
        "recordBackendEvent"
      </code>
      
      >
    </td>
    
    <td>
      The app's audit trail: every change is recorded on it as <code>
        flag.changed
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="billing">
        
      </a>
      
       <code>
        billing?
      </code>
    </td>
    
    <td>
      <code>
        Pick
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/billing#billing">
        <code>
          Billing
        </code>
      </a>
      
      , <code>
        "activePlans"
      </code>
      
      >
    </td>
    
    <td>
      The app's billing: a flag's plan targets match the plans the caller's billing entity is on. Without it, none do.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="adminroles">
        
      </a>
      
       <code>
        adminRoles?
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      The app-wide roles that read and change flags, read fresh. Default <code>
        ['admin']
      </code>
      
      : pass the same as <code>
        setupAdmin
      </code>
      
       and <code>
        setupAuth({ admin })
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="adminuserids">
        
      </a>
      
       <code>
        adminUserIds?
      </code>
    </td>
    
    <td>
      readonly <code>
        string
      </code>
      
      <span>
        
      </span>
    </td>
    
    <td>
      Accounts that read and change flags whatever their role, by id: pass the same as <code>
        setupAdmin
      </code>
      
       and <code>
        setupAuth({ admin })
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### FlagsComponents

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

The `backend` component as flags read it.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="backend">
        
      </a>
      
       <code>
        backend
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts" rel="nofollow">
        src/convex/integrations/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### FlagRolloutSubject

```ts
type FlagRolloutSubject = "user" | "workspace";
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

Who a percentage rollout picks: each account, or each workspace (its members all see the same).

---

### FlagDefinitions

```ts
type FlagDefinitions = Record<string, FlagDefinition>;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

The flags an app declares, by key.

---

### PausableService

```ts
type PausableService = "signups" | "checkout" | "ai";
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

A service a kill switch pauses.

---

### BackendFlag

```ts
type BackendFlag = keyof typeof BACKEND_FLAGS;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

One of the package's own flags.

---

### ExperimentVerdict

```ts
type ExperimentVerdict = 
  | {
  kind: "too_few";
}
  | {
  kind: "no_difference";
}
  | {
  kind: "leading";
  leader: string;
};
```

Defined in: [src/convex/funnel-rules.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/funnel-rules.ts)

What the results say, for the console:

- `too_few`: some variant has fewer than 100 exposures, or the experiment has no goal;
- `no_difference`: every interval overlaps the control's;
- `leading`: the `leader`'s interval is clear of the control's.

## Variables

### FLAG_TARGETS_MAX

```ts
const FLAG_TARGETS_MAX: 100 = 100;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

The most ids (or plan keys) one target list of an override names.

---

### MAINTENANCE_MESSAGE_MAX

```ts
const MAINTENANCE_MESSAGE_MAX: 280 = 280;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

The longest maintenance message, in characters.

---

### ROLLOUT_BUCKETS

```ts
const ROLLOUT_BUCKETS: 10000 = 10_000;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

How finely a rollout is cut: a subject's bucket is one of this many, so a rollout takes hundredths of a percent.

---

### BACKEND_FLAGS

```ts
const BACKEND_FLAGS: {
  pause_signups: {
     description: "New accounts are refused, invited and administrator-created ones included, before a sign-in code is sent; existing accounts sign in as before.";
     pauses: "signups";
  };
  pause_checkout: {
     description: "New checkouts, plan switches and gift purchases are refused; running plans, cancelling, the billing portal and gift claims keep working.";
     pauses: "checkout";
  };
  pause_ai: {
     description: "Metered model calls and streams are refused before any credits are reserved.";
     pauses: "ai";
  };
  maintenance: {
     description: "A banner with your message shows on every page, after an administrator's visit and before announcements.";
  };
};
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

The package's own flags, which the package itself honors: three kill
switches and the maintenance banner. Each is off until an administrator
turns it on, takes no targets or rollout, and is turned on and off from
the admin console like any flag.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default value
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="property-pause_signups">
        
      </a>
      
       <code>
        pause_signups
      </code>
    </td>
    
    <td>
      { <code>
        description
      </code>
      
      : <code>
        "New accounts are refused, invited and administrator-created ones included, before a sign-in code is sent; existing accounts sign in as before."
      </code>
      
      ; <code>
        pauses
      </code>
      
      : <code>
        "signups"
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause_signups.description
      </code>
    </td>
    
    <td>
      <code>
        "New accounts are refused, invited and administrator-created ones included, before a sign-in code is sent; existing accounts sign in as before."
      </code>
    </td>
    
    <td>
      <code>
        'New accounts are refused, invited and administrator-created ones included, before a sign-in code is sent; existing accounts sign in as before.'
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause_signups.pauses
      </code>
    </td>
    
    <td>
      <code>
        "signups"
      </code>
    </td>
    
    <td>
      <code>
        'signups'
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-pause_checkout">
        
      </a>
      
       <code>
        pause_checkout
      </code>
    </td>
    
    <td>
      { <code>
        description
      </code>
      
      : <code>
        "New checkouts, plan switches and gift purchases are refused; running plans, cancelling, the billing portal and gift claims keep working."
      </code>
      
      ; <code>
        pauses
      </code>
      
      : <code>
        "checkout"
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause_checkout.description
      </code>
    </td>
    
    <td>
      <code>
        "New checkouts, plan switches and gift purchases are refused; running plans, cancelling, the billing portal and gift claims keep working."
      </code>
    </td>
    
    <td>
      <code>
        'New checkouts, plan switches and gift purchases are refused; running plans, cancelling, the billing portal and gift claims keep working.'
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause_checkout.pauses
      </code>
    </td>
    
    <td>
      <code>
        "checkout"
      </code>
    </td>
    
    <td>
      <code>
        'checkout'
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-pause_ai">
        
      </a>
      
       <code>
        pause_ai
      </code>
    </td>
    
    <td>
      { <code>
        description
      </code>
      
      : <code>
        "Metered model calls and streams are refused before any credits are reserved."
      </code>
      
      ; <code>
        pauses
      </code>
      
      : <code>
        "ai"
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause_ai.description
      </code>
    </td>
    
    <td>
      <code>
        "Metered model calls and streams are refused before any credits are reserved."
      </code>
    </td>
    
    <td>
      <code>
        'Metered model calls and streams are refused before any credits are reserved.'
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        pause_ai.pauses
      </code>
    </td>
    
    <td>
      <code>
        "ai"
      </code>
    </td>
    
    <td>
      <code>
        'ai'
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-maintenance">
        
      </a>
      
       <code>
        maintenance
      </code>
    </td>
    
    <td>
      { <code>
        description
      </code>
      
      : <code>
        "A banner with your message shows on every page, after an administrator's visit and before announcements."
      </code>
      
      ; }
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        maintenance.description
      </code>
    </td>
    
    <td>
      <code>
        "A banner with your message shows on every page, after an administrator's visit and before announcements."
      </code>
    </td>
    
    <td>
      'A banner with your message shows on every page, after an administrator\'s visit and before announcements.'
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts" rel="nofollow">
        src/convex/flags.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### defineFlags()

```ts
function defineFlags<T>(flags): T;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

Declare the app's flags: each key with its default and what it turns on.
Returned as given, typed, so `isEnabled` and `requireFlag` take only
these keys. A key is a lower-case letter, then letters, digits and
underscores, at most 64 characters, none of the package's own, and
never starting with `pause_` or `backend_`, which the package keeps for
flags it may add.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-t">
        
      </a>
      
       <code>
        T
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#flagdefinitions">
        <code>
          FlagDefinitions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        flags
      </code>
    </td>
    
    <td>
      <code>
        T
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`T`

#### Example

```ts
const definitions = defineFlags({
  newEditor: { default: false, description: 'The rewritten editor.' },
  teamInvites: { default: true, description: 'Inviting people to a workspace.', by: 'workspace' },
})
```

---

### flagBucket()

```ts
function flagBucket(key, subjectId): number;
```

Defined in: [src/convex/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/flags.ts)

A subject's bucket for a flag, from 0 to [ROLLOUT_BUCKETS](#rollout_buckets) − 1: a
32-bit FNV-1a hash of the flag's key and the subject's id, mixed by
MurmurHash3's finalizer. The same key and id give the same bucket in every
runtime, every time; another flag gives the same subject an unrelated one,
so two 10% rollouts do not pick the same 10%.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        subjectId
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`number`

---

### setupFlags()

```ts
function setupFlags<F>(components, options): Flags<F>;
```

Defined in: [src/convex/integrations/flags.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/flags.ts)

Feature flags, evaluated inside your own queries and mutations, and the
package's kill switches. Declare the flags in code with `defineFlags`;
an administrator overrides them from the admin console (`/admin`, the
Flags tab): on or off for everyone, or, while off, on for named accounts,
named workspaces, the plans a billing entity is on, and a percentage of
accounts or workspaces picked by a stable hash. Every change takes a
recent sign-in and is recorded on the audit trail as `flag.changed`.

The package's own flags are always there: `pause_signups`,
`pause_checkout` and `pause_ai`, which the package honors where those
calls run (refused as `unavailable`, reason `<service>_paused`), and
`maintenance`, a banner with your message on every page.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="type-parameter-f-2">
        
      </a>
      
       <code>
        F
      </code>
      
       <em>
        extends
      </em>
      
       <a href="#flagdefinitions">
        <code>
          FlagDefinitions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        components
      </code>
    </td>
    
    <td>
      <a href="#flagscomponents">
        <code>
          FlagsComponents
        </code>
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="#setupflagsoptions">
        <code>
          SetupFlagsOptions
        </code>
      </a>
      
      <<code>
        F
      </code>
      
      >
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`Flags`](#flags-1)<`F`>

#### Example

```ts [backend/flags.ts]
import { defineFlags, setupFlags } from 'nuxt-backend/flags'
import { components } from './_generated/api'
import { audit } from './audit'
import { billing } from './billing'

export const flags = setupFlags(components, {
  flags: defineFlags({
    newEditor: { default: false, description: 'The rewritten editor.' },
  }),
  audit,
  billing,
})

export const { getFlags, listFlags, setFlag, exposeExperiment, getExperiments } = flags.api
```

## References

### FlagOverride

Re-exports [FlagOverride](https://nuxt-backend.dev/docs/reference/api/use-flags#flagoverride)


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
