@fanvue/builder-sdk is the TypeScript package for Fanvue apps. It runs OAuth and sessions, gives you a typed API client, verifies webhooks and talks to the Fanvue host from inside an iframe. Install it here, pick the entrypoint that matches where your code runs, then follow the guide for your app type. You need a registered app and its OAuth credentials from the Developer Area.
Install
Install the package once; every entrypoint ships in it. The Builder SDK guides use version 0.8.0.
An API-only app installs neither. The package declares no Node version requirement.
Entrypoints
Each entrypoint is a separate import path. Pick the one for where the code runs and which app type you’re building.Environment variables
The SDK reads two sets of variables, and an app can use either or both. TheOAUTH_* set feeds createConfig in both Next.js entrypoints. The FANVUE_* set feeds fanvueEnv(), the session handlers and the readiness checks.
createConfig throws when a required OAUTH_* variable is missing. createConfigSafe returns { ok: false, missing } instead, so a route can answer 503 rather than crash.
Defaults
When you set nothing, the SDK falls back to these constants, exported from the core entrypoint.
The client pins
X-Fanvue-API-Version to API_VERSION unless you pass apiVersion in createFanvueClient options.
Result type
Every network call in the SDK returns aResult instead of throwing. A Result is either ok, holding a value, or err, holding an error, so check isOk() or isErr() before you read either field.
Errors come from four unions. Each arm carries a code string you can branch on.
The
API_ERROR_RESPONSE arm carries statusCode, the platform’s machine-readable reason when one was sent, and retryAfterSeconds parsed from Retry-After or X-RateLimit-Reset. Its message is upstream text, so log it but never render it to a user.
createConfigSafe ({ ok, config | missing }), the route guards ({ ok, session | response }) and requireMachineAuth (status).
Which guide next
Off-platform sign-in
Route handlers and a cookie session for a Next.js app creators sign in to.
Run inside Fanvue
Session exchange, headers and React hooks for an on-platform creator surface.
API client
Typed namespaces for chats, checkout, experiences, subscribers, vault and webhooks.
Webhooks
The receiver route, signature verification and subscription lifecycle.
Host bridge
Analytics events and host-rendered dialogs from inside the iframe.
Storage and security
Encrypted token storage, app sessions, machine auth and log scrubbing.