Description:
Implement the Feature Flags module for runtime feature toggling, A/B testing, and gradual feature rollouts without redeployment.
Tasks:
Design FeatureFlag entity: key, isEnabled, rolloutPercentage, allowedUserIds (array), allowedTiers (array), description, updatedAt
Implement FeatureFlagsRepository
Implement FeatureFlagsService: isEnabled, isEnabledForUser, setFlag, getFlags, enableForTier, enableForUser
Implement FeatureFlagsController: GET /admin/feature-flags, PATCH /admin/feature-flags/:key, GET /feature-flags/me (user-facing resolved flags)
Cache flag evaluations in Redis (30s TTL)
Implement @FeatureFlag('flag_key') decorator for controller/service use
Emit flag change event for cache invalidation
Write unit and e2e tests
Acceptance Criteria:
Feature flags evaluatable per user, tier, and percentage rollout
Flag changes take effect within 30 seconds
Admin can toggle flags without app restart
User-facing endpoint returns resolved flag values (boolean only)
Flag evaluation < 5ms from cache
Unit + e2e coverage >= 85%
Description:
Implement the Feature Flags module for runtime feature toggling, A/B testing, and gradual feature rollouts without redeployment.
Tasks:
Design FeatureFlag entity: key, isEnabled, rolloutPercentage, allowedUserIds (array), allowedTiers (array), description, updatedAt
Implement FeatureFlagsRepository
Implement FeatureFlagsService: isEnabled, isEnabledForUser, setFlag, getFlags, enableForTier, enableForUser
Implement FeatureFlagsController: GET /admin/feature-flags, PATCH /admin/feature-flags/:key, GET /feature-flags/me (user-facing resolved flags)
Cache flag evaluations in Redis (30s TTL)
Implement @FeatureFlag('flag_key') decorator for controller/service use
Emit flag change event for cache invalidation
Write unit and e2e tests
Acceptance Criteria:
Feature flags evaluatable per user, tier, and percentage rollout
Flag changes take effect within 30 seconds
Admin can toggle flags without app restart
User-facing endpoint returns resolved flag values (boolean only)
Flag evaluation < 5ms from cache
Unit + e2e coverage >= 85%