TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How to do private front end feature flags?

2 pointsby KennyFromITover 3 years ago
There are times where an engineering team might want to privately test out an upcoming feature in the frontend, but doesn't want to make that public for all to see prior to its public release (i.e. enabling a feature flag only for a certain population). This is difficult/impossible since frontend code can be inspected in the browser. What are some good solutions to this problem? What are industry norms?

2 comments

epcover 3 years ago
Haven&#x27;t done this recently but the last time I set a cookie with a specific value on an authenticated server side URL only accessible to testers. Inside the actual app implementing the feature I&#x27;d check for that cookie&#x2F;value and if present serve the content implementing the feature. If you didn&#x27;t present the cookie&#x2F;value combo you got served the production template w&#x2F;o the new feature. This was for a client who didn&#x27;t have a staging&#x2F;test environment so everything had to regrettably be done &quot;live&quot;.<p>It&#x27;s not bulletproof, anyone MITMing the connection could grab the cookie and access the feature, a tester could share the private URL &amp; userid&#x2F;password, etc.
emteyczover 3 years ago
You can have different builds for each audience and use bundler to remove dead code hidden behind if (process.env.AUDIENCE === 1)