Feature switches

A feature switch (feature flag) lets you ship code switched off, then turn it on for a few users, then for everyone. Switches also run tests. Open Build › Feature switches.

Feature switches. The demo workspace, with sample data.

Read switches in your code#

Your product's tracking code reads its switches and decides per visitor, with no GitHub needed: useFlag in a client component, or getFlag on the server, without flicker. This needs MRRocket's tracking code 0.3.0 or later; until then the page shows how to add it.

How it works#

  1. Create a switch#

    New switch: a key, a name, a product and a type. Your code reads the key.

  2. Set who gets it#

    Open the switch. Under release conditions, add condition sets: each filters by property, operator and value, with a share in Roll out to. Production and Preview each have their own conditions.

  3. Switch it on#

    The toggle in the Production column. A change to Preview applies at once. A change to Production becomes a request in Needs you unless you apply it yourself.

  4. Variants#

    Variants have a key and a JSON payload your code reads.

  5. Add guardrails#

    Add guardrail picks a number to watch, such as error rate, crash-free sessions, refund rate, checkout conversion or load time. When it crosses its line, the switch shows Breached and a rollback is prepared for you.

Filter and clean up#

Tabs: All, Active, Experiments, Stale and Archived. A row's menu has Archive and Restore. The switch's page keeps its history and links the pull request, issue and test tied to it.

What the agent does for you#

Bo suggests rolling a switch further out, back, or away when it has been unchanged for 30 days, and prepares a rollback when a guardrail is breached.