Environments
Environments let you manage flag states independently across different stages of your deployment pipeline. A flag can be enabled in development, disabled in staging, and gradually rolling out in production — all at the same time.
Default environments
Every Flagify project comes with three environments:
| Environment | Purpose |
|---|---|
development | Local development and testing |
staging | Pre-production validation |
production | Live user traffic |
You can create additional environments to match your workflow (e.g., preview, canary).
How environments work
Each environment has its own:
- Flag state — enabled or disabled
- Targeting rules — different rules per environment
- API key pair — a publishable key (
pk_dev_...) and secret key (sk_dev_...)
The environment is determined by the API key you use to initialize the SDK:
const flagify = new Flagify({
projectKey: 'my-project',
publicKey: process.env.FLAGIFY_PUBLIC_KEY, // e.g. pk_prod_abc123_xxx
});
The key prefix indicates the environment: pk_dev_ for development, pk_staging_ for staging, pk_prod_ for production.
Promoting changes
A common workflow is to configure and test a flag in development, then promote its configuration to staging, and finally to production.
Flagify supports this with environment promotion:
- Configure and test in
development - Promote the configuration to
staging - Validate in staging
- Promote to
production
Promotion copies the flag’s enabled state, value override, and rollout percentage from one environment to another.
# Via CLI (coming soon) or API
# POST /v1/flag-environments/{sourceId}/promote
Environment-specific API keys
Each environment has its own API key pair (publishable + secret). This ensures:
- Development cannot accidentally read production flag states
- Staging changes do not affect production
- Each environment is fully isolated
Generate and manage keys via the CLI:
flagify keys generate -p my-project -e production
flagify keys list -p my-project -e production
flagify keys revoke -p my-project -e staging