Requires Node.js 22+ (the Vana SDK’s minimum).
http://localhost:3000 and click Connect Spotify. The approval tab returns locally, the original tab polls status, and the app reads sample data through the same createAccessRequest, getAccessRequestStatus, and readApprovedData controller methods used in live mode.
If port 3000 is taken, Next.js starts on the next free port (for example
http://localhost:3001). Open the port it prints, and set VANA_APP_URL to that same origin so the approval return URL matches.examples/vana-app/lib/vana.ts:
- Source and app
id/nameare constants inlib/vana.ts— edit them there. - Scopes can be set either in
lib/vana.tsor with theVANA_SCOPESenv var (comma-separated, for exampleVANA_SCOPES=spotify.savedTracks,spotify.profile). - Sample fixture URL is set with
VANA_SAMPLE_DATA_URL(orVANA_SAMPLE_DATA_PATHfor a local file).
PDP-Connect/data-connectors.
Which scopes have sample fixtures
Sample mode only works for scopes that have a fixture inPDP-Connect/data-connectors. Current coverage (authoritative list: fixture-index.json):
To use a non-default fixture, point
VANA_SAMPLE_DATA_URL at its rawUrl from the fixture index, for example:
Test against the live protocol
Copy the example env file:VANA_MODE=live (from sample), VANA_APP_PRIVATE_KEY, VANA_APP_URL, VANA_ENV=production, and VANA_NETWORK=moksha (testnet) or mainnet. Keep the private key server-side.
You don’t set the escrow contract address — the SDK resolves it from the network you choose (
VANA_NETWORK), along with the escrow gateway. Just fund escrow for your app on that network so paid reads can settle. VANA_ESCROW_CONTRACT, VANA_DP_RPC_URL, VANA_ACCESS_REQUEST_BASE_URL, and VANA_APPROVAL_APP_BASE_URL exist only as optional overrides for custom deployments — leave them unset to use the network defaults.Deploy to a host
When you deploy (Vercel is the common choice), remember that.env.local is not uploaded — set every variable your app needs (VANA_MODE, VANA_APP_URL, and in live mode VANA_APP_PRIVATE_KEY, VANA_ENV, VANA_NETWORK) in the host’s project settings, and redeploy after changing them. On Vercel: Project Settings → Environment Variables, applied to all environments you use. A deploy without them silently falls back to sample-mode defaults. Also set VANA_APP_URL to the deployed origin so the approval return URL matches.
Prefer to build the integration directly into your own app? See Add Vana to your own app.