Back Arrow Icon
Go Back
Using Feature Flags for Early Access
Two Minute Use Case Series

Using Feature Flags for Early Access

Learn how to use DevCycle's feature flags to manage early access for specific user groups. This step-by-step guide includes creating and testing feature flags in a NextJS application, offering a smart way to streamline your development workflow.

Mark Allen
Mark Allen
June 26, 2023

Feature flags and Early Access

Feature flags are not just feature toggles that allow you to toggle on and off a feature for all your users. They can also be incredibly useful for providing early access to a feature for specific users or groups, such as a Product Manager, beta user, or any other member of your team or user base.

With DevCycle, you can turn on a new feature for a specific group of users, granting them early access. This way, you can showcase your progress to a fellow developer or product manager, or gather feedback from beta users who are using the feature in production. This also enables you to receive notifications about any bugs or performance issues the feature might introduce.

To demonstrate this "Early Access" use case, we'll use a NextJS application because it's a straightforward way to showcase this functionality in a front-end React application.

Step 1: Setup the Demo App

Start by following the instructions provided in the README at https://github.com/devcyclehq/devcycle-use-cases.

In this early access example, our focus will be on a new Profile page and related menu item that has been added to the application.

Step 2: Create the Feature on DevCycle

You'll first create a new Release flag in DevCycle called profile-page and turn it on for yourself. Find step-by-step instructions to create your first feature flag in the DevCycle Docs.

Step 3: Update our NextJS App Code

With the setup done in DevCycle, let's integrate this feature flag into the menu of our NextJS app. This will reveal the Profile menu item and allow the logged-in user to navigate to the profile page if they have this feature flag enabled.

  1. Create showProfilePage with the default of false.
  1. Then I need to identify the dvcuser with the user from auth0. In this case I do it within a useEffect so that when the user object is updated I can run identifyUser.const dvcClient = useDVCClient().
  1. Add the menu item if this user has this value set to true.
Step 4: Testing the Feature Flag

The feature flag is created to target only emails with @devcycle.com with variation on. If you log out, you won’t see it. However, after logging in as 'developer', you will see it.

If you log out and log back in as a beta user, you won’t see the feature. But if you add a new targeting rule in the DevCycle dashboard and return to the demo app, the beta users can now see the Profile menu item.

You can finally release this feature to everyone by setting the variation for All Users to "On". After doing so, any user, such as user@domain2.test, should be able to see the feature.

Wrapping Up

Using a feature toggle barely scratches the surface of the power of feature flags. Enabling a feature for specific users allows you to showcase your work, receive feedback, and test performance, thus taking your development workflow to the next level. Ready to level up your development workflow? Start using feature flags with DevCycle today.

Author headshot
written By
Mark Allen

Enjoyed this read?

Join the Ship It Club to receive updates on development trends, productivity tips, and gain early access to DevCycle events and giveaways, shipped once a month.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.