Getting Started

Evaluate Your First Flag

2 min read

Evaluating a flag is the process of fetching the active flag configuration and resolving its status based on the current user context.

SDK Evaluation Pattern

After installing the SDK, import the client, initialize it with your API key, and call the evaluation logic:

index.ts
import { FlagPilot } from '@flagpilot/node';

const flagpilot = new FlagPilot({
  apiKey: process.env.FLAGPILOT_SECRET_KEY,
  environment: 'production'
});

const isEnabled = await flagpilot.evaluate('checkout-redesign', {
  userId: 'user_123'
});

Targeting Context Requirements

Always provide a unique, non-changing identifier like userId in the evaluation context. It is used to sticky-group users for consistent percentage rollout splits.

Offline Safe Fail-Open

If the SDK cannot reach the API (network failure, or the flag key isn't found in the local cache), evaluations fail open safely and return false (or your configured bootstrap fallback value, if provided), ensuring your site remains responsive.

FAQ

How does Evaluate Your First Flag interact with local caches?

Configurations are synced down using Edge Config or fallback REST triggers. The client automatically reads evaluations in-memory, resulting in sub-millisecond local evaluation times.

Where can I obtain support for Evaluate Your First Flag?

You can open a support ticket in your dashboard, check the community roadmap, or consult the FlagPilot Platform Status page.

Was this page helpful?