Skip to content

Publishing

Feature Flags keeps your code declaration as the source of truth, then publishes the current snapshot for runtime reads.

Terminal window
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.

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

Use read(...) to see the snapshot currently used by runtime evaluation:

Terminal window
const state = await flags.read({
environment: "prod",
})

Use history(...) to list recent publishes and rollbacks:

Terminal window
const history = await flags.history({
environment: "prod",
limit: 20,
})
Terminal window
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 to a published checksum when you need an immediate restore:

Terminal window
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.