Skip to main content
Hypertune is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git version control and local, synchronous, in-memory flag evaluation. Optimized for TypeScript, React and Next.js. Here’s how to switch your ShipThing project to use Hypertune for feature flags!

1. Create a new Hypertune project

Go to Hypertune and create a new project. Then go to the Settings page of your project and copy the main token.

2. Update the environment variables

Update the environment variables across the project. For example:
apps/app/.env
Add a .env file to the feature-flags package with the following contents:
packages/feature-flags/.env

3. Update the keys.ts file in the feature-flags package

Use the NEXT_PUBLIC_HYPERTUNE_TOKEN environment variable in the call to createEnv:
packages/feature-flags/keys.ts

4. Swap out the required dependencies

First, delete the create-flag.ts file. Then, uninstall the existing dependencies from the feature-flags package:
Terminal
Then, install the new dependencies:
Terminal

5. Set up Hypertune code generation

Add analyze and build scripts to the package.json file for the feature-flags package, which both execute the hypertune command:
packages/feature-flags/package.json
Then run code generation with the following command:
Terminal
This will generate the following files:

6. Set up Hypertune client instance

Add a getHypertune.ts file in the feature-flags package which defines a getHypertune function that returns an initialized instance of the Hypertune SDK on the server:
packages/feature-flags/lib/getHypertune.ts

7. Update index.ts

Hypertune automatically generates feature flag functions that use the flags package. To export them the same way as before, update the index.ts file to export everything from the generated/hypertune.vercel.ts file:
packages/feature-flags/index.ts
Hypertune adds a Flag suffix to all these generated feature flag functions, so you will need to update flag usages with this, e.g. showBetaFeature => showBetaFeatureFlag.

8. Add more feature flags

To add more feature flags, create them in the Hypertune UI and then re-run code generation. They will be automatically added to your generated files.