What would you recommend for a simple web stack in 2020?

What would you recommend for my Rust web stack?

I've currently got a simple, low-traffic web site built with Nginx, uwsgi, cherrypy, Jinja2, and postgres. I'm considering redoing it in Rust instead of Python just to get a little experience with the nascent Rust side of the web-serving ecosystem.

I've checked out Are We Web Yet? and I recognize the top 5 frameworks by name (though I haven't seen Gotham discussed, much), but I've never done anything with them other than read a few random blog posts as they flew by over the years.

What I care about most are:

  1. The project is stable -- it is not going through rapid change so it will probably be straightforward to upgrade.
  2. There is an active community, so it won't bitrot and disappear
  3. it is straightforward to comprehend and use without having to make a thousand choices for how to assemble it myself.

I don't care at all about the absolute best performance or exotic features or fancy plugin ecosystems. I won't use them.

3 Likes

As a new user of Rust after a few weeks tinkering around I wanted a web server in Rust for a similar low traffic and not so complicated website. Basically I wanted to recreate what we had in node.js, Express and Postgress. Mostly static content, a REST API and a web socket server on the side.

My researches into available "frame works" (I hate that term) started and stopped with Rocket: https://rocket.rs/. First discovered by stumbling across this presentation by the creator Sergio Benitez: https://www.youtube.com/watch?v=t_FUZ34ahBE&t=9s. So I tried it out. Installation was easy. The documentation is good. Getting what I wanted working turned out to be only a bit more work than it was node.js

Some months later the thing is still humming along nicely with no issues.

I'm pretty sure Rocket checks off all the items on your requirements list.

  • Some worry that Rocket requires nightly Rust. Not sure why. That does not mean either nightly Rust or Rocket are not stable. I'm confident Sergio is not going to be breaking API's willy nilly. In fact the idea is that Rust is moving to wards what Rocket already uses.

  • Rocket has a ton of contributors and is actively worked on.

  • I'm a noob to Rust so I want things simple. Rocket was not big stretch to get going. Compared to node,js/express say.

The only other option I had heard of at the time was Actix-web. Initially I did not look into that because all that async stuff gives me the shivers. I'm used to asyn/event driven programming in node but almost never understand what they are talking about with async in Rust. Besides async was not "cooked" at the time.

I decided against revisiting Actix-web when the creator through a hissy fit at those trying to contribute on github and threatened to abandon project and delete the github repo. Hardly a stable situation.

2 Likes

Looks like Rocket is getting closer to building on stable Rust: https://github.com/SergioBenitez/Rocket/issues/19

1 Like

Hey there,

I've been using tide( tide ) for a while now as a REST API Server with a mongoDB as persistency and I do like the clean and lightweight pattern to implement routing and middleware.

I've not yet done the frontend part but I'm thinking to do this with Vue.js or going the rust/webassembly route, but this is not yet on the table to decide :wink:

1 Like

I have not built such a project myself, but I've hung around in this forum for more than a year, so I know which projects people use in practice. Here they are, in no particular order:

  • Rocket
  • Actix
  • Warp
  • Hyper

The impression I get is that rocket is a very good project, but afaik they're planning to release a big update to async Rust soon, so I'm not convinced it will satisfy your first condition at this time. That said, I think it will satisfy all your requirements if you wait half a year.

I'm not too familiar with actix or warp. Actix might be good. Warp might also be, although I worry about type length limit errors, and feel it is too much magic for my taste.

As for hyper, it is a lower level option. Some of the other frameworks are built on top of hyper, and it is definitely not going away. You would have to build your own URL parsing and manually route calls to the correct functions if you take this route, but the project itself is very stable and used by lots of people (often indirectly).

3 Likes

I'm banking on Rocket gaining async capability without mishap. It would be insane for them to break the API for all the existing users to do that.

Did Actix/Actix-web survive the turmoil of recent months?

1 Like

There are still questions about actix every so often. :woman_shrugging:

1 Like

Actix-web definitely survived it. It is still actively developed and new version (3.0.0) is being prepared. There is a claim that a group of motivated people is working on replacing unsafe code, although I haven't found any issue on Github representing this work.

3 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.