Publishing
Feature Flags keeps your code declaration as the source of truth, then publishes the current snapshot for runtime reads.
Publish a snapshot
Section titled “Publish a snapshot”await flags.publish({ environment: "prod", message: "Enable checkout v2 for tenant_acme",})Publish after you update the code declaration or after you confirm a staged rollout.
What publish does
Section titled “What publish does”Publishing makes the current flag set available for runtime reads and records the release as part of the product history.
Use publish when you want to:
- push a new default
- apply a new environment value
- freeze a tenant or user rollout
- record a rollout milestone
- prepare a rollback point
Inspect published state
Section titled “Inspect published state”Use read(...) to see the snapshot currently used by runtime evaluation:
const state = await flags.read({ environment: "prod",})Use history(...) to list recent publishes and rollbacks:
const history = await flags.history({ environment: "prod", limit: 20,})Inspect a decision
Section titled “Inspect a decision”const decision = await flags.evaluate("checkoutV2", { environment: "prod", tenantId: tenant.id, userId: user.id,})The decision includes:
- the selected value
- the winning reason
- the matched rule ID, when present
- the snapshot version
Roll back
Section titled “Roll back”Roll back to a published checksum when you need an immediate restore:
await flags.rollback({ environment: "prod", checksum: history.items[0].checksum, message: "Restore previous checkout rollout",})For a long-lived change, update the code declaration after the rollback and publish again.
That keeps the rollout history readable in your source and in deployment records.
Keep audit on when you want a clear record of who changed what and when. Feature Flags records publish-friendly history for the flag set, which makes it easy to review releases later.
Feature Flags stores snapshots through the Storage product and records publish, rollback, and audit state through the Database product.