March 25, 2023

top rust frameworks

I researched the top Rust web frameworks by examining various sources, including blog posts, Reddit discussions, and GitHub repositories. The sources provided a range of opinions and recommendations on the best Rust frameworks for frontend and backend development. There was some consensus among the sources, but also differing opinions on specific frameworks. Overall, the sources were related to the original query, and I have a moderate level of certainty in the information gathered.

Have an opinion? Send us proposed edits/additions and we may incorporate them into this article with credit.

Words

385

Time

3m 42s

Contributors

263

Words read

38.4k

Actix-Web
Axum

Axum

Axum is a Rust web framework that is part of the Tokio project and is backed by a very active developer in the Rust community. It is considered versatile, powerful, and has a fantastic middleware API. Axum is also mentioned as a recommended alternative to Actix-Web due to some issues with Actix-Web. However, it is worth noting that Axum has been reported to have lower performance compared to its peers in some categories.
Rocket
Tide

Tide

Tide is a Rust web framework that provides a clean and easy-to-use API for building web applications, similar to Axum but does not use Tokio. Users highlighted the speed and activity of the Tide framework, but mentioned a lack of well-established third-party middleware as a downside.

Poem

Poem is a Rust web framework known for its speed and stability, with similarities to Axum and Tide. Users appear to enjoy working with Poem due to its stability.

Warp

Warp is a fast, flexible web server framework built on top of Tokio, praised for its declarative nature and being the most "no-magic" of frameworks, giving developers more confidence.

Jump to top

Research

"https://www.atatus.com/blog/web-frameworks-designed-for-rust/"

  • Rust is a modern programming language that has been named the “most loved programming language” in the Stack Overflow Developer Survey since 2016
  • Rust is highly regarded by the development community for its memory safety and similar syntax to C++
  • Only 7% of respondents in the survey claimed to use the language despite its strong reputation
  • Rust is a general-purpose language supported by several frameworks that enable the creation of a variety of things, including websites, games, and GUIs
  • A web framework is a software tool that aids in the creation of web applications by offering libraries that handle databases, templating, sessions, migration, and other tools
  • Simpler frameworks place a greater emphasis on frontend management for rendering static information, while the most complete web frameworks offer libraries for handling a range of web services, web resources, and web APIs that development teams might require.
  • The relative importance of security, flexibility, community growth, and project size should be considered before selecting the best web framework for a project
  • The following are the top 11 Rustlang frameworks that users can pay attention to:
    • Tauri: a framework for creating small, fast binaries for popular desktop operating systems
    • Yew: a cutting-edge Rust framework for building WebAssembly multi-threaded frontend web applications
    • Rocket: a highly adaptable and universal framework prioritizing speed and type safety, which is completely generated code automatically
    • Actix Web: a quick, secure, and simple framework, providing high performance and stable usage
    • Juniper: a Rust framework that allows developers to create type-safe and fast GraphQL servers
    • Dioxus: a React-like design-based UI framework for creating cross-platform apps
    • Stdweb: a frontend standard library allowing Rust to interact directly with JavaScript web APIs
    • Percy: a Rust library for creating frontend web applications that are driven by WebAssembly
    • Sycamore: a Rust framework that is similar to SolidJS in speed, ease, and use for building Rust net purposes that utilize web abilities.
    • Gloo: a modular toolkit providing Rust wrappers for browser APIs, making it simpler to use those APIs
    • Seed: a Rust frontend framework for building fast and dependable web applications, entirely written in Rust
  • Atatus is a Full Stack Observability Platform that offers Application Performance Monitoring, Real User Monitoring, Server Monitoring, Logs Monitoring, Synthetic Monitoring, Uptime Monitoring, and API Analytics, which can be beneficial to businesses to provide a comprehensive view of

"https://www.lpalmieri.com/posts/2020-07-04-choosing-a-rust-web-framework-2020-edition/"

  • As of July 2020, the main web frameworks in the Rust ecosystem are actix-web, rocket, tide, and warp.
  • actix-web, tide and warp are slim web frameworks, offering an HTTP web server, routing logic, middleware infrastructure, and building blocks and abstractions to parse, manipulate, and respond to HTTP requests. rocket, on the other hand, aims to be batteries-included, covering most common needs through functionality provided by rocket itself, with hooks for users to extend it if needed.
  • actix-web-extras includes some optional modules that users may find helpful, such as a middleware module, a session module, and a validation module.
  • Total downloads and daily downloads are good gauges for adoption and community size. Looking at crates.io, actix-web has the most number of total and daily downloads, followed by rocket, warp, and tide.
  • The number of supporting crates for a framework correlates with the size of its community and adoption. When searching for a framework on crates.io, one should have a quick look for functionality that will be needed. For example, if adding Prometheus’ metrics to a API is needed, actix-web-prom or rocket-prometheus can be used, both with thousands of downloads. However, if using warp or tide, it is necessary to write the integration from scratch.
  • The lack of async support in rocket should not be a primary concern if strict performance requirements are not needed in an application.
  • Comparing tokio and async-std as the two main general-purpose async runtimes available in Rust, tokio has more total and daily downloads than async-std, but with a larger and more complex API surface. Meanwhile, async-std provides great ergonomics with less room for configuration knobs.
  • Good documentation, tutorials, and fully-featured examples are mission-critical when working as part of a team, especially if one or more teammates are not experienced Rust developers. Good documentation is a norm in Rust’s culture, and most library authors take it seriously, with web frameworks being no exception.
  • None of the frameworks are perfect, and a choice has to be made in considering trade-offs. As of July 2020, actix-web is a good option to pick for a production-ready API in Rust, with its extensive production

"https://ourcodeworld.com/articles/read/1823/the-best-rust-web-frameworks-in-2023"

  • The webpage discusses the best web frameworks for Rust in 2023.
  • Rust is a programming language that is fast, safe, and provides many perfect features for building web applications.
  • The following are some of the best frameworks and their features:
    • Rocket: simple to write fast web applications without sacrificing flexibility or type safety; follows a “convention over configuration” philosophy; integrates tightly with the Rust ecosystem; and an example code.
    • Tide: provides a clean and easy-to-use API for building web applications; asynchronous/await support; type safe routing; request guards; templating support; session management; websockets support; and an example “Hello, World” code.
    • Actix-web: high-speed web framework written in Rust; supports multiplexing; asynchronous I/O; WebSockets; Middleware support; and an example “Hello, World” code.
    • Warp: fast, flexible web server framework built on top of tokio; automatic TLS; HTTP/2 support; Server-Sent Events (SSE); Websockets; Path parameters; Query parameters; JSON body parsing; Multipart forms; Static file serving; and an example “Hello, World” app code.
    • Axum: designed to be fast, efficient, and lightweight; the Erlang programming language inspires it, providing developers with a high concurrency level; perfect for building microservices, real-time applications, and low-latency systems; Erlang-inspired actor model for concurrency; low-latency and high performance; support for WebSockets and other protocols; asynchronous I/O; and an example “Hello, World” app code.
    • Hyper: built on top of the Rust standard library and provides support for a wide range of features; asynchronous I/O; HTTP2 support; fast and lightweight; easy to use, and it has excellent documentation; and an example “Hello, World” app code.
  • All of them have strengths and weaknesses, so it’s up to the user to decide which is best for their needs.
  • Rust web frameworks offer advantages over other frameworks including excellent performance, superior memory safety, a wide range of features, and easy-to-use.
  • If the user is looking for a Rust web framework that can offer these benefits, then they should definitely check out one of these frameworks. They are excellent choices for developing web applications.

"5 of the Top 10 Fastest Web Server Frameworks are Written in Rust - TechEmpower Round 21"

  • The webpage discusses the top-performing web server frameworks in Rust based on the TechEmpower Round 21 benchmarks.
  • The benchmarks compare the performance of various web server frameworks using different tests, such as plaintext, JSON, and queries.
  • The composite score table displays the relative scores of the top-performing frameworks, with their language and framework name.
  • The frameworks are ranked based on their relative performance scores in each category and their aggregated composite score.
  • The top-performing Rust frameworks include Just, May-minihttp, Xitca-web, Drogon, Actix, Salvo, and Axum.
  • A comment notes that Axum has lower performance compared to its peers, with a score lagging behind other Rust frameworks by ~8-16% in some categories.
  • A GitHub issue thread titled “Performance issues with axum JSON serialization” discusses potential reasons for Axum’s lower performance in the JSON serialization category.
  • Some commenters note that Axum’s lower performance might be due to its routing and boxing, which works better for real apps that have more than one route but less so for micro benchmarks with one or two routes.
  • Another comment suggests that some other frameworks are using weird hacks to improve their JSON serialization response times, such as manually writing the serialization code instead of using a library.
  • The tests used in the benchmarks have rigid guidelines to prevent contestants from cheating and using unrealistic implementations.
  • A screenshot from the TechEmpower Twitter account ranks Axum as the third fastest framework in the JSON serialization category.
  • Some comments note that Django and Ruby on Rails frameworks perform poorly due to the languages they are written in, which are interpreted and make them slower compared to Rust’s compiled language.
  • A comment points out that the differences in performance between HTTP/1 and HTTP/2 are not significant, and that benchmarks should target both to have wider coverage.
  • Some commenters discuss Just, a JavaScript web server framework, that has a large portion of its codebase in C++, which helps with its performance.
  • The comment section includes some discussions on different aspects of the benchmarks, such as header returns in real applications and the bias introduced by the benchmark tool (wrk) used to evaluate the performance of the frameworks.

"https://blog.logrocket.com/current-state-rust-web-frameworks/"

  • Rust is an open source, fast, reliable, and high-performance programming language.
  • Web frameworks make web development and building desktop applications easier for developers. By standardizing the building process and automating common activities and tasks, web frameworks can save developers time and even promote reusing code to increase efficiency.
  • A web framework is a software tool that supports the development of web applications; a web framework can range from a small codebase for micro apps to a large codebase for enterprise apps and everything in between.
  • Rust provides various web frameworks for backend development, including a combination of tools, helpers, and libraries from different vendors that are each designed to provide a way to build, test, and run apps with efficiency, security, and flexibility.
  • The article recommends the following frontend Rust web frameworks:
    • Stdweb - Stable: yes, Production-ready: no, Project size: Small
    • Yew - Stable: no, Production-ready: no, Project size: Small, medium, and large
    • Percy - Stable: no, Production-ready: no, Project size: Small, medium, and large
    • Smithy - Stable: no, Production-ready: no, Project size: Small
    • Sauron - Stable: no, Production-ready: no, Project size: Small
    • Dioxus - Stable: no, Production-ready: no, Project size: Small, medium, and large
    • Iced - Stable: no, Production-ready: no, Project size: Small or medium
    • Tauri - Stable: yes, Production-ready: no, Project size: Small or medium
  • The article recommends the following backend Rust web frameworks:
    • Rocket - Stable: no, Production-ready: no, Project size: Small, medium, large
    • Actix - Stable: yes, Production-ready: yes, Project size: Small or medium
    • Axum - Stable: no, Production-ready: no, Project size: Medium, large
    • Warp - Stable: no, Production-ready: no, Project size: Small, medium
    • Gotham - Stable: yes, Production-ready: no, Project size: Small, medium, large
    • Rouille - Stable: yes, Production-ready: yes, Project size: Small, medium
    • Thruster - Stable: yes, Production-ready: yes, Project size: Small, medium, large
    • Tide - Stable: yes, Production-ready: no, Project size

"https://blog.logrocket.com/top-rust-web-frameworks/"

  • Rust is a popular language among developers for its open source, fast, reliable, and high-performance features.
  • A web framework is a software tool that supports the development of web applications; it can range from a small codebase for micro apps to a large codebase for enterprise apps.
  • The most extensive web frameworks provide libraries of support for databases, templating, sessions, migration, and other utilities to speed up the development process.
  • Web frameworks make web development and building desktop applications easier for developers by standardizing the building process and automating common activities and tasks.
  • Rust web frameworks are categorized into frontend web frameworks for building user interfaces and backend web frameworks for server-side operations of web apps.
  • WebAssembly (Wasm) is a type of coding in low-level languages that can be run in modern web browsers, and Rust uses a tool called ‘wasm-pack’ to assemble and package crates that target Wasm.
  • Frontend Rust web frameworks include:
    • Stdweb, a frontend standard library that gives Rust the power to communicate directly with JavaScript web APIs.
    • Yew, a component-based framework similar to React and Elm, with support for multi-threading and other features similar to Stdweb.
    • Percy, a toolkit developed for building single-page apps (SPAs) and managing UI, including optimization for specific browsers and screen sizes.
    • Sauron, a micro frontend framework that was inspired by The Elm Architecture with support for events, state management, and components.
    • Dioxus, a UI library designed to be React-like that is built around a virtual DOM to support building cross-platform apps.
    • Iced, a GUI library for cross-platform development that supports reactive programming, inbuilt widgets, and async with a modular/reusable component-based architecture.
    • Tauri, a Rust library built as a light JavaScript framework for building desktop applications with the integration of any frontend technology that renders HTML, CSS, and JavaScript into your web view for its UI.
  • Backend Rust web frameworks include:
    • Rocket, a popular web framework that makes it easy for developers to write fast web apps without skimping on security, flexibility, or function with support for testing libraries, cookies, streams, routes, templates, databases, ORMs, and more.
    • Actix, another powerful backend web framework with an architectural pattern based on Rust’s actor system with support for routing, middleware, testing, WebSockets, databases, and automatic server reloading that can be hosted on Nginx,

"Which Rust web framework to choose in 2022 (with code examples)"

  • Actix-Web:

    • A Rust web framework that uses Tokio library for handling connections.
    • Multiple commenters mention that the creators have paused development.
    • Users recommend Axum as an alternative, backed by Tokio.
    • Mentioned as being very fast, but complicated to work with.
  • Axum:

    • A Rust web framework.
    • Axum is part of the Tokio project and its users can use Tokio-based libraries with it.
    • It is backed by a very active developer in the Rust community.
    • Mentioned as being versatile, powerful, and favored due to having a fantastic middleware API.
    • One user recommended it over Actix-web because of papercuts in Actix-web.
  • Rocket:

    • A Rust web framework.
    • Commenters show interest in a potential lack of maintainer support, with one user stating that using the framework should only be done as a last resort.
  • Tide:

    • A Rust web framework somewhat similar to Axum but does not use Tokio.
    • Users reported a lack of well-established third-party middleware as being a downside of Tide.
    • Users recommended Tide for being speedy and that it had sufficient activity with only three or four core maintainers.
  • Poem:

    • A Rust web framework that is known for its speed with similarities to Axum and Tide.
    • Users appear to enjoy working with Poem because of its stability.
  • Warp:

    • A Rust web framework with a declarative nature.
    • Users find it to be the most “no-magic” of frameworks and the one that gives the most confidence.
  • Handling Routes in Actix-Web:

    • Actix-Web is flexible with numerous ways of handling routes with no recommended approach.
    • Several examples of code snippets are given to show developers how to handle routes.
    • Users generally recommend using of specific types like Path or Json, rather than the original request, and manually getting data from it.
    • One user found the middleware API in Axum superior to Actix-Web and was a reason for their choice to switch.
  • Rocket User’s Mention of Async Support for Rocket 5.0:

    • A comment highlights that async support will come with Rocket 5.0.
    • Another user finds it interesting that Rocket is not included despite being more popular on GitHub than other web frameworks

💭  Looking into

Comparison of Rust Frameworks

💭  Looking into

List of Top Rust Frameworks