Comment on page
Vercel Edge Config
If your Next.js app is deployed on Vercel, you can use Edge Config to initialize the Hypertune SDK on the server with near-zero latency.
- 1.
- 2.Select your Vercel team and project.
- 3.Continue and log into Hypertune.
- 4.Connect your Hypertune project to a new or existing Edge Config store. Copy the displayed environment variables for later. They contain your Hypertune Token, Edge Config Connection String and Edge Config Item Key.
- 5.Go to your Vercel dashboard and select the project you want to use the Hypertune integration with. Go to Settings > Environment Variables and add the following:
- 1.
NEXT_PUBLIC_HYPERTUNE_TOKEN
, set to your Hypertune Token - 2.
EDGE_CONFIG
, set to your Edge Config Connection String - 3.
EDGE_CONFIG_HYPERTUNE_ITEM_KEY
, set to your Edge Config Item Key
Add the environment variables to your
.env.development.local
file by running:vercel env pull .env.development.local
Install the Vercel Edge Config package:
npm
yarn
pnpm
npm install @vercel/edge-config
yarn add @vercel/edge-config
pnpm add @vercel/edge-config
Update your
hypertune.ts
to create an Edge Config client and pass it along with your Edge Config Item Key when initializing the Hypertune SDK:import { createClient } from "@vercel/edge-config";
import { initializeHypertune } from "./generated/generated";
const edgeConfigClient = process.env.EDGE_CONFIG
? createClient(process.env.EDGE_CONFIG)
: undefined;
const hypertune = initializeHypertune({},
{
token: process.env.NEXT_PUBLIC_HYPERTUNE_TOKEN,
vercelEdgeConfigClient: edgeConfigClient,
vercelEdgeConfigItemKey: process.env.EDGE_CONFIG_HYPERTUNE_ITEM_KEY,
},
);
export default hypertune;
Now the Hypertune SDK will initialize with near-zero latency on the server in Vercel's edge environment.
Last modified 1mo ago