Flags 1.x is a release candidate. npm's latest tag still installs 0.x, so install these docs' version from the rc tag:
npm i @adonis-agora/flags@rc
node ace configure @adonis-agora/flagsThe same goes for every @adonis-agora/* package these docs install: add @rc, and where a page says node ace add, install with @rc first and then run node ace configure. On 0.x? Read the 0.x docs.
Flags
Typed feature flags, percentage rollouts, targeting and A/B experiments with real statistics — inside your AdonisJS app.
@adonis-agora/flags gives an AdonisJS app feature flags and experiments without a third-party service:
- Flags are managed in the console: create them, target them, roll them out, without a deploy. They can also be declared in code, and
node ace flags:typeskeeps console flags typed. - Evaluation is in memory. Every process keeps the ruleset and evaluates locally; reading a flag never waits on the database.
- Experiments are measured. Exposures and conversions go through an outbox-style event log to your database, Parquet files, ClickHouse or PostHog, and the results page shows lift, confidence intervals, sample-ratio checks, CUPED and always-valid sequential p-values.
- It grows with you. Start with Postgres/MySQL/SQLite. Add Parquet + DuckDB or ClickHouse when the event volume asks for it. Run a central flags server that many apps connect to, with authkit tokens.
- It speaks OpenFeature, including OFREP for browsers, mobile apps and services in other languages.
// a controller
async show({ flags, inertia }: HttpContext) {
if (await flags.enabled('new_player')) {
return inertia.render('player/new')
}
return inertia.render('player/classic')
}// an experiment
const variant = await ctx.flags.variant('checkout') // records the exposure
await ctx.flags.track('purchase', { value: order.total }) // records the conversionPackages
| Package | What it is |
|---|---|
@adonis-agora/flags | The AdonisJS package: provider, config, commands, middleware |
@adonis-agora/flags-react | useFlag, <Flag>, live updates for Inertia/React |
@adonis-agora/flags-dashboard | The console (installed with the main package) |
@adonis-agora/flags-core | The evaluation engine and statistics, framework-free |
Next: Getting started.