The [Hypertune adapter](https://flags-sdk.dev/docs/api-reference/adapters/hypertune) for the [Flags SDK](https://flags-sdk.dev/)
The Hypertune adapter for the Flags SDK
The Hypertune provider is available in the @flags-sdk/hypertune module. You can install it with
``bash`
pnpm i @flags-sdk/hypertune
You must use the code generation powered by npx hypertune to create an adapter instance.createHypertuneAdapter
Use from @flags-sdk/hypertune as shown below:
`tsnpx hypertune
import { createHypertuneAdapter } from "@flags-sdk/hypertune";
import { Identify } from "flags";
import { dedupe, flag } from "flags/next";
/* Generated with /
import {
createSource,
flagFallbacks,
vercelFlagDefinitions as flagDefinitions,
Context,
FlagValues,
} from "./generated/hypertune";
const identify: Identify
return {
environment: process.env.NODE_ENV,
user: {
id: "e23cc9a8-0287-40aa-8500-6802df91e56a",
name: "Example User",
email: "user@example.com",
},
};
});
const hypertuneAdapter = createHypertuneAdapter
createSource,
flagFallbacks,
flagDefinitions,
identify,
});
/* Use the adapter to generate flag declarations for use in your app's framework /
export const showSummerBannerFlag = flag(
hypertuneAdapter.declarations.summerSale,
);
export const showFreeDeliveryBannerFlag = flag(
hypertuneAdapter.declarations.freeDelivery,
);
export const proceedToCheckoutColorFlag = flag(
hypertuneAdapter.declarations.proceedToCheckout,
);
/**
* NOTE: You can provide specific options for flag overrides.
*
* However, using enums in Hypertune will provide these automatically.
*/
export const delayFlag = flag({
...hypertuneAdapter.declarations.delay,
options: [
{ value: 0, label: "No delay" },
{ value: 1_000, label: "1 second" },
{ value: 2_000, label: "2 seconds" },
{ value: 3_000, label: "3 seconds" },
],
});
`
`bashRequired
NEXT_PUBLIC_HYPERTUNE_TOKEN="123="
Please check out the Hypertune Adapter reference for more information.