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

Wisp

Host on Node

The node target runs the app as WebAssembly under Node 20 or newer. It is the target for Amplify, Firebase, Azure, Stormkit, Zeabur and any other Node host. For your own server, the native binary is faster and has more features.

Build

rustup target add wasm32-unknown-unknown     # once
wisp build --target node                     # dist/node (--out <folder>)

In AWS Amplify's CI a plain wisp build picks node from AWS_APP_ID.

Deploy

From dist/node:

npm start

It runs node server.mjs and listens on $PORT. The output's hosts/ folder has a note for each host (amplify.md, firebase.md, azure.md, stormkit.md, zeabur.md) with its manifest or function glue.

Environment

  • WISP_SECRET: set it in the host's environment settings, for an app that signs cookies.
  • Read other values with wisp::env("KEY") (std::env::var sees nothing).
  • WISP_NODE_HTTP=1 serves with node:http.
  • WISP_KEEP_ALIVE_TIMEOUT: seconds a kept-alive connection may sit quiet, 65 by default (past the 60 s of a load balancer such as AWS's in front). See Environment variables.

Limits

  • The app's own HTTP/1.1 parser answers over raw sockets. At startup a request over loopback must be answered as the app answers it (twice, on one connection); if not, or with WISP_NODE_HTTP=1, it serves with node:http (one stderr line says which). Only that path reads at most WISP_BODY_LIMIT (default 1 MB) of a body and answers 413 past it.
  • WebSockets work: Wisp's parser on the raw socket, or the upgrade event with WISP_NODE_HTTP=1. Streaming is live.
  • SIGTERM or Ctrl+C stops taking connections, lets the requests under way finish, and exits once the connections have ended, after 8 s at the latest (Docker and Cloud Run kill at 10 s). A kept-alive raw connection closes after its reply under way, an idle one at once, so the exit comes when the replies end. A second signal exits at once.
  • No threads or files: use wisp::spawn and wisp::sleep. See What works on the edge.
  • There is no cron trigger to write: the build says so and stops when the app uses wisp::cron.

Files and Data

  • Table::saved and Rest are per-instance memory unless WISP_STORE is set (libsql://; see Saved tables).
  • wisp::kv and wisp::blobs need a driver: WISP_KV_<NAME>=upstash, WISP_BLOB_<NAME>=s3:<endpoint>/<bucket>. See Storage.

More

Host on Azure, Edge and serverless targets, Deploying.

Is This Page Useful?

View This Page's Source

Type to search every docs page and heading.