Feature Flags Configuration

The feature flags the kit exposes, where they come from, and how to read and add them.

Feature flags are built by getFeatureFlags() in apps/web/config/feature-flags.config.server.ts, from environment variables and the account mode.

This page is part of the Configuration documentation.

Current Flags

FlagSource
enablePersonalAccountACCOUNT_MODE
enableOrganizationsACCOUNT_MODE
allowUserToCreateOrganizationACCOUNT_MODE
showAccountSwitcherACCOUNT_MODE
enableOrganizationsBillingACCOUNT_MODE + both Stripe keys
enablePersonalAccountBillingACCOUNT_MODE + ENABLE_PERSONAL_ACCOUNT_BILLING + both Stripe keys
enableOrganizationDeletionACCOUNT_MODE
enableThemeToggleENABLE_THEME_TOGGLE

How the account-mode flags are derived: Account Modes.

Reading Flags

// server: loaders, actions, handlers, services
import { HTTPException } from 'hono/http-exception';
import { getFeatureFlags } from '#/config/feature-flags.config.server.ts';
if (!getFeatureFlags().enableOrganizations) {
throw new HTTPException(404);
}
// browser
import { useShared } from '@void/react';
const { config } = useShared();
return config.flags.enableThemeToggle ? <ModeToggle /> : null;

A flag hides UI; it doesn't protect anything. Check the flag (and the user's permissions) again in every action and handler that the hidden UI would call.

Flags Are Public

Every flag is sent to the browser: public-config.server.ts passes getFeatureFlags() through whole. Never put a secret, an internal id or a per-user value in it.

Adding a Flag

  1. Declare the variable with a default in apps/web/env.ts, e.g. ENABLE_REFERRALS: boolean().default(false).
  2. Add it to apps/web/env.example.
  3. Read it in your own server code, or add it to createFeatureFlags() if it should appear in getFeatureFlags() and in the browser (that file is kit-owned, so expect to resolve it when you merge kit updates).
  4. Turn it on per environment with void secret put ENABLE_REFERRALS.

Common Pitfalls

  • Treating a flag as authorization: check it again in the action.
  • Putting a secret in a flag: every visitor can read useShared().config.flags.
  • Overriding one account-mode flag on its own: change ACCOUNT_MODE instead.
  • Expecting a flag change to need a rebuild: flags are server env, so a new secret value applies to new Worker isolates without rebuilding.

Next: Navigation Configuration →