Hyperserve Adapter
The first-party adapter for the Hyperserve video API.
npm install @hyperserve/upload-adapter-hyperserveyarn add @hyperserve/upload-adapter-hyperservepnpm add @hyperserve/upload-adapter-hyperservebun add @hyperserve/upload-adapter-hyperserveUse createHyperserveConfig to produce a ready-to-use UploadConfig:
import { createHyperserveConfig } from "@hyperserve/upload-adapter-hyperserve";import { composeValidators, maxFileSize } from "@hyperserve/upload";
const config = createHyperserveConfig({ createUpload: async (file, options) => fetch("/api/create-upload", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: file.name, size: file.size, ...options }), }).then((r) => r.json()), completeUpload: async (videoId) => { await fetch(`/api/complete-upload/${videoId}`, { method: "POST" }); }, getVideoStatus: async (videoId) => fetch(`/api/video-status/${videoId}`).then((r) => r.json()), uploadOptions: { resolutions: ["480p", "1080p"], isPublic: true, }, validate: composeValidators(maxFileSize(500 * 1024 * 1024)),});The three callbacks call your backend, which proxies to Hyperserve using your API key; credentials never touch the browser.
Upload options
Section titled “Upload options”type HyperserveUploadOptions = { resolutions: string[]; isPublic: boolean; thumbnail?: { timestampMs: number }; metadata?: Record<string, unknown>;};metadata is forwarded on the create-video request and included in webhook payloads when processing completes. Use it to associate uploads with your app’s entities (post ID, product ID, etc.).
Status polling
Section titled “Status polling”After upload, the Hyperserve adapter polls your backend until the video finishes transcoding. The polling interval defaults to 3 seconds. Override it:
const config = createHyperserveConfig({ // ... pollingIntervalMs: 5000,});Prefer push updates via webhook or SSE? Skip the status checker and call updateFileStatus from useUpload(). See Hooks.