FlagrshipGuidesReference
esc

Quickstart

Install the CLI, create a flag, add a few lines to your app, and watch it flip. About five minutes.

Install the CLI

$ npm install -g @flagrship/cli
$ flagrship --version
0.0.1

Point it at your environment

You need an API key for one environment. Keys are scoped to a single environment on the server, so a staging key can never read production. init verifies the key against the API and learns which environment it belongs to.

$ flagrship init --key sk_test_your_staging_key
✓ Saved staging key to /your/project/.flagrship.json
✓ Added .flagrship.json to .gitignore
Default environment: staging

Create a flag

A new flag exists in every environment at once, disabled and at 0%. Nothing changes for anyone yet.

$ flagrship create new-checkout --description "Rewritten checkout flow"
✓ Created new-checkout in staging — OFF

Add the SDK to your app

The SDK fetches config once at boot, then polls. Every isEnabled call after that is an in-memory lookup. Use a read-scoped key here; it cannot change anything if it leaks.

$ npm install @flagrship/sdk
app.ts
1import { Flagrship } from '@flagrship/sdk';
2 
3const flags = new Flagrship({
4 apiKey: process.env.FLAGRSHIP_KEY,
5});
6await flags.ready();
7 
8if (flags.isEnabled('new-checkout', user.id)) {
9 showNewCheckout();
10}
$ pip install flagrship-sdk
app.py
1from flagrship import Flagrship
2 
3flags = Flagrship(api_key=os.environ["FLAGRSHIP_KEY"])
4flags.ready()
5 
6if flags.is_enabled("new-checkout", user.id):
7 show_new_checkout()

Roll it out

Enable the flag, then set a percentage. Users are hashed into 100 buckets; a user is on when their bucket is below the percentage. The same user always gets the same answer.

$ flagrship enable new-checkout
✓ Enabled new-checkout in staging — ON 0%
$ flagrship rollout new-checkout 25
✓ Rolled out new-checkout in staging — ON 25%

Within one poll (30 seconds by default) every running instance of your app sees the change.

Roll it back

rollback undoes the most recent change. It is an undo, not a revert to some saved state: run it twice and you are back where you started.

$ flagrship rollback new-checkout
✓ Rolled back new-checkout in staging — ON 0%

See who did what

$ flagrship log new-checkout
WHEN ACTION CHANGE BY
8s ago rollback 25% -> 0% you@example.com via api_key
21s ago rollout 0% -> 25% you@example.com via api_key
30s ago enabled off -> 0% you@example.com via api_key
1m ago created created as "New Checkout" you@example.com via api_key

That is the whole loop. From here:

  • Concepts explains environments, bucketing, and why rollback is an undo.
  • CLI reference has every command and flag.
  • HTTP API if you want to call it from CI or a script.
Flagrship · Ship without a release.