Preview HTML-based video compositions in the browser and render MP4s server-side — on Vercel. Powered by Vercel Sandbox for rendering and Vercel Blob for output storage.
HyperFrames is an open-source video rendering framework: write HTML + CSS + GSAP, get a reproducible MP4.
Live demo: hyperframes-on-vercel.vercel.app
Deploying provisions a Vercel Blob store; BLOB_READ_WRITE_TOKEN is injected automatically. Sandbox auth is handled at runtime via VERCEL_OIDC_TOKEN — no extra setup.
- Preview a bundled composition (
ui-3d-reveal) in the browser using<hyperframes-player>, the zero-dependency web component from@hyperframes/player. - Render the composition to an MP4 by POSTing to
/api/render. The route restores a pre-baked Vercel Sandbox, runshyperframes render, uploads the MP4 to Vercel Blob, and returns a public URL.
Authoring happens locally. This template ships with one pre-authored composition. To build your own, use the HyperFrames CLI on your machine:
npx hyperframes init my-video
cd my-video
npx hyperframes preview # live-reload editor in your browserThen swap it into this template (see Swapping the composition below).
Browser Vercel Functions (node) Vercel Sandbox (Firecracker microVM)
┌──────────────────┐ ┌────────────────────────┐ ┌──────────────────────────────────┐
│ <hyperframes- │ ───▶ │ /api/render │ ──▶ │ (restored from snapshot, or │
│ player> │ │ - read composition │ │ freshly provisioned in dev) │
│ preview iframe │ │ - writeFiles to sbox │ │ │
│ │ │ - runCommand: render │ │ hyperframes render composition │
│ │ ◀── │ - readFileToBuffer │ ◀── │ (Chromium + ffmpeg-static) │
│ │ url │ - put() → Vercel Blob │ mp4 │ │
└──────────────────┘ └────────────────────────┘ └──────────────────────────────────┘
Cold render of a 20s composition is ~70 seconds. Most of that time is the actual Chromium render — not setup — because we pre-bake a sandbox snapshot at build time instead of installing dependencies on every request.
scripts/create-snapshot.ts runs as part of next build:
- Spin up a fresh
node22sandbox dnf installChromium system libraries (nss,libXcomposite,pango, …)npm install hyperframes ffmpeg-static- Symlink
ffmpeg-static/ffmpegto/usr/local/bin/ffmpeg npx hyperframes browser ensureto download chrome-headless-shellsandbox.snapshot({ expiration: 7 days })and write the snapshot ID to a pointer blob atsnapshot-cache/<deployment_id>.json
At render time, lib/sandbox.ts' restoreOrCreate reads the pointer blob, restores a sandbox from the snapshot in ~100 ms, writes the composition files, and runs hyperframes render. In non-production (local vercel dev) it falls back to a fresh setup automatically.
Vercel Functions cap at 300s and 50 MB compressed bundle — HyperFrames needs a full Chromium + FFmpeg at runtime, which busts the bundle limit. Vercel Sandbox is the purpose-built primitive for this workload: an Amazon Linux 2023 Firecracker microVM with sudo-level package installs, up to 5 hours of runtime, and up to 8 vCPUs (we use 4).
With 4 vCPUs, hyperframes render --workers auto launches 3 parallel Chrome workers, cutting the render time roughly 2× vs. the single-worker default.
npm install
npm run devBrowser preview works locally out of the box. The /api/render route needs Vercel Sandbox auth — run vercel env pull .env.local after linking the project to get VERCEL_OIDC_TOKEN locally, or use vercel dev.
app/
api/render/route.ts # POST → restore sandbox, render, upload to Blob
page.tsx # Preview + "Render" button
layout.tsx
globals.css
lib/
sandbox.ts # Snapshot-aware wrapper around @vercel/sandbox
scripts/
create-snapshot.ts # Build-time: pre-bake the sandbox snapshot
public/
compositions/
ui-3d-reveal/ # The bundled example composition
index.html
compositions/*.html
- Drop your composition bundle into
public/compositions/<your-name>/. - Update
PREVIEW_COMPOSITION_DIRat the top oflib/preview.ts(used by both preview and render). - Optionally update
COMPOSITION_WIDTH/COMPOSITION_HEIGHTat the top ofapp/page.tsxto match your composition's dimensions.
Vercel Sandbox pricing — Pro plans include $20/mo in Sandbox credit. At ~70s per render on 4 vCPUs, that covers roughly a hundred renders/month of the bundled 20-second example. Snapshot storage (the ~650 MB snapshot per deployment) is included in Sandbox pricing.
Apache-2.0 — same license as HyperFrames itself.
