Skip to content

A Demo Application on Firebase Feature Flagging using Remote Config for Google DevFest 2023 Sri Lanka

Notifications You must be signed in to change notification settings

Safnaj/devfest-2023-demo

Repository files navigation

DevFest 2023 - Sri Lanka

image

1. Create a new Firebase Project.

  • Go to Firebase Console and create a new Firebase Project.
  • Navigate to Remote Config and create a Boolean Flag Named feature_enable_dark_mode

2. Clone the Repository

  • git clone https://github.com/Safnaj/devfest-2023-demo.git

3. Add Firebase Config values to .env file

  • Inside the project folder create a file called .env
  • Refer the .env.example and add the values as shown below
REACT_APP_FIREBASE_API_KEY=YOUR_API_KEY
REACT_APP_FIREBASE_AUTH_DOMAIN=YOUR_AUTH_DOMAIN
REACT_APP_FIREBASE_PROJECT_ID=YOUR_PROJECT_ID
REACT_APP_FIREBASE_STORAGE_BUCKET=YOUR_STORAGE_BUCKET
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=YOUR_MESSAGING_SENDER_ID
REACT_APP_FIREBASE_APP_ID=YOUR_APP_ID
REACT_APP_FIREBASE_MEASUREMENT_ID=YOUR_MEASUREMENT_ID

4. Set Default Config Values

  • Go to src/config/remoteConfig.js and inside the initRemoteConfig add your flag and it's default value.

5. Define Flags in Constants

  • Move to src/constants/flags.js and create a constant for your flag:
export const FEATURE_ENABLE_DARK_MODE = 'feature_enable_dark_mode';

6. Check flag value

  • Check your flag value using isFeatureEnabled function and write your logic
    Ex: const isShowStatsEnabled = isFeatureEnabled(FEATURE_ENABLE_STATS);

About

A Demo Application on Firebase Feature Flagging using Remote Config for Google DevFest 2023 Sri Lanka

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published