News for hackers. Stuff that matters.
Re:Rust for web development: 2 years later by ampdepolymerase on Wednesday February 24, 2021 @01:35PM (#26253715)
Rust is usable for web development if you consider vanilla Python Flask without extensions to be the pinnacle of all web frameworks. The abstraction level in non-nightly Rust frameworks is shockingly bad. Standard features like diffing and generating migrations that are found in mature ecosystems like Django/Laravel/ASP.NET/Prisma are non-existent in Diesel. There is no maintained, out-of-the-box authentication solution. The only framework that try to tackle some of these problems is Rocket and it has been perpetually in nightly despite stable Rust compatibility having been achieved last year. (Companies using Rust need to donate and sponsor more)
Re:Rust for web development: 2 years later by mamcx on Wednesday February 24, 2021 @02:54PM (#26254815)
What you say is totally true. I still love using Rust for web and bet my projects on it, but is certainly the fact you will need to reimplement certain things.

In the other hand, having less features have help me in re-factor not just the code but how I do the whole thing, making more focused choices to be able to solve problems with less complexity.

Eventually the design you get (partially because the lack of support for things on Rust) is much better overall.

To make things more concrete: I use nearly 0 JS and no "single page apps", use tailwind and have reduced, a lot!, CSS designs issues, have more control in how mutate things, have less API surface, make better use of what PostgreSQL have, etc.

Re:Rust for web development: 2 years later by subsection1h on Wednesday February 24, 2021 @04:51PM (#26256545)
My team recently evaluated 37 database schema migration tools and we ended up choosing Dbmate, which is written in Go but can be used with any framework or language, including Rust.

https://github.com/amacneil/dbmate

Re:Rust for web development: 2 years later by bromanko on Wednesday February 24, 2021 @08:04PM (#26258512)
Would love to see the comparison analysis. Are you planning to publish it?
Re:Rust for web development: 2 years later by Klonoar on Wednesday February 24, 2021 @02:58PM (#26254906)
Re: the out-of-the-box auth solution, I actually open sourced this based on another thread similar to this from a few weeks ago:

https://github.com/secretkeysio/jelly-actix-web-starter

I built it because I was _also_ frustrated with the same level of abstraction you mention. Granted, I do agree that that Django/etc are more feature-rich, and that's definitely not getting replaced overnight.

Re:Rust for web development: 2 years later by lumost on Wednesday February 24, 2021 @02:12PM (#26254211)
As of right now, I think rust is appealing to the teams who need all of its features at the same time.

Java/Go will deliver similar perf for most web apps, and have more mature tooling, python will be better for ML, C++ for systems programming, JS/electron will be better for the frontend and java/scala for distributed processing.

Rust has the innards to do all of these things at the same time with one shared code base (albeit somewhat poorly today). It's the only one of the above languages that hasn't made some decision which makes a use case impossible such as running on a VM, no function serialization, no direct hardware bindings etc.

Re:Rust for web development: 2 years later by sylvain_kerkour on Wednesday February 24, 2021 @01:39PM (#26253760)
Hey, I updated to specify that I'm specifically talking about JSON APIs.
Re:Rust for web development: 2 years later by BiteCode_dev on Wednesday February 24, 2021 @01:45PM (#26253853)
Even then DRF and FastAPI offer an order of magnitude more features for free, and battle tested.
Re:Rust for web development: 2 years later by ZeroCool2u on Wednesday February 24, 2021 @03:10PM (#26255081)
I've been looking at Rust API frameworks and the question I keep finding myself asking is, what is the FastAPI equivalent in Rust?
Re:Rust for web development: 2 years later by steveklabnik on Wednesday February 24, 2021 @03:24PM (#26255284)
I don't know a ton about FastAPI, but it seems like it's based on OpenAPI. I posted below about Dropshot, which the company I work for wrote, is using and open sourced.

https://crates.io/crates/dropshot

It may or may not interest you!

Re:Rust for web development: 2 years later by ZeroCool2u on Wednesday February 24, 2021 @04:11PM (#26255997)
Yeah, this does look kind of similar, I'll take a look. Thank you!

I'd say the most powerful part of FastAPI is that it integrates everything in a relatively opinionated way, that you would spend a lot of time setting up Flask plugins/extensions for to get an equivalent feature set.

I'm not sure I'd say it's based on OpenAPI(?), but it does automatically generate OpenAPI based docs from your Python code. There's no intermediate step, the '.../docs' route just exists at runtime.

Re:Rust for web development: 2 years later by agumonkey on Wednesday February 24, 2021 @01:54PM (#26253979)
how many years it took since flask to reach fastapi ?
Re:Rust for web development: 2 years later by BiteCode_dev on Thursday February 25, 2021 @04:55AM (#26261342)
Django (2005) to DRF (2011) is a better take as the products a linked and packed with features, many versions in the making.
Re:Rust for web development: 2 years later by ampdepolymerase on Wednesday February 24, 2021 @01:41PM (#26253796)
I agree,Rust development for microservices and JSON APIs is quite doable. Your new book looks quite exciting. Is there a preview somewhere?
Re:Rust for web development: 2 years later by sylvain_kerkour on Wednesday February 24, 2021 @01:44PM (#26253845)
Thank you! No preview is available today (I don't have enough bandwidth available) but it's on my todo list.

Please feel free to subscribe to the newsletter where I will announce when it's available :) https://kerkour.com/subscribe

Re:Rust for web development: 2 years later by ampdepolymerase on Wednesday February 24, 2021 @01:47PM (#26253893)
Subscribed! Bloom is really cool, what's the current status on it?
Re:Rust for web development: 2 years later by z0mbie42 on Wednesday February 24, 2021 @02:53PM (#26254809)
Thanks again!

I'm working on it 2 days a week beside writing the book.

The next major milestone is receiving emails in the inbox, but I think it will take 2-4 months to have it working.

Re:Rust for web development: 2 years later by alexfromapex on Wednesday February 24, 2021 @09:40PM (#26259079)
It is a relatively new language but I bet will have more maturity within 5 years and will be very popular by then