Rust backend framework

Hello everyone
I have been using Rust in last year and a half for my blockchain developing work.
For backend I've been using Typescript and NestJS.
But in last few days, I wanted to try to write some backend with Rust. What would you say is the best framework for using Rust in backend development? Is it Actix, Axum, Rocket or something else completeley?

Thanks guys

They are all good and mature. I'd recommend trying them out and going for the one you feel most comfortable with. warp is also worth mentioning.

2 Likes

My go-to framework is axum. It is very similar to actix, but its main difference is that it closely integrates with tokio ecosystem (it is the part of this project). Most importantly it uses tower service model, which makes it compatible with all middleware based on tower.

If you are wondering how axum works under the hood, there is a very good video from Jon Gjengset - Decrusing the axum crate.

4 Likes

I started with Actix because it was the first framework I came across. Then I saw a few articles about other frameworks and got a bit confused about which one I should use, but this is definitely the answer! Thank you

I started with Actix because it was the first framework I came across. I began writing my first app with it, and once I finish, I plan to build the same thing using Axum to see which one suits me better. Thank you for the answer!

2 Likes

Axum is basically the go-to default framework nowadays.

1 Like

I went through this ("which framework?!") a few years ago, and I think it's important to decide what's important to you. Do you want:

  1. something that just works; is a "means to an end", and you don't really "care" about
  2. something that has a lot of power and flexibility which you will use to hand craft your own complex middleware

If 1. then I'd suggest something like rocket, actix-web, or maybe axum because they are solid, proven, and have been around enough to allow "google pasting" any problem you're likely to come across. "maybe" Axum because it's fairly new and it's pretty fine grained.

If 2. then I'd suggest axum or warp.

Axum is my go-to as it is blessed by Tokyo (so isn't going to disappear and won't run into any version compatibility issues) but it isn't as "straightforward" as rocket or actix-web.

1 Like

the desgin of Axum is easy to understand,the others is complex with lots of dependence