Host on Vercel
Vercel runs the app as WebAssembly in a Node function, or on its Edge runtime.
Build
rustup target add wasm32-unknown-unknown # once
wisp build --target vercel # .vercel/output
wisp build --target vercel --edge # every route on the Edge runtime
In Vercel's CI a plain wisp build picks the target from VERCEL and writes to .vercel/output.
Deploy
npx vercel deploy --prebuilt
wisp deploy init vercel writes a GitHub Actions workflow that builds and deploys on push to main. It reads the secrets VERCEL_TOKEN, VERCEL_ORG_ID and VERCEL_PROJECT_ID.
Environment
WISP_SECRETas an environment variable of the project, for an app that signs cookies.- Read other values with
wisp::env("KEY")(std::env::varsees nothing). CRON_SECRET, if the app haswisp::cron: set it too; Vercel's cron sends it.- Environment variables.
Limits
- Per route:
const RUNTIME: wisp::Runtime = wisp::Runtime::Edge;in a+page.rsor+server.rsputs that route on the Edge runtime and the rest stay on the Node function. See Edge runtime per route. - The build stops, naming the route, if an Edge route uses what WebAssembly lacks (
std::fs,std::thread,std::process,std::net, websockets). - WebSockets answer 501; use
Response::events(SSE). Streaming is live. - Vercel may freeze the instance after the response, so finish background work first.
- Cron:
wisp::cronbecomescronsinconfig.json(Hobby plan: daily only). wisp::channel,wisp::everyandRateLimitare not in the edge build.
Files and Data
static/goes to.vercel/output/staticand stays the CDN's.Table::savedandRestare per-instance memory.WISP_STOREacceptslibsql://(Turso or any libSQL server, withWISP_STORE_TOKEN); see Saved tables.
More
Edge and serverless targets, Deploying.
Is This Page Useful?