ToggleFleet Sign in Start free
Documentation

Ship behind a flag in five minutes.

Create a flag in the dashboard, grab your environment's SDK key, and check it with one method call. The gem evaluates locally — no network on the hot path — and the same logic is available as a plain REST API for any language.

1 · Install

Add the gem

The SDK is open source (MIT) and published on RubyGems.

Gemfile
gem "togglefleet"

Then bundle install. Source & issues: github.com/takeaseatventure/togglefleet-ruby.

2 · Configure

One initializer

Each environment (Production, Staging, Development, or any custom one) has its own SDK key, found under Settings → SDK keys in the dashboard.

config/initializers/togglefleet.rb
ToggleFleet.configure do |c|
  c.sdk_key          = ENV["TOGGLEFLEET_SDK_KEY"]
  c.refresh_interval = 15     # seconds between background refreshes
  c.default          = false  # fail-safe value for unknown flags
end

# groups are decided in YOUR code
ToggleFleet.register_group(:admins)   { |u| u.admin? }
ToggleFleet.register_group(:internal) { |u| u.email.end_with?("@yourco.com") }

ToggleFleet.start  # initial fetch + background refresh thread

Then check a flag anywhere — this never blocks on the network:

app
if ToggleFleet.enabled?(:checkout_v2, actor: current_user)
  render "checkout/v2"
end

3 · The gates

A flag is on if any gate matches

Evaluated in order — the first match wins. Set any of them per environment in the dashboard.

GateSet it to…Effect
BooleanFully onon for everyone
Actora list of actor IDson for those specific actors
Groupgroup nameson for actors your registered predicate matches
% of actors0–100sticky — the same actors keep it as you ramp
% of time0–100random per call

4 · Actors & groups

What counts as an actor

An actor is anything you flag on. The gem derives a stable id: actor.togglefleet_id if defined, else actor.id (works for ActiveRecord out of the box), else the value itself.

examples
ToggleFleet.enabled?(:beta, actor: current_user)   # uses current_user.id
ToggleFleet.enabled?(:beta, actor: "account_42")   # a plain string id
ToggleFleet.enabled?(:beta, actor: user, groups: [:eu])  # explicit groups too
ToggleFleet.all(actor: current_user)               # { "checkout_v2" => true, ... }

5 · REST API

Any language

No Ruby? Authenticate with an environment's SDK key and call the API directly.

GET /v1/evaluate

Server-side check for one flag. Pass groups when you need the group gate (group membership is otherwise resolved in your app).

evaluate one flag
curl https://togglefleet.com/v1/evaluate \
  -H "Authorization: Bearer tf_…" \
  -G --data-urlencode "flag=checkout_v2" \
     --data-urlencode "actor=dave"

# → { "flag": "checkout_v2", "enabled": true }

GET /v1/config

The whole environment, so you can cache and evaluate locally (this is what the gem does).

pull the environment
curl https://togglefleet.com/v1/config -H "Authorization: Bearer tf_…"

# → { "flags": { "checkout_v2": { "boolean": false,
#       "percentage_of_actors": 25, "percentage_of_time": 0,
#       "actors": ["dave"], "groups": ["admins"], "id": "…" } } }

Percentage bucketing is byte-identical between the gem and the API, so a sticky rollout is consistent however you evaluate it.

Reliability

Built to stay up