Platform flags
The platform flags driver (PlatformFlags) connects the framework’s
feature flags module directly to the FlowCatalyst platform
control plane using the application’s existing PlatformClient service account.
No extra database tables and no Redis instance are required in the application:
- Definition sync: declared flags are included in
DefinitionSync(CategoryFlags/Category.FLAGS) and synced toPOST /api/applications/{app}/flags/sync. - Snapshot pull: fetches
GET /api/applications/{app}/flags/snapshotwithIf-None-Matchso unchanged snapshots return304 Not Modifiedwith zero JSON parsing. - Live invalidation: keeps a persistent SSE connection open to
GET /api/applications/{app}/flags/watch, triggering an immediate conditional refresh whenever an operator or client admin changes a flag in the console, backed by a 30-second poll fallback. - Delegated client overrides: implements the admin writer interface for client-managed flags by
forwarding
PUT/DELETE /api/applications/{app}/flags/{key}/clients/{clientId}withX-On-Behalf-Ofcarrying the signed-in user’s principal id.
Wiring
Section titled “Wiring”fcDecl := flowcatalyst.Declare(app)flagsDecl := flags.Declare(app, orders.ExpressCheckout, orders.Routing)
// In build:fc, err := flowcatalyst.Build(ctx, b, fcDecl, flowcatalyst.WithFlags(flagsDecl.Definitions()))if err != nil { return err}
pf := flowcatalyst.PlatformFlags(fc.Client(), flowcatalyst.WithFlagsPollInterval(30*time.Second))
appFlags, err := flagsDecl.Build(ctx, b, pf)Pass pf to flagsadmin.New(appFlags, pf) to enable in-app client self-service toggles on
CLIENT_MANAGED flags (operator-only mutations remain in the FlowCatalyst console).
App.builder() .module(new FlowCatalystModule()) .module(FlagsModule.builder() .flag(OrderFlags.EXPRESS_CHECKOUT) .flag(OrderFlags.ROUTING) .source(PlatformFlags::fromLookup) .build());FlagsModule automatically contributes every registered FlagDefinition to the application’s
Lookup, and FlowCatalystModule discovers them for DefinitionSync (Category.FLAGS) with
no duplicate registration.
Required service-account permissions
Section titled “Required service-account permissions”The platform’s built-in platform:application-service role carries all three permissions scoped to
the application’s own code and entitled clients:
| Permission | Used by |
|---|---|
platform:application-service:flags:sync |
DefinitionSync (POST /api/applications/{app}/flags/sync) |
platform:application-service:flags:read |
Load (GET .../snapshot) and Watch (GET .../watch) |
platform:application-service:flags:client-override |
Delegated SetClientOverride / DeleteClientOverride (PUT/DELETE .../clients/{clientId}) |
Operator-level changes (kill switches, global targeting rules, locks, deleting orphaned flags)
require platform:admin:flags:manage in the FlowCatalyst console and cannot be performed by an
application service account.
Cold start and failure handling
Section titled “Cold start and failure handling”- Platform unreachable at start-up: by default (
UseDefaultsAndRetry), start-up succeeds and flags evaluate to their code-declared defaults whilePlatformFlagsretries with backoff. - SSE stream disconnects:
Watchreconnects automatically with exponential backoff and runs a conditional snapshot check on reconnect so no revision is missed. - Platform error while running: the last good immutable snapshot stays active in memory;
fw_flags_refresh_errors_total{driver="platform"}increments and the"flags"health check reportsDEGRADEDonce snapshot age exceeds the configured threshold (default 5 minutes).