Service Layer medium complexity backend
1
Dependencies
1
Dependents
9
Entities
0
Integrations

Description

Backend service managing feature flag CRUD operations, cache invalidation, and propagation. Reads the static feature registry for known feature keys and default states, persists per-organization overrides in PostgreSQL, and maintains a Redis cache with 60-second TTL for low-latency flag evaluation on every API request.

Feature: Feature Toggles

feature-flag-service

Responsibilities

  • CRUD operations for per-organization feature flag overrides
  • Read static feature registry for known keys, defaults, and descriptions
  • Maintain Redis cache with 60-second TTL for fast flag lookups
  • Enforce feature access server-side in API middleware regardless of client state
  • Include feature map in session bootstrap payload for mobile app consumption

Interfaces

getFeatureFlags(organizationId: string): FeatureFlag[]
toggleFeature(organizationId: string, featureKey: string, enabled: boolean): FeatureFlag
getFeatureFlag(organizationId: string, featureKey: string): FeatureFlag
isFeatureEnabled(organizationId: string, featureKey: string): boolean
getFeatureRegistry(): FeatureRegistryEntry[]
invalidateCache(organizationId: string): void
getSessionBootstrapFlags(organizationId: string): Record<string, boolean>
bulkUpdateFlags(organizationId: string, updates: FlagUpdate[]): FeatureFlag[]

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component