Live data from Hacker News

Rust needs a web framework

ntietz.com

261–270 of 395 posts

Re: Rust needs a web framework

#261

Something like https://sinatrarb.com/ for rust would be cool.

Axum + minijinja is quite close to this I would say. Been using it for a little while and I am very happy so far.

Seconding the recommendation, it's really great when paired with HTMX on the frontend too.

Re: Rust needs a web framework

#263
post #91

Earlier quoted context omitted.

It would be great to introduce some competition there, then! (Not only because I think competition is good, but because I really do not enjoy writing Go.)

This thread is amusing. Go look at job boards. The competition for Go, Rust, Django or whatever is Java+Spring. That's pretty much the industry standard unless you're in a Microsoft-only shop.

It’s disingenuous to leave out C# and F# out of this, given how much closer they are to Rust in language features and how much more “close to the metal” capabilities they offer while also having opinionated web frameworks, better CLI tooling and package management and being generally very productive languages.

Re: Rust needs a web framework

#265
post #230
post #202

Earlier quoted context omitted.

I guess you mean ergonomics. Yes they do, unless you get your editor to magically type `.clone()` and `[A]Rc ` all over the place. Not to mention they don't need unsafe, or 3rd party crates to handle graphs. Additionally, all of them have interpreters and REPLs alongside their compilers, streamlining the code-develop-debug loop.

Thanks for pointing the typo out! I've fixed the comment. In fairness, I think a lot of this comes down to familiarity. I'm fairly familiar with `.clone()` and Arcs at this point, so they don't really change much in terms of ergonomics. Usually their usage is fairly obvious, and quite often my editor literally does magically type the `.clone()` calls through LSP fix commands. It's the same as, say, OCaml's insistence…

A unit test has nothing to do with a REPL, a proper REPL provides something similar to jupiter notebooks in feel, alongside debugging and hot code reload experience.

Re: Rust needs a web framework

#266
This article makes several different points that would ideally each be tackled on their own.

You don't need a router when you have pattern matching (just split the url and match on static and dynamic vars however you need)

Auth is typically DIY in any language, or SaaS like Firebase/Auth0. It's not a language or framework problem, necessarily

CSS/JS tooling makes no sense for many frontend Rust frameworks like Dominator, which is in Rust (not JS) and has its own approach to styling that works for it (e.g. attaching styles to signals, so they change on the fly)

I get what the author is saying - in fact I've been around the block a couple times solving all the different points in the article and it is painful. For example, see https://github.com/dakom/dominator-workers-fluent-auth which does a lot of the stuff here on the Cloudflare workers framework (also adds another wishlist item - localization with Fluent)

A "batteries included" full framework that does _everything_ is nice to have, but many real-world projects will want to replace those opinionated decisions and go the DIY route anyway. Rust is more than mature enough, even on the frontend web, to tackle all of that - if you know where to look (wasm-bindgen, etc.)

Re: Rust needs a web framework

#268
post #97

Earlier quoted context omitted.

> I never think about memory management when I'm writing Rust, let alone am I "doing it" (active voice). Worrying about lifetimes is memory management that is unnecessary with GC languages and directly increases cognitive load. My second paragraph is pointing out that "where I can open something like Notepad without an LSP or highlighting" is a strange qualifier. Why does it matter if you don't have semantic analysis…

> Worrying about lifetimes Again, not my experience at all. I simply don't think about any of that stuff when I write Rust, all my mental energy can safely go towards working on whatever I'm building. If you don't believe me, you're welcome to watch the literally hundreds of hours of me live coding in Rust on YouTube.

> I'm an incredibly lazy developer

> Watch the literally hundreds of hours of me live coding in Rust on YouTube

Your definition of "lazy" seems quite different from the standard definition.

In my view, the average "incredibly lazy developer" of 2024 tries to have an LLM write most code for them (probably in JS/TS/Python), doesn't notice the subtle bugs introduced by said LLM, and ships straight to prod. If using an LLM fails, they go back to StackOverflow to look for an answer that they can copy-paste. When that fails they give up and ask a less lazy developer for help. At no point in this process did they read the documentation for the language/framework/etc they are using to accomplish their goals.

Re: Rust needs a web framework

#269
post #55

Just use Phoenix and live view. Prototype is easy and fast. Scales well to very large user base on a single node. Interactive client side without even writing JS. I love rust, I really do, I use it for all kind of things. But for web app, the Erlang architecture is so well designed and mature you cannot compete. Also we use rust and zig from Erlang with native modules for video processing and AI, the elixir/Erlang "s…

No types in Elixir, I think a better comparison is actually Gleam, it is Rust-like in type system but is built on and interoperable with Erlang/OTP.

Both are exceedingly slow and memory-hungry. The average user of Rust might get shocked and never touch these again.

Now F# on the other hand…

Re: Rust needs a web framework

#270

For new web applications, why recommend alternatives to Next.js? How do you convince someone to use an alternative? The knowledge needed to understand why will help you get close enough in Next.js anyway.

I know TypeScript is available but not everyone can be convinced to adopt JS. I was part of that group until recently as I have been using strongly-typed language all my life.
Post reply on HN