Wisp

Type to search every docs page and heading.

Host on Bun

Bun runs the app as WebAssembly, serving raw sockets with Bun.listen. For a plain server, the native binary is faster and has more features.

Build

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

Deploy

From dist/bun:

bun server.mjs

The folder's package.json has "start": "bun server.mjs". Copy the folder to the machine and run it there.

Environment

  • WISP_SECRET: set it in the process environment, for an app that signs cookies.
  • Read other values with wisp::env("KEY") (std::env::var sees nothing).
  • WISP_NODE_HTTP=1 serves with Bun.serve instead of Bun.listen. See Environment variables.

Limits

  • The app's own HTTP/1.1 parser answers over raw sockets (pipelining, keep-alive, chunked bodies, 413, 431 and each route's BODY_LIMIT). At startup a request over loopback must be answered as the app answers it (twice, on one connection); if not, it serves with Bun.serve and one stderr line says so.
  • WebSockets answer 501; use Response::events (SSE).
  • 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).

More

Edge and serverless targets, Deploying.

Is This Page Useful?

Edit This Page