A write up on the Feature Flagging Functionality I created.
Overview
Feature flagging is a well known and widely used technique across software development in which you gate off certain features from users until they’re ready for production. This allows developers to be able to work on features and push them to production without worrying about breaking core functionality or stale git branches. This also allows QA to test in multiple environments, not just development. Right now, we would use feature flagging for waterfowl with the hopes of it expanding to more things in the future.
Objective
Limit certain aspects of the application from whole features to the amount of data able to be accessed over a certain time period from the frontend.
Identifying Feature Requirements
Limiting Functionality given the apis response
Default Home Page
“Off” states in certain components
Unauthorized pages
Blocked and redirects
Known Pitfalls
If we allow the users to have a homepage based on available features.
Supporting users who don’t turn on feature flagging
Ensuring there isn’t overlap with entitlements or gating based on node count.
Engineering Design
This feature is designed as a reusable component that can be injected throughout the application, from top-level routing context down to specific component-level features.
We use React Query for cache management to prevent stale states.
Implementation
This implementation had several pieces of complex logic. We needed a component for protecting Routes, Determining the default home page as well as our feature flagging hook and context. Below are some example code blocks.
Measuring Success
The main components of success here were if the application was properly gated. Things such as window controls only allowed users to view data according to the featureFlags returns values. As well as having gated routes that fell back to unauthorized pages and returned to the users default home page given their feature flag configuration. This project spearheaded the way for RBAC realization.