Skip to content

Conversation

@0xjorgen
Copy link
Contributor

@0xjorgen 0xjorgen commented Nov 4, 2025

We want to be able to toggle features on and off for specific users with Amplitude experiment.

This PR introduces a mechanism for initialising feature flags across the frontend with the relevant user data. The feature flags are fetched on application load and when the wallet provider changes the connected wallet. The feature flags are also cached in localstorage, so that subsequent refreshes will be faster.

This is the first small step towards feature flags. In the future, we might want to

  • support feature flag payloads so that properties like text, colours, and images can be changed from amplitude without requiring a commit.
  • Improve speed by caching feature flags in vercel functions on the edge
Screenshot.2025-11-06.at.12.26.26.UTC.mp4

feature flag configuration page: https://app.amplitude.com/experiment/risklabs/414806/config/680059/configure

@linear
Copy link

linear bot commented Nov 4, 2025

@vercel
Copy link

vercel bot commented Nov 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
app-frontend-v3 Ready Ready Preview Comment Nov 7, 2025 1:22pm
sepolia-frontend-v3 Ready Ready Preview Comment Nov 7, 2025 1:22pm

@0xjorgen 0xjorgen changed the title jorgen/acx 4644 add minimal feature flag capabilities to across app feat: add minimal feature flag capabilities to across app Nov 4, 2025
@0xjorgen 0xjorgen changed the title feat: add minimal feature flag capabilities to across app feat: add feature flag capabilities to across app Nov 6, 2025
jorgen added 8 commits November 7, 2025 13:50
Integrate Amplitude Experiment client to enable feature flag capabilities across the application.

- Add useInitializeAmplitudeExperiment hook to manage experiment client lifecycle
- Extend AmpliContext with hasFeatureFlag and fetchFeatureFlags methods
- Initialize experiment client after Amplitude Analytics setup
- Fetch feature flags after userId is set to ensure proper user targeting
- Add useFeatureFlag convenience hook for consuming feature flags
- Update AmountInput component to demonstrate feature flag usage
- Add @amplitude/experiment-js-client dependency

The experiment client is initialized alongside Amplitude Analytics but defers
flag fetching until after user identification to ensure accurate targeting.
@0xjorgen 0xjorgen force-pushed the jorgen/acx-4644-add-minimal-feature-flag-capabilities-to-across-app branch from 3645a57 to 5655efd Compare November 7, 2025 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants