Host on Netlify
Netlify runs the app as WebAssembly in a function, or in an edge function with --edge.
Build
rustup target add wasm32-unknown-unknown # once
wisp build --target netlify # dist/netlify
wisp build --target netlify --edge # edge function
In Netlify's CI a plain wisp build picks the target from NETLIFY.
Deploy
From dist/netlify:
npx netlify deploy --prod
wisp deploy init netlify writes a GitHub Actions workflow that builds and deploys on push to main. It reads the secrets NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID.
Environment
WISP_SECRETas an environment variable of the site, 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; the scheduled function sends it.- Environment variables.
Limits
- Per route:
const RUNTIME: wisp::Runtime = wisp::Runtime::Edge;puts a route on the edge; the rest stay on the function. See Edge runtime per route. - Edge functions have the edge limits (no
std::fs,std::thread,std::process,std::net, websockets); the build stops, naming the route, if an Edge route uses them. - WebSockets answer 501; use
Response::events(SSE). Streaming is live. - Netlify keeps the instance alive (
waitUntil) for started timers and fetches. - Cron:
wisp::cronbecomes a scheduled function. With--edgethere is no trigger to write: the build says so and stops. wisp::channel,wisp::everyandRateLimitare not in the edge build.
Files and Data
static/goes topublic, which Netlify serves; with--edgethe edge function skips it viaexcludedPath.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?