Rust web frameworks vs. each other and vs. other languages

I'm looking to develop a website for my mother, who is tutoring math and science. I have to decide on which language to use for the backend, and which framework.

I know about Rocket, which looks nice and just became compilable on stable Rust. It is one of the options I seriously entertain.

Then, I have some experience working with existing simple python Flask backends. That is probably the other contender.

However, I know that there is Actix Web as well in Rust. And a myriad of other web frameworks in all sorts of other languages. What is your honest opinion/experience? Which should I choose.

The website should probably be quite static, mostly just contact details and advertising. However, I envision to try to expand it to handle booking and/or billing in the future as well.

I'm currently thinking about using Rocket on the backend and plain JS with HTML and CSS on the frontend. Then I think I'll use Postgresql for a DB when I need it, since I know it best. However, there is a lot of options to explore in terms of ORMs, async I/O, frontend frameworks, wasm, etc. I think what I'm asking for is a top-level idea of what my options are, and how to learn more about them.

Thanks for your time if you read this far.

Rust for a static website is an overkill. I would not recommend using Rust for this unless you specifically want Rust for fun or learning experience.

Rust makes sense for websites that have compute-heavy dynamic content or traffic levels high enough that CPU and memory usage starts to matter a lot. But you can serve static pages just fine from any server. Python/PHP/Node/Ruby/etc. are usually entirely sufficient for pulling small amounts of data out of a db into HTML.

I've used Actix for a few projects, and it's fine. Rocket now has a (pre)release that works on Rust stable, so it's a good time to give it a try.

For Postgres in Rust diesel is the most popular choice.

On front-end again you'd need to have some really complex and compute-heavy need to really benefit from Rust. WASM doesn't do DOM, so for a simple website UI it would only get in the way.


Thanks for the insightful reply!

Follow-up question: does Rust and Rocket make sense to try to push runtime errors you'd get in say python Flask to compile time errors? I know Rocket allows one to specify the types of arguments in a request. So it gives you something somewhat better than having to remember to parse plain text into something sensible. It does it for you. I think Flask just gives you a dictionary or list of strings for the parameters of a request. Does the benefit of that outweigh the cost of learning a new web framework, in your opinion?

And that is exactly why I asked it here and not on a Python Flask forum, for example!

For a static website, a static website generator is probably good. The website can even be hosted for free on e.g. gitlab pages.

Drawback is that to update the site one would have to write Markdown and use git. See if this fits your use case or if you really need a CMS.
Other drawback is that if you do execute your plan to add billing and else, you'd have to migrate the content to a dynamic site (or keep both sites separate).

Advantage is you don't have to plan for the dynamic side of the site, which is a plus in case it never comes to fruition :slightly_smiling_face:.

As for static website generators, I had luck with zola, but jekyll is also perfectly usable.



I've decided to try out Rocket and use Rust for this. It will be as much a learning experience for me as it will be a website to be built for someone.

Furthermore, I had a discussion with the "client" recently, and we decided that at least some sort of online booking system would be desireable. Thus, not only a static site.

I am impressed enough by Rocket's documentation thus far to want to write a web server with it. It seems so easy!

Database wise, I've decided to go with SQLite, since I have a bit of experience with it, and the database will not be super complicated or have 100s of thousands of entries. Seems like the obvious choice. I do not really know the world of ORMs, but I know Diesel is one which seems to get praise. I am going to use it as a way to learn something about ORMs.

Frontend will be plain HTML/CSS as far as possible, with JS code where more interactive features are required.

Maybe I'll even blog about it once I start working on it...

Thanks for all the input from everybody.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.