Modules
Runtime-configured feature flags, API-compatible with fun_with_flags.
Identifies an actor (e.g. a user) for actor and percentage_of_actors gates. The id must be a binary and stable for a given actor across a flag's lifetime.
Opt-in audit hook. Turns Bandera's existing write telemetry
([:bandera, :enable|:disable|:clear] span :stop events) into structured
Bandera.Audit.Event records and forwards them to a callback you provide.
A single flag-change audit record.
Resolves all Bandera settings at RUNTIME and caches them in a :persistent_term
snapshot for cheap hot-path reads.
A single targeting predicate evaluated against an evaluation context.
Function components for the Bandera dashboard.
The Bandera flag dashboard LiveView.
Pure helper that groups flags for the dashboard by a name-prefix convention.
Router macro for mounting the Bandera dashboard.
Maps a dashboard element's semantic role to a CSS class string for the active theme. The LiveView markup is identical across themes; only the class strings differ, so there is a single template and no fork.
Helpers for creating the Bandera flags table. Call from your own migration
A named feature flag (a collection of gates) and its evaluation.
A single feature-flag gate and its evaluation.
Raised when a gate is built with an invalid target — out-of-range percentage ratio, empty variant map, all-zero or negative variant weights.
Determines whether a given item (actor) belongs to a named group. Group names are compared as strings.
Cross-node cache-busting notifications.
Phoenix.PubSub cache-busting notifier. Subscribes to a topic and, on a flag
change broadcast by ANOTHER node, busts the local cache entry. Self-published
changes are ignored. The PubSub server name is read at runtime from
config :bandera, cache_bust_notifications: [client: MyApp.PubSub].
Redis PubSub cache-busting notifier (via Redix). Subscribes to a channel and,
on a flag change published by ANOTHER node, busts the local cache entry for
that flag. Self-published changes are ignored. Connection options are read at
runtime from config :bandera, cache_bust_notifications: [redis: <Redix opts>].
Behaviour for the active store the public API talks to.
ETS read cache for flags. Always started; bypassed by the store when the cache
is disabled (so the cache can be toggled at runtime without races). The TTL is
read from the runtime Bandera.Config snapshot at lookup time.
Behaviour for durable flag storage adapters (Memory, Ecto, Redis).
SQL persistence adapter. The repo and table name are read from
Bandera.Config at RUNTIME and queries bind the table via Ecto's
{table_name, Record} source form, so nothing about the table is fixed at
compile time. The Record schema supplies field types so values (e.g.
booleans) cast portably across SQL backends.
In-memory (ETS) persistence adapter. The default backend; suitable for single-node deployments and development. Not durable across restarts.
Redis persistence adapter (via Redix).
Process-scoped overlay store for tests, backed by NimbleOwnership.
Default store: an ETS cache in front of a persistent adapter. Whether the cache
is consulted is decided per-call from the runtime Bandera.Config snapshot
(read from :persistent_term), so caching can be toggled at runtime with no
recompilation. The persistent adapter is also runtime-selected.
Telemetry events for Bandera.
Test helpers for toggling Bandera flags with per-test, async-safe isolation.
Optional last-evaluated tracker. Attaches to [:bandera, :enabled?] and
[:bandera, :variant] and records, in ETS, the last time each flag was checked —
the signal for Bandera.stale_flags/1. Start it in your supervision tree and call
Bandera.Usage.attach/0 once at boot.
Mix Tasks
List feature flags. Use --stale [--older-than DAYS] to show unused flags.