Skip to content

Feature Flags

We use Flagsmith to turn features on and off without deploying new code.

  • Registry (packages/feature-flags) — flag names and safe defaults in code.
  • Adminflagsmith.feyenoord.com to toggle flags per environment.
  • Edge Proxy — serves flags to our apps (cached, one instance per environment).

For local setup, see Docker Compose.

Architecture

ComponentRole
Flagsmith CoreAdmin UI and source of truth (PRD runs in Azure with PostgreSQL).
Edge Proxyfeye-flagsmith-edge-proxy-{env}-ca — caches flags inside the Container App Environment.
API GatewayPublic /v2/flags route for native and Sanity only.

Which app uses what

AppDocHow flags are loaded
Web (Next.js)Client-sideServer fetches once per request; browser is hydrated (no separate flag request).
Native, SanityClient-sideApp fetches via API gateway.
API, subgraphs, workersServer-sideService talks to Edge Proxy directly inside Azure.

Add a flag

  1. Add an entry in packages/feature-flags/src/flags.ts (key must match Flagsmith, use snake_case). Type name must SCREAMING_SNAKE_CASE.
GOAL_REPLAY: {
  key: "goal_replay",
  description: "Enables the goal replay feature.",
  defaultValue: true,
}
  1. Create the same flag in the Flagsmith admin with the same key
  2. Use flags from @repo/feature-flags in your app — never hardcode flag strings.

Set defaultValue to something safe when Flagsmith is unreachable (usually false for new features).

Check a flag

WherePackagePattern
Web — server component@repo/feature-flags + app SSR helperSee client-side
Web — client component@repo/feature-flags-reactuseFlag(flags.…)
Native@repo/feature-flags-react-nativeuseFlag(flags.…)
Node service@repo/feature-flags-nodejsfeatureFlagsClient.isEnabled(flags.…)

If Flagsmith is down, apps fall back to the registry defaultValue.

After you toggle a flag

  • API / workers: changes can take up to ~40 seconds (proxy + in-process cache).
  • Web: server components see updates on the next request; client UI may need a page reload.
  • Native: reload or restart the app.