Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Anything where low-level control is required. It's not clear if there are true-Rust web apps in the wild (as opposed to web apps with some services in Rust); as far as I read, Rust web programming is ugly.

There are. I run one. Written in pure Rust. 160k lines of Rust code in total, serving over 3 million HTTP requests per month. Best choice I've ever made.

Rust especially shines when you need to maintain a big project over a long period of time. People often say that Go is much more productive than Rust, and in most cases that is true, but as the size of your project increases and your expertise in the language increases this relationship inverts, and Rust starts to be much more productive. Pick a right tool for the job.



What Rust web libraries/frameworks do you use and recommend? How long does your Rust project take to compile?


> What Rust web libraries/frameworks do you use and recommend?

This might not be a satisfying answer for you, but I use my own framework. Its main selling point is that it can be compiled in two modes: during development it has zero dependencies and is blazingly fast to compile (it has its own minimal HTTP implementation, its own minimal executor, etc.), and for production it switches to use production-ready crates which everyone else uses (`hyper`, `tokio`, etc.)

Personally I'm not a fan of most frameworks which are commonly used in Rust webdev. The reason for that is twofold:

1) Most of them suffer from what I call the npm-syndrome, with hundreds of dependencies out of the box. Case in point, the minimal example from Warp's readme pulls in 146 crates.

2) They're often really complicated and have a lot of magic. I prefer simple functions with explicit control flow instead of layers upon layers of generics and macros stacked upon each other.

(DISCLAIMER: The following is purely my personal opinion; I'm not saying one approach is objectively better than the other, just stating what I prefer.)

For example, in Warp the way you add compression is by stacking a filter on top of your route:

    let examples = warp::path("ex")
        .and(warp::fs::dir("./examples/"))
        .with(warp::compression::deflate());
In my framework you have an explicit function through which every request goes through, so if want to add compression you just call a function which takes a request and returns it:

    fn deflate(response: Response) -> Response { ... }

    async fn server_main(request: Request) -> Response {
        let response = ...;
        let response = deflate(response);
        //
        return response;
    }
There's no magic and you can clearly see exactly what's going on, and you can also easily add new transformations without the need to become a trait astronaut.


Amazing! Thanks for explaining that.

I think that's a great solution because the biggest thing that makes me afraid of Rust webdev is compile times. Your solution seems perfect as you can get quick compile times during development.


Anywhere you picked this up from I could read more about?

Fellow npm-syndrome avoider.


I'm not the OP, but I liked Warp[0] the most. Actix Web is cool, but looks ugly and hard to use. Rocket doesn't even work. And Tide is lean and clean, but its examples and codes aren't as well-made as Warp.

[0]: https://github.com/seanmonstar/warp


Have you tried axum? It's by the Tokio organization, newer than the others.

I still use actix-web though since I found it way easier to parse than axum or warp, in my opinion. The minimal examples for each make actix-web the most readable for me.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: