Type-safe client generation
SDKs come with a CLI tool to auto-generate a client so you can access your flags with end-to-end type safety. This ensures typos in flag names or incorrectly passed targeting attributes can be caught at build-time rather than runtime. It also improves the developer experience with code completion, "find all references" and type-safe flag clean up.
To generate a client, first define the following environment variables in your .env file:
NEXT_PUBLIC_HYPERTUNE_TOKEN=token
HYPERTUNE_FRAMEWORK=nextApp
HYPERTUNE_OUTPUT_DIRECTORY_PATH=generatedReplace token with your project token which you can find in the Settings tab of your project.
Then run:
npx hypertuneyarn hypertunepnpm hypertuneCustomize client generation
To customize client generation, use the following environment variables:
# Set whether Hypertune should include a build-time snapshot of your flag logic
HYPERTUNE_INCLUDE_INIT_DATA=true
# Set whether Hypertune should include your token in the generated code
HYPERTUNE_INCLUDE_TOKEN=true
# Set where Hypertune should find your query file path
HYPERTUNE_QUERY_FILE_PATH=hypertune.graphqlYou can also pass these as command-line arguments. To see all available options, run:
This will output:
Last updated