Data Layer low complexity backend
0
Dependencies
1
Dependents
3
Entities
0
Integrations

Description

Data access layer for the feature_flags table in PostgreSQL. Handles persistence of per-organization feature flag overrides including organization_id, feature_key, enabled boolean, and metadata. Provides repository methods for querying, updating, and bulk-managing flag state.

Feature: Feature Toggles

feature-flag-store

Responsibilities

  • Persist and retrieve feature flag records from the feature_flags table
  • Support bulk queries by organization for session bootstrap payloads
  • Enforce unique constraint on organization_id + feature_key combinations
  • Provide default flag values from the static registry when no override exists

Interfaces

findByOrganization(organizationId: string): FeatureFlag[]
findByKey(organizationId: string, featureKey: string): FeatureFlag | null
upsert(organizationId: string, featureKey: string, enabled: boolean, metadata?: object): FeatureFlag
bulkUpsert(organizationId: string, flags: FlagInput[]): FeatureFlag[]
deleteByKey(organizationId: string, featureKey: string): void
getEffectiveFlags(organizationId: string, registry: FeatureRegistryEntry[]): Record<string, boolean>

Relationships

Dependents (1)

Components that depend on this component