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

Wisp

Wisp: A Fast, Fun Web Framework for Rust

File routes, Rust templates, form actions and NPM packages. Wisp builds your whole app into one binary.

cargo install --git https://wisp.ar0.eu/ --tag v1.0.0-pre.3 wisp-web

Learn Wisp API Reference

src/routes/+page.wisp
---
#[model]
struct Todo {
    #[validate(len = 1..=100)]
    text: String,
}

static TODOS: Table<Todo> = Table::saved();

#[action]
fn add(todo: Todo) {
    TODOS.add(todo)?;
}

#[action]
fn remove(id: u64) {
    TODOS.remove(id)?;
}
---

<title>Todos (${TODOS.len()})</title>
<meta name="description" content="A todo list that saves its rows and checks what you add.">
<h1>Todos</h1>

<form action="?/add" fields />

{#each TODOS.all() as todo}
  <p> ${todo.text}
    <button action="?/remove&id=${todo.id}">
      Remove
    </button>
  </p>
{/each}
localhost:3000

Todos (3)

  • Buy milk
  • Write the docs
  • Learn to code

A Page Is One File

Put the model, the form actions and the markup of a page in one file. Wisp compiles the file to Rust, so the compiler checks your template as it checks the rest of your code.

Benchmarks

Each framework runs on the same machine with a release build. The charts show every contender, also the tests where Wisp loses.

TechEmpower plaintext and JSON tests. Not an official TechEmpower result.

Plaintext, pipelinedreq/s, 16 requests per write, best of 256 to 16,384 connections
Wisp 8,140,071
Actix Web 3,584,014
Axum 2,390,269
Hono (Bun) 603,962
Fastify 414,802
Express 278,367
Hono (Node.js) 217,621
Nuxt 165,092
SvelteKit 104,899
Next.js 15,129
JSONreq/s, one request per write, best of 16 to 512 connections
Wisp 1,160,729
Actix Web 878,655
Axum 749,723
Hono (Bun) 526,427
Fastify 323,353
Express 241,238
Hono (Node.js) 190,174
Nuxt 187,113
SvelteKit 96,149
Next.js 8,639
Text Reply, GET /req/s
Wisp 282,805
Fastify 138,978
Hono 134,428
Express 90,808
HTML Page of 1,000 Rowsreq/s
Wisp 15,217
Fastify 4,312
SvelteKit 2,252
JSON of 200 Objectsreq/s
Wisp 43,720
Fastify 27,286
Hono 27,096
Express 21,272
Next.js 5,060
Path, Query and Cookie Parsingreq/s
Wisp 261,630
Fastify 127,917
Hono 107,559
Express 83,322
Next.js 4,528
Cold Startms
Wisp 26
SvelteKit 42
Fastify 62
Next.js 155
Memory Under Load (RSS)MB
Wisp 80
Fastify 234
Express 241
Hono 248
Next.js 517
SvelteKit 614
Text Reply, GET /req/s
Wisp 407,546
Elysia 392,406
Hono 370,767
JSON of 200 Objectsreq/s
Wisp 53,412
Hono 39,021
Elysia 38,826
Path, Query and Cookie Parsingreq/s
Wisp 365,756
Hono 280,910
Elysia 245,795
Cold Startms
Hono 7
Wisp 11
Elysia 20
Memory Under Load (RSS)MB
Wisp 48
Hono 70
Elysia 83
Text Reply, GET /req/s
Hono 355,860
Wisp 298,471
Fresh 205,214
HTML Page of 1,000 Rowsreq/s
Wisp 13,176
Hono 4,841
JSON of 200 Objectsreq/s
Hono 40,377
Wisp 37,506
Fresh 36,492
Oak 35,709
Path, Query and Cookie Parsingreq/s
Hono 251,174
Wisp 223,894
Oak 133,827
Fresh 80,792
Cold Startms
Wisp 18
Fresh 24
Oak 38
Memory Under Load (RSS)MB
Wisp 60
Hono 113
Oak 154
Fresh 175
Text Reply, GET /req/s
Wisp 42,503
Hono 41,176
itty-router 38,123
Astro 23,753
SvelteKit 19,931
React Router 18,999
Next.js 2,608
HTML Page of 1,000 Rowsreq/s
Wisp 10,916
Astro 4,083
SvelteKit 2,338
Next.js 195
JSON of 200 Objectsreq/s
Wisp 20,548
Hono 19,102
itty-router 18,210
React Router 11,936
Next.js 2,039
Path, Query and Cookie Parsingreq/s
Wisp 39,731
Hono 37,523
Astro 21,396
React Router 16,535
Next.js 2,163
Cold Startms
itty-router 12
Hono 13
Wisp 19
SvelteKit 20
React Router 23
Astro 30
Next.js 92
Memory Under Load (RSS)MB
Hono 335
Wisp 369
React Router 440
itty-router 479
Astro 553
Next.js 923
SvelteKit 1,491
HTML Page of 1,000 Rowsreq/s
Axum 57,053
Actix Web 55,863
Wisp 54,292
ASP.NET Core 25,466
Spring Boot 25,449
Fastify 8,527
Express 8,438
FastAPI 5,039
SvelteKit 3,675
Go Gin 3,099
Next.js 257
JSON of 200 Objectsreq/s
Hono (Bun) 74,533
Wisp 69,166
Fastify 60,713
Actix Web 58,507
Express 54,097
ASP.NET Core 53,121
Go Gin 44,635
SvelteKit 35,856
Next.js 6,958
FastAPI 1,955
Memory Under Load (PSS)MB
Actix Web 3
Axum 4
Wisp 5
Go Gin 21
Hono (Bun) 45
ASP.NET Core 86
FastAPI 103
Fastify 186
Express 398
Spring Boot 778
Next.js 961
SvelteKit 3,429

How we measured, and the full tables

Forms Without JavaScript

Rules on the model check each value on the server. A bad value comes back with its error next to the input, and the form works without JavaScript.

#[model]
struct User {
    #[unique]
    email: Email,
    password: Password,
}
pub static USERS: Table<User> = Table::saved();
---
#[action]
fn signup(email: Email, password: Password) {
    cx.signup(User { email, password }).await?;
    redirect("/me")
}
---

<form action="?/signup" fields>
  <button>Sign up</button>
</form>

Reactivity in the Same File

Server values render in Rust when the page loads. Browser state lives in the same file and updates the page when it changes.

---
let name = cx.query_or("name", "world".to_string());
---

<h1>Hello, ${name}!</h1>

<button on:click="count++">Clicked {:count} times</button>

NPM Packages in the Browser

Add a package with wisp npm add, then import it in a page script. The build keeps a copy of the package, so you do not need Node.

wisp npm add canvas-confetti
+page.wisp
<button on:click="party()">Ship it</button>

<script lang="ts">
  import confetti from 'canvas-confetti'

  function party() {
    confetti({ particleCount: 120, spread: 70 })
  }
</script>

NPM in browser code · React, Vue and Svelte islands

Fewer Tokens

Less code for you to write, and fewer tokens when an AI writes it. We wrote one small app in each stack and counted its tokens.

StackRelative sizeTokensFiles
Wisp 477 7
Nuxt 1,043 8
SvelteKit 1,134 9
Next.js 1,146 8
Express 1,297 8
React 1,599 9
Axum 1,803 7
Actix Web 1,878 7
claude mcp add wisp -- wisp mcp

How Tokens Are Counted

Editors

wisp lsp gives highlighting, completion, hover docs and diagnostics. The hover docs come from the Wisp source: its doc comments and its hover tables.

One Binary

wisp build makes one binary that serves the whole app. You can also ship a container, static HTML, or an edge build.

wisp build
wisp build --static
wisp deploy init docker
wisp build --target cloudflare
wisp deploy init cloudflare

Install Wisp

cargo install --git https://wisp.ar0.eu/ --tag v1.0.0-pre.3 wisp-web

Learn Wisp

Type to search every docs page and heading.