Devflare Docs
Binding reference Bindings

Use Flagship in a Worker

Flagship feature-flag bindings for reading feature flags from Workers, with deterministic pure mocks that return configured flag values.

Add the Flagship config, call from worker code, and start with the local test path Devflare supports.

Start with the config, wire the binding into worker code, then use the support section to decide whether local tests or Cloudflare-backed tests fit.

Config key
Authoring shape
Best for
application paths where the Worker reads feature flags from the Flagship binding

Add the binding to config

Add to , then use the generated env binding from Worker code.

Keep the first version close to the route or handler that needs it; move to a helper only after the shape is obvious.

Smallest Flagship config

Use the binding from application code

After Devflare generates the worker env, import from and keep the first Flagship path close to the route, handler, or service method that needs it.

Keep this first path small enough that the config, env binding, and user-visible behavior are easy to review together.

Read a boolean flag

Local and Remote Support

Devflare has a real lane for Flagship, but the local contract is intentionally narrower than Cloudflare's hosted product. The docs call out the supported local path and the remote boundary separately.

Miniflare's Flagship plugin returns each call's default value locally and ignores the flag key (it does not evaluate flag rules), while Devflare's deterministic pure mock (createMockFlagshipBinding({ flags })) returns configured flag values, falling back to the default. Use the documented local lane only for the behavior Devflare explicitly models, and keep the narrower boundary visible in code review.

Use Cloudflare when the assertion depends on cloudflare-hosted product behavior rather than the app calling the binding correctly. This is the lane for full Flagship product fidelity, remote state, lifecycle behavior, and platform-specific limits.

When this binding fits best

  • Use Flagship when application paths where the worker reads feature flags from the flagship binding.
  • Keep binding names stable and uppercase in examples so generated Env declarations remain predictable.
  • Prefer Devflare native config while it covers the feature; use only for unsupported Wrangler-only fields.

Testing path

  • Start with or for config-backed local worker tests.
  • Use / for small unit tests that only need deterministic application behavior.
  • Use Cloudflare-backed tests when the assertion depends on hosted platform behavior, account state, limits, billing, or production routing.

Open the next page when you need it