HACKER Q&A
📣 imetatroll

Anyone have good experiences with using rust in crude web development?


I am hoping to convince management to allow some greenfield work in rust for backend development. Unfortunately the CTO does not consider the teams interest to be sufficient reason to bring in a new programming language. Does anyone have good experiences with BE development in rust?

Compared to rails or golang, which are the options my company currently uses, how can I argue for rust base on:

1. Tooling. Do pros exist that would indicate better outcomes? 2. Talent pool. Will it be harder to hire engineers who can perform well? 3. How to turn adding a new language into a positive thing? We primarily use ruby, javascript and golang. 4. Onboarding. How can I say that it will ... be easier to have rust added to the mix.

I think this is a losing battle and when I type it all out... it just feels like I am following the "want to try shiny new thing" trope that I myself rather dislike if I'm being honest.


  👤 adampwells Accepted Answer ✓
I have recently introduced Rust into my workplace. We do basically Go microservices supporting VueJS front ends.

In my opinion Rust is generally superior to Go for basic JSON web services communicating with the usual suspects; Postgres, RabbitMQ, etc. I'd say it is far superior to the JVM approach for a our problem space.

I found the JetBrains tooling for Rust to be equivalent to what is available for Go. Compile times are on the order of 10 seconds for a 'medium sized web' service but of course YMMV. This is slightly annoying, but comparable with large Java/Spring projects I've worked on.

I presented an example web service (Axum) that was very similar in architecture to the Go approach we had been using; router, handlers, middleware etc. Migrating from Go to Rust is not that bad at all. Rust has a great error handling story and better type system, so the code is much cleaner and easier to understand.

Using SQLX means that you get compile-time database schema checking, including understanding if a return field could be null and requiring that to be Option<>.

The compiler is picky, but I quickly came to appreciate that 'once it compiles, it will very likely just work'. It is like having a pair programmer helping out.

It took me about 2 months learning what were the appropriate crates to put together, but now I have paid that price, I am more productive in Rust than Go.

Rust uses less memory and is faster/safer than Go, so we can deploy more services on the same hardware, with less downtime, which saves $.

You won't find an army of Rust developers to hire, but you will find an army of people who want to learn/use Rust at $dayjob, and these people will tend to be motivated self-learners that you want to have on your team. Advertising a Rust role will make your business more attractive to better candidates in my experience.

I have been a developer for 20 years; mostly Java/Scala/Kotin, then Go. Now I have learned to use Rust there is no way I am going back to those languages!


👤 biorach
Why do _you_ think Rust is better for web development than Rails or Go?