Wisp - A fast, fun web framework for Rust
Hi, I built Wisp, a web framework for Rust. Here is a 90-second video of it: https://www.youtube.com/watch?v=g0LPPzrQux8 The idea: a folder is a URL, and its +page.wisp file is the page. The top of the file is a short block of Rust that loads data and handles forms, and the rest is markup. The templates compile to Rust, so the compiler checks your markup, and the whole app (styles and static…
Wisp is a fast, user-friendly web framework designed for the Rust programming language. The framework enables developers to build websites and applications with ease, as it utilizes a unique approach where a folder represents a URL, and a page.wisp file is used to generate the content for that URL. The top portion of the file is written in Rust, allowing for the loading of data and handling of forms, while the rest of the file contains markup.
The templates compile to Rust, ensuring that the compiler can check the markup for any errors. The entire application, including styles and static files, is packaged into a single binary.
One of the key features of Wisp is its handling of forms, which work seamlessly even without JavaScript. Server-side validation is performed using #[action] handlers, which update the page in place when JavaScript is enabled. Reactivity is achieved within the same file, using directives such as on:click= count++ and {:count}, eliminating the need for separate components. Wisp also offers a simple way to add browser code packages using wisp npm add, without requiring any Node.js installation.
Developers can utilize a package for coding agents, which provides them with the framework's documentation and a checker, ensuring that their changes are valid. Wisp can be hosted on a developer's own server using the wisp host command, or it can be deployed to platforms like Cloudflare, Deno Deploy, Vercel, Netlify, AWS Lambda, Bun, and Node.js. The framework does not include an authentication or database layer, allowing developers to choose their preferred options.
Wisp comes with various tools, such as tables, signed cookies, hooks, and uploads, which developers can choose from. The small test application is 477 tokens in Wisp and 1,043 tokens in Nuxt, making it 2.2x to 3.9x smaller than the Nuxt version. Wisp is currently in a pre-release stage (1.0.0-pre.3), and it is licensed under the MIT license.
The source code is available at https://code.wispweb.dev/wispdev/wisp, and it is expected to be moved to GitHub and crates.io with version 1.0. To try out Wisp, users can install it using 'cargo install --git https://wisp.ar0.eu/ wisp-web', create a new project with 'wisp new my-app', navigate to the project directory with 'cd my-app', and start the development server with 'wisp dev'.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.