12
submitted 11 months ago* (last edited 11 months ago) by rglullis@communick.news to c/rust@programming.dev

One of my new years' resolutions is to be able to be productive enough with Rust to start making contributions to Lemmy and/or to integrate part of the Fediverser project (specifically, the "login with Reddit" feature) into it.

But first steps first, and I want to make a simple web app where I can authenticate users against an LDAP database, and show some data only for authenticated users.

It seems that the most mature libraries for web development in Rust is still actix web (and also the one that Lemmy uses), but what about other parts? Is Tera a good option for someone who is already familiar with Jinja (and Django)? Most of the tutorials I found out are for using actix web mostly as a json API and leaves the frontend for specific javascript SPAs, but what if I want to do "old school" web pages?

top 6 comments
sorted by: hot top controversial new old
[-] thesmokingman@programming.dev 3 points 11 months ago

Check out Shuttle. If you want a hands-on project to pick up a framework, the Christmas code hunt is pretty fast (assuming the local crate makes it work after the fact?). I used it to switch from Rocket to Axum.

Manning has a book about Rust servers that might also be useful.

As for templating, if you know one template DSL, you should be able to pick up any of the others. I haven’t heard of Tera; it looks solid. Rocket supports it and Handlebars.

I think you’re finding a dearth of Rust servers hosting static content because, for the most part, the paradigm has shifted to static sites or SPAs hitting an API. That’s a personal observation not necessarily a fact. Any Rust server should be able to return static content.

[-] alexdeathway@programming.dev 1 points 11 months ago* (last edited 11 months ago)

Hello, fellow Django developer, how's Actix compared to Django?

[-] rglullis@communick.news 3 points 11 months ago* (last edited 11 months ago)

I'm just starting with it, so I can't really make an honest assessment. It seems though that Actix is more of an HTTP library that provides a server and functionality to parse HTTP requests and produce responses - meaning, only the view part from Django. Database access and ORM seems to be delegated to other libraries like Diesel.

I could be wrong though, and would love to hear from someone more experienced with both.

[-] onlinepersona@programming.dev 2 points 11 months ago

I can recommend trying butane instead of diesel as it's as close to django's ORM as you'll get in rust.

For actix alternatives, see https://www.arewewebyet.org/

CC BY-NC-SA 4.0

[-] rglullis@communick.news 3 points 11 months ago

Thanks for the pointer, though I think I will stick with Diesel because this seems to be what Lemmy already uses.

My main interest is to know what would be the "state-of-the-art" alternatives to some of the things that are already built-in on Django.

  • Form handling (seems like actix-web does it)
  • User management (I haven't found anything like django-allauth or even "basic" django.contrib.auth)
  • Templates (just got Tera working, so I'll be trying this one for now)
  • CLI/management commands
  • admin, or at least something like django-rest-framework browsable API

and so on...

this post was submitted on 28 Dec 2023
12 points (100.0% liked)

Rust

6029 readers
3 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS