Live data from Hacker News

Rocket – Simple, Fast, Type-Safe Web Framework for Rust

rocket.rs

11–20 of 49 posts

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#11
post #9

From a quick glance it seems still vulnerable to trivial slowloris’ing D: Is anybody actually exposing their rust-based websites to the internet? I want to, but it seems that for some reason every rust web framework keeps TCP connections open _forever_, meaning that even with file descriptors bumped to 64000, my web server runs out of FDs and needs to be killed and restarted every 3 hours or so. The standard advice s…

Yeah I run my rust apps with in google cloud run so the containers are always restarting anyways so I dont care

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#12
post #7

Rocket's documentation and overall 'dev experience' are very pleasant. In the past, I felt like I was making a significant tradeoff when using Rocket over more actively developed frameworks (Axum and Actix Web). With v0.5 (finally) coming out, and the Rocket Web Framework Foundation, that feels like much less of a concern. A great example of Rocket in use is the official Rust website, which is open source.

also recently updated to v0.5 - https://github.com/rust-lang/www.rust-lang.org

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#13
After using Rocket in production for a year now. I'd really recommend Actix Web. Don't get me wrong, Rocket has some really nice features and good UI, but a couple things have proved to be real pain points:

- Middleware ("fairings" in rocket parlance) can't respond to requests. This means your access control has to be replicated on every route as a guard.

- Guards can result in errors (for example, if the request doesn't have a valid Auhorization header), but you can't set the response body without a nasty workaround that causes other issues [1]

- Guards also have tricky performance gotchas. When multiple handlers match the same route, rocket will try them all in priority order. Often these variants have the same or similar sets of guards, but guards don't cache by default. Doing your own caching gets tricky especially in the presence of workaround [1].

All this to say, Rocket works well, but it has some unique problems that come from its early design decisions (e.g. the guard error messages which has an open issue) and some from ongoing decisions (i.e. the project seems to committed to the fairing model over standard middleware).

Many of these problems are fixable by community members like you, but actix avoids several of these and has a larger developer base. I've heard good things about axum and the docs look great but I haven't had much experience so I can't offer a strong recommendation.

[1]: https://github.com/rwf2/Rocket/issues/749#issuecomment-91629...

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#14
What got me interested in Rocket was from this talk (a great talk btw): https://youtu.be/lBQHrj6vwAo?feature=shared&t=1934 (A Case for Oxidation)

The main selling point for me was that Rocket made security threats (XSS, SQL injection etc) impossible by guarantees which was a bit mind blowing imo. It is a bit like database guarantees which is insanely useful as an application grows. Is this still the case with Rocket and if so, how come it's not all over their web page as the unique selling point? I mean, security is getting more and more important and if we can solve many preventable security threats permanently by a technical choice this seems like the obvious way to go for the future.

I mean, Rust is fast and secure and makes my software "unhackable" for the price of a bit slower development? Seems like an obvious choice then.

When I browse their website, I don't understand if this is still the case and coming from a php/node background this would be the main driver for me since the language performance is very rarely a concern of mine and coding rust is.. slow and requires a lot of learning because of the weird syntax that makes me think about memory when I don't really care.

What I also really, really like about Rust, Go and other similar languages is that the deployment option that becomes available. Just deploy a single binary file. That is super simple and awesome. But the one thing that made me look away from Rust is the foundations weird rules and new draft that you cannot use the word Rust in urls, courses etc and if you like guns?

I don't know how it's been developing so far but the Rust foundation seems to do some crazy stuff that makes it hard to trust.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#15
I'm using Rocket for a small production application for my PhD project. One supervisor recently took over the project and asked me where he could connect a log stream to detect crashes. I said: "I don't know. I never have crashes". At the same time, maximum memory consumption is about 15 MB (3% of 512 MB) and CPU load 0.1% on a Starter instance on Render.

So credits to the Rocket maintainers for making Rocket such a reliable piece of software!

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#16

After using Rocket in production for a year now. I'd really recommend Actix Web. Don't get me wrong, Rocket has some really nice features and good UI, but a couple things have proved to be real pain points: - Middleware ("fairings" in rocket parlance) can't respond to requests. This means your access control has to be replicated on every route as a guard. - Guards can result in errors (for example, if the request doe…

>Middleware ("fairings" in rocket parlance)

I really hate it when libraries introduce their own nomenclature for the sake of being cutesy.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#17
post #16

After using Rocket in production for a year now. I'd really recommend Actix Web. Don't get me wrong, Rocket has some really nice features and good UI, but a couple things have proved to be real pain points: - Middleware ("fairings" in rocket parlance) can't respond to requests. This means your access control has to be replicated on every route as a guard. - Guards can result in errors (for example, if the request doe…

>Middleware ("fairings" in rocket parlance) I really hate it when libraries introduce their own nomenclature for the sake of being cutesy.

And ironically its not even a great word to describe what its use is

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#18
post #5

introducing a new term when an established term exists seem to add another overhead. "but bro, you'll get used to it in no time." i hear you, buddy. it just leaves a bit bad taste. anyway, i can't believe i say this, i think dhh's words on tradeoff between squeezing performance out of an ecosystem and "just throw more hardware on it" is a tradeoff that i can clearly choose.

What term are you referring to? Also, speed and performance aren’t the only reasons to use Rust. Rust also helps ensure correctness in significant ways, and make stable applications.

rocket and flight terms. mount? is it a horse? launch? well, it's a rocket. fairings? good thing they don't introduce cable installation.

i'd rather use haskellin instead of rust if we're talking about "correctness" and "stability", whatever those are.

Re: Rocket – Simple, Fast, Type-Safe Web Framework for Rust

#19

After using Rocket in production for a year now. I'd really recommend Actix Web. Don't get me wrong, Rocket has some really nice features and good UI, but a couple things have proved to be real pain points: - Middleware ("fairings" in rocket parlance) can't respond to requests. This means your access control has to be replicated on every route as a guard. - Guards can result in errors (for example, if the request doe…

The first two points will be addressed in the next major release with typed catchers. The latest release notes[1] call this out, and in fact reference the same Github issue.

Additionally, it looks like they're even addressing one of the most common criticisms - having to declare requirements/guards on every handler. See "Associated Resources".

[1]: https://rocket.rs/v0.5/news/2023-11-17-version-0.5/

Post reply on HN