Rust Build static website [03]

Rust Build static website [03]

Dec 23, 2022·

3 min read

Recently, I have entered the stage of setting up a website and have also started development. After considering various factors, I thought that the website I set up would at most just post articles and not have too complex data, so I decided to set up a static website. In fact, I have already started development, but I still want to record the thought process.

When it comes to setting up a website using Rust, you definitely need to check out:

[Are we web yet?
AreWeWebYet gives insight on whether you can build your latest web-project on top of Rustarewewebyet.org](https://www.arewewebyet.org/ "arewewebyet.org")

[GitHub - flosse/rust-web-framework-comparison: A comparison of some web frameworks and libs written…
A comparison of some web frameworks written in Rust. This overview only contains frameworks that work on stable Rust.github.com](https://github.com/flosse/rust-web-framework-comparison "github.com/flosse/rust-web-framework-compar..")

There are comparisons of various frameworks in it. I have been investigating for a while without sleep. I saw that many people use Rust in the back-end products, and there are relatively few front-end products.

Reason :

Personally, I have not written any JS and am just starting to learn Rust, so my knowledge is from online research. Here are some reference links that I found particularly memorable, you can take a look and maybe have a different perspective from mine.

Most of this is due to the immaturity of the WebAssembly ecosystem, as well as the inflexibility of DOM or CSS operations. Putting aside these two disadvantages for now, it seems that the most popular frontend framework is Yew.

[GitHub - yewstack/yew: Rust / Wasm framework for building client web apps
Rust / Wasm framework for building client web apps - GitHub - yewstack/yew: Rust / Wasm framework for building client…github.com](https://github.com/yewstack/yew "github.com/yewstack/yew")

Regarding the first issue, I think it will not be solved in a day or two. As for the latter CSS part

[Styling Brainstorming · Issue #533 · yewstack/yew
I'd like to add a styling system to yew - not having a built-in way of styling components seems a bit unfinished to…github.com](https://github.com/yewstack/yew/issues/533 "github.com/yewstack/yew/issues/533")

The official yew has made relevant discussions.

https://github.com/futursolo/stylist-rs

I am currently using stylist-rs to write the CSS for components in my simple personal website, and I have not encountered any major difficulties in writing. I will share more if there are any follow-up.

Backend part

Before I determined that I would not need a backend framework, I also studied a lot of the Rust backend, among which the most popular are Actix-web and Rocket. However, when researching, I often saw many people including Axum in discussions.

I’m a little tired, so I’ll jump straight to the conclusion.

From what I’ve seen in recent articles, although I have only looked at the information on the internet, here are the sources and you can have your own opinions.

I didn’t study Rocket that seriously, so I’ll just compare Actix-web and Axum.

Actix-web is a relatively mature Rust web framework that provides a wealth of features and tools to help you quickly build and deploy microservices. It also has a simple, easy-to-use API and rich documentation to help you get started quickly.

On the other hand, Axum is a newer Rust web framework that uses data flow diagrams to help you build and deploy microservices. It also has a clear structure and easy-to-use API to help you get started quickly. However, it is relatively less mature compared to Actix-web, so you may want to consider it when developing large projects.

Note: The information I saw on the internet, those who have used Axum said it’s good.

Overall, Actix-web’s advantage is that it is more mature, while Axum’s advantage is that it is more flexible, simple, and easy to expand.