DEV Community

Discussion on: State of Rust Web Frameworks (Server, DB)

Collapse
 
mremanuel profile image
Emanuel Lindström

Thanks for sharing.
I also have experience with Django and agree with it being kind of a monolith. It does a lot and is hard to grasp at first. But when you learn it, it's super nice to work with.
I just finished my first hello world in rust and I'm thinking of diving in the deep end and building a web app. Can you recommend a good approach? I've looked at Rocket and actix-web and I kinda find myself looking for something similar to django. Especially the django ORM is super nice.
Although, I wouldn't mind going a bit lower in abstraction now that I'm getting in to rust. To "do it right" so to speak. My plan is to build a simple, full stack web app. A portfolio perhaps where I can showcase projects, build a rust game, etc. Maybe play around with logins and user authentication.
Can you point me in the right direction in what kind of stack I could use? I don't mind if it's a single framework or one for frontend and one for backend. Thanks!

Collapse
 
ghost profile image
Ghost

I would recommend an approach similar than what I would have liked to do with Python, to take a look at Flask before Django, if you get directly into Django, after a while, with Django, I felt more like a "configurer" than a programmer, is like filling the little blanks Django left for you.

I would start taking a look at Hyper, maybe do a hello world with it, after that depends on your goal, is to explore or to build something you have already in mind. For the first I find really interesting what is being done with async-std>http-types>async-h1>tide and just understand whar role play each of those parts have gave me, in a week, more understanding of the whole thing than years of Django; if you already have a project in mind and is kinda complex i.e. you want good middleware support, cookie based auth already done, TSL, websockets, etc. I'll go for Actix-web. It doesn't come with ORM like Django but is much more feature rich than other (not sure about Rocket, I've never used and barely look at it). The database stuff is decoupled entirely from the rest so the choice of web stack doesn't affect your db availability.

I bet you'll get a lot just at looking the hyper server example. Notice that Hyper is not a framework is a library, but you'll realize than is not so different, and even if you go for Actix-web, a look at Hyper will make the whole actix-web structure, clearer.

That is what I've gather as a noob in the whole thing. And if you came from Django, Askama will feel like home with templating, in fact is based in the syntax of Jinja, so with some minor adjustments, you could even reuse your Django templates, and as is completely decoupled with the rest (DB and http server: actix-web, tide, hyper, etc.) you can mix and match.