Rust web framework comparison
A comparison of some web frameworks written in Rust.
Table of Contents
- Server frameworks
- Client frameworks
- Frontend frameworks (WASM)
- Supplemental libraries
- Comparison
- Resources
Server frameworks
There are several interesting frameworks to build web applications with Rust:
- actix-web (homepage / repository / documentation / user guide)
- gotham (homepage / repository / documentation / examples)
- iron (homepage / repository / documentation)
- nickel (homepage / repository / documentation)
- rocket (homepage / repository / documentation)
- rouille ( - / repository / documentation)
- Thruster ( - / repository / documentation / examples)
- Tide ( - / repository / documentation / examples)
- tower-web ( - / repository / documentation / examples)
- warp ( - / repository / documentation / examples)
If you need a more low level control you can choose between these libraries:
- hyper (homepage / repository / documentation)
- tiny-http ( - / repository) / documentation)
- h2 ( - / repository / - )
Outdated server frameworks
Client frameworks
To build web clients with Rust, you can choose between these libraries:
- actix-web (homepage / repository / api docs)
- reqwest (- / repository / documentation)
- hyper (homepage / repository / documentation)
- jsonrpc (- / repository / documentation)
Outdated client frameworks
Frontend frameworks (WASM)
Since WASM support is available in most browsers we can use Rust to build web applications :)
- stdweb ( - / repository / documentation ) A standard library for the client-side Web
- yew ( homepage / repository / documentation ) - A frontend framework inspired by Elm and React (based on stdweb)
- percy ( homepage / repository / - ) - A modular toolkit for building isomorphic web apps
- seed ( homepage / repository / - ) - A Rust framework for creating web apps
- draco ( - / repository / documentation ) - A frontend framework inpired by Redux and Elm
- smithy (homepage - / repository / - documentation ) - A front-end framework
- squark ( - / repository / documentation ) - Rust frontend framework, for web browser and more.
- willow ( homepage - / repository / - ) - A frontend framework inspired by Elm
- dodrio ( - / repository / documentation ) - A fast, bump-allocated virtual DOM library.
- dominator ( - / repository / documentation - Zero cost declarative DOM library using FRP signals for Rust!.
- mika ( homepage / repository / - ) - A signal-based framework for building front-end app, it tries to help, but may cause annoyances.
Outdated frontend frameworks
- ruukh
- sauron ( - / repository / documentation - Sauron is an html web framework for building web-apps. It is heavily inspired by elm.
Supplemental libraries
Websocket
- websocket (homepage / repository / documentation)
- ws-rs (homepage / repository / documentation)
- tungstenite ( - / repository / documentation)
- actix-web (homepage / repository / documentation)
Templating
- tera (homepage / repository / documentation)
- mustache (- / repository / documentation)
- liquid (- / repository / - )
- handlebars (- / repository / documentation)
- horrorshow (- / repository / documentation)
- maud (homepage / repository / documentation)
- askama (- / repository / documentation )
- stpl (- / repository / - )
- ructe (- / repository / documentation )
- typed-html (- / repository / documentation )
Comparison
High-Level Frameworks, Name, rocket, iron, actix-web, nickel, gotham, rouille, Thruster, jsonrpc, tide, ---, ---, ---, ---, ---, ---, ---, ---, ---, ---, License,
,
,
,
,
,
,
,
,
, Version,
,
,
,
,
,
,
,
,
, Github Stars,
,
,
,
,
,
,
,
,
, Contributors,
,
,
,
,
,
,
,
,
, Activity,
,
,
,
,
,
,
,
,
, Server, yes, yes, yes, yes, yes, yes, yes, no, yes, Client, no, no, yes, no, no, no, no, yes, no, Base framework, hyper, hyper, tokio, hyper, hyper, tiny-http, tokio, hyper, hyper, HTTPS support, yes, yes, no, yes, ?, -, HTTP/2 support, ?, yes, ?, no, ?, ?, Async, no, yes, yes, yes, yes, Stable Rust, no, yes, ### Low-Level Frameworks, Name, hyper, h2, tiny-http, ---, ---, ---, ---, License,
,
,
, Version,
,
,
, Github Stars,
,
,
, Contributors,
,
,
, Activity,
,
,
, Server, yes, yes, yes, Client, yes, yes, ?, HTTPS support, yes, no, yes, HTTP/2 support, solicit, yes, ?, Async, yes, yes, ### Frontend Frameworks, Name, yew, stdweb, percy, dodrio, seed, draco, squark, willow, smithy, ---, ---, ---, ---, ---, ---, ---, ---, ---, ---, License,
,
,
,
,
,
,
,
,
, Version,
,
,
,
,
,
,
, no,
, Github Stars,
,
,
,
,
,
,
,
,
, Contributors,
,
,
,
,
,
,
,
,
, Activity,
,
,
,
,
,
,
,
,
, Stable Rust, yes, yes, no, ?, yes, yes, no, no, no, Base framework, stdweb, -, wasm-bindgen, wasm-bindgen, wasm-bindgen, wasm-bindgen, wasm-bindgen, wasm-bindgen, wasm-bindgen, Virtual DOM, yes, ?, yes, yes, yes, yes, yes, ?, yes, ### Middleware & Plugins, Name, iron, gotham, nickel, rouille, actix-web, -------------------------, ------------------------------------------, ------, -----------------------------------------------------, -------, -----------------------------------------------------------------------, Static File Serving, yes, no^, yes, n/a, yes, Mounting, yes, yes, yes, n/a, yes, Logging, yes, yes, no, n/a, yes, JSON-Body-Parsing, yes, yes, yes, n/a, yes, Sessions, yes, yes, ?, n/a, yes, Cookies, yes, yes, ?, n/a, yes, PostgreSQL middleware, ?, no^, yes, n/a, yes, SQLite middleware, ?, no^, yes, n/a, yes, Redis middleware, ?, no^, yes, n/a, yes, MySQL middleware, ?, no^, yes, n/a, yes, (^ Planned in current roadmap)
Websocket Libraries, Name, websocket, ws-rs, twist, tungstenite, actix-web, ---, ---, ---, ---, ---, ---, License,
,
,
,
,
, Version,
,
,
,
,
, Github Stars,
,
,
,
,
, Contributors,
,
,
,
,
, Activity,
,
,
,
,
, Server, yes, yes, yes, yes, yes, Client, yes, yes, yes, yes, yes, Base framework, - / tokio, mio, tokio, - / tokio, tokio, Async, no / yes, yes, yes, no / yes, yes, ## Examples
To compile or run the examples use Cargo.
First clone this repo
git clone https://github.com/flosse/rust-web-framework-comparison
cd rust-web-framework-comparison/
and change to the desired frameworkd directory (e.g. cd iron/
) and type
cargo run --example hello_world
Then visit http://localhost:3000
to see the result.
Resources
Blog posts
2018
- Lessons learned on writing web applications completely in Rust
- Introducing Ruukh Framework
- Baby’s First Rust+WebAssembly module: Say hi to JSConf EU!
- Mix Rust Code (WebAssembly) with Vue Component
- Wicked Fast Web Servers in Rust
- Migrating to Actix Web from Rocket for Stability
- Creating a Rusty Rocket fuelled with Diesel
Until 2017
- Dose Response ported to WebAssembly!
- Rust and the case for WebAssembly in 2018
- wasm32-unknown-unknown landed & enabled
- How to Deploy a Rocket Application to Heroku
- Rust to WebAssembly, Made Easy
- Rust for the web
- Rocket on Fedora
- Announcing Gotham - A flexible web framework for stable Rust that does not sacrifice safety, security or speed.
- Announcing cargonauts - A Rust async web framework
- Writing a GitHub webhook with Rust! Part 1: Rocket
- Hello, Botket! (Rocket)
- Launching a URL Shortener in Rust using Rocket
- Rocket + sodiumoxide = ♥
- The Path to Rust on the Web
- Rendering Vector Map Tiles (Rust + asm.js demo)
- Compiling to the web with Rust and emscripten
- Basic 2FA in Rocket
- Building high performance REST APIs with Rust and Rocket
- Rocket Rocks! Using FromFormValue Traits to protect your website
- Building an Asynchronous Hyper Server
- JWT & Access Roles in Rocket
- Writing a basic JSON response web server in Rust using Iron
- Diesel Powered Rocket
- Using Stainless with Rocket
- Integration testing a service written in Rust and Iron
- Actually using Iron: A grumpy introduction to web development in Rust
- Using Rust for Webdev as a Hobby Programmer
- My adventures in Rust webdev
- Rust’s Iron Framework: First impressions
- Rust for Node.js developers
- A Rust-powered public web page in 5 minutes
- Rust and Rest
- Shipping forgettable microservices with Rust
- Writing a simple REST app in Rust
- Getting started with Rust
- Let's Build a Web Server in Rust
- Creating a basic webservice in Rust
- Iron on uWSGI
- Deploying a Rust App to Google App Engine
- async hyper
- Trying Rust for web services
- Are we web yet?
- Reimplementing ashurbanipal.web in Rust
- A web app with Nickel: From first line to Heroku deployment
- What features Iron does not have compared to a web server like nginx?
- Build an API in Rust with JWT Authentication using Nickel.rs
- Selective Middleware for Iron
- Rust for the Web - RESTful API in Rust, impressions
- Rust for Node developers
Demos
- exoskeleton - Iron
- Example webapp using React + Webpack - Iron
- rustwebapp - Iron and Postgres (r2d2)
- webrust - Iron and Postgres (r2d2)
- httptest - Iron
- nickel-todo-backend - Nickel and Postgres (r2d2)
- rust-playground - Iron
- rust-web-example - Iron + Diesel (r2d2) + Serde
- websocket chat - Actix: Browser Websocket + tcp chat
- diesel - Actix + Diesel
- json - Actix + serde_json or json_rust
Real-world web projects using Rust
- paste.rs - Rocket
- realworld-rust-rocket - Rocket + Diesel, medium.com clone example
- Portier - Iron and Redis
- yaus - Iron and SQLite
- racerd - Iron
- rust-passivetotal - Hyper
- mars - Hyper
- openfairdb - Rocket and Neo4j (r2d2)
- ruma - Iron and Posgres (diesel + r2d2)
- html2pdf - Iron
- Hagrid (keys.openpgp.org) - Rocket
JS & asm.js & WASM
- hellorust.com - a website with news, resources and demos
Examples
- rust-webapp-template - Template project for Rust web app using stdweb
- rust-todomvc - an example application build with webplatform
- wasm-experiments - experiments with
wasm32-unknown-unknown
Benchmark
- TechEmpower Web Framework Benchmarks
- web-frameworks - Measuring response times (routing times) for each framework (middleware). Each framework has to have two features; routing and parsing path parameters.