Feature Flags

Control feature visibility with flags, percentage rollouts, and user targeting. Start with local JSON flags and upgrade to a remote provider when ready.

togglesrolloutexperimentationa-b-testing

Providers

Local JSON

File-based feature flags with no external dependencies

Usage

Check a feature flag

Gate features behind flags with type-safe checks

import { flags } from '@/lib/flags'

export default function Dashboard() {
  const showNewChart = flags.isEnabled('new-dashboard-chart')

  return (
    <div>
      <h1>Dashboard</h1>
      {showNewChart ? <NewChart /> : <LegacyChart />}
    </div>
  )
}

Get Started

Add feature flags to your Primstack project with a single command:

prim flags init