Wisp is in pre-release, self-hosted since GitHub suspended us. Install it, or see the changelog.

Wisp

Host on Azure

Azure takes Wisp three ways: a container (Container Apps), the Node build (App Service), or Static Web Apps with an HTTP function.

Build

Container:

wisp deploy init docker

App Service and Static Web Apps (Node 20 or newer):

rustup target add wasm32-unknown-unknown     # once
wisp build --target node                     # dist/node

Deploy

  • Container Apps: build the Dockerfile as it is. See Host with Docker.
  • App Service or Container Apps with the Node build: deploy dist/node. It runs npm start, which listens on $PORT.
  • Static Web Apps: dist/node/azure is ready to deploy. azure/public holds the static files and staticwebapp.config.json; azure/api is the managed function (Functions v4, Node 20) that is the app.
npx @azure/static-web-apps-cli deploy dist/node/azure/public \
  --api-location dist/node/azure/api --api-language node --api-version 20

In the Static Web Apps GitHub Action, set app_location: dist/node/azure/public, api_location: dist/node/azure/api and skip_app_build: true.

Static Web Apps

Managed functions answer under /api only, so staticwebapp.config.json sends every request the static files do not answer to /api/wisp: GETs by navigationFallback, and POST, PUT, PATCH, DELETE and OPTIONS by a routes rewrite (a fallback takes only navigations, so a form's POST would never reach the app); a first rule for /.auth/* keeps Static Web Apps' own sign-in routes off the app, since the first match wins (configuration). The function reads the address asked for from x-ms-original-url, and:

  • keeps every cookie: each set-cookie goes as one of the response's cookies (Azure's headers hold one value per name, so a second would replace the first);
  • reads a request's body only up to the route's limit (WISP_BODY_LIMIT or BODY_LIMIT), so a large upload is answered 413 without being held whole, and gives the app the site's host from x-ms-original-url;
  • passes the client's address from x-client-ip, which Azure's front end sets and overwrites (a client cannot send its own), without its port;
  • streams a streamed reply as it comes (app.setup({ enableHttpStream: true }), @azure/functions 4.3 and Functions host 4.28 or newer).

A copy of the app (server.mjs, bridge.mjs, app.wasm) sits in azure/api, since Static Web Apps deploys that folder on its own. A staticwebapp.config.json of your own in static/ replaces Wisp's.

Managed functions take HTTP triggers only, so wisp::cron and wisp::work have no timer there. The build stops for an app that uses them, as for the other Node hosts. Host such an app on Container Apps with the container build, which runs jobs itself.

Environment

  • WISP_SECRET: set it in the service's application settings, for an app that signs cookies.
  • Other variables: Environment variables.

Limits

  • A container build has no edge limits and runs the full feature set.
  • The Node build has the edge limits (WebSockets work), and no std::fs, std::thread, std::process or std::net; use wisp::spawn and wisp::sleep. See Host on Node and What works on the edge.

Files and Data

  • Container: saved tables live in /data; give it storage that outlives the instance.
  • Node build: tables are per-instance memory unless WISP_STORE is set. See Where rows are kept.
  • wisp::kv and wisp::blobs: files (fs) in the container; the Node build needs a driver such as upstash or s3:. See Storage.

More

Edge and serverless targets, Deploying.

Is This Page Useful?

View This Page's Source

Type to search every docs page and heading.