Quick Start

Evaluate your first feature flag in under 5 minutes.

Prerequisites

  • A Flagify account with an API key
  • Node.js 18+ installed
  • @flagify/node installed in your project (Installation guide)

1. Create a flag

Create a boolean flag via the CLI:

flagify flags create new-onboarding --type boolean

Then enable it for development:

flagify flags toggle new-onboarding -e development

2. Initialize the client and evaluate

import { Flagify } from '@flagify/node';

// Initialize with your project key and publishable API key
const flagify = new Flagify({
  projectKey: 'my-project',
  publicKey: process.env.FLAGIFY_PUBLIC_KEY!, // e.g. pk_dev_abc123_xxx
  options: {
    realtime: true,
  },
});

// Wait for initial flag sync
await flagify.ready();

// Evaluate the flag
const showNewOnboarding = flagify.isEnabled('new-onboarding');

if (showNewOnboarding) {
  renderNewOnboarding();
} else {
  renderClassicOnboarding();
}

That’s it — you have a working feature flag. The code above will return true because the flag is enabled and its defaultValue is true in the development environment (determined by the pk_dev_ key prefix). The enabled state controls whether targeting rules are evaluated — the actual value comes from defaultValue (when enabled, no match) or offValue (when disabled) or a matching targeting rule.

3. Add targeting (optional)

You can refine who sees a feature by adding targeting rules. Add a rule to only show new-onboarding to users on the pro plan:

AttributeOperatorValue
planequalspro

Now the flag evaluates to true for pro users (via the targeting rule’s valueOverride). Everyone else gets the flag’s defaultValue — the fallthrough value when no targeting rule matches.

What’s next