Top
Best
New

Posted by skwee357 1 day ago

Farewell, Rust for web(yieldcode.blog)
135 points | 179 commentspage 3
aaroninsf 1 day ago|
This is oddly timed in as much as one of the big success stories I've heard from a friend is their new practice of having Claude Code develop in Rust, than translate that to WebAssembly.

That seems much more like the future than embracing Node... <emoji here>

Wintamute 1 day ago|
If you’re making a web app your fancy rust wasm module still has to interface with the dom, so you can’t escape that. Claude might offer you some fake simplicity on that front for awhile, but skeptical that’s it fully scalable
slopinthebag 1 day ago||
There are plenty of Rust frameworks that handle this interface for you, including calling Rust functions from JS and JS functions from Rust.
slopinthebag 1 day ago||
As someone who went in the opposite direction from Node to Rust, I feel like OP is just trading one set of problems for another set of substantially worse problems. I guess the grass is always greener in the other ecosystem ¯\_(ツ)_/¯

Idk, it just feels like OP chose all the wrong approaches with Rust, including using a separate language and ecosystem for the frontend, which is where most of the friction comes from. For example, Dioxus is a React clone that is somehow leagues better than React (and Next.js, too), and it has hot-reloading that brings compiles down to subsecond times, which makes building UI with it just as productive as with Node / Vite etc. I use it for server side code as well and it's great. Compilation times can be an issue with Rust, it's something I miss from Go, but there are ways to improve on it, and just being smart about what deps you include, avoiding overuse of macros etc can make a difference. I know these things were not around when OP started using Rust for their application, but they are around now.

Node and TS are quite frankly inferior to Rust in most ways. Bad language, ecosystem full of buggy unmaintained packages with the worse security profile of all the common languages, no unified build tooling that seems to break your project every 6 months, constant churn of blessed frameworks and tools, an stdlib that is not much more comprehensive than Rust's and outright broken in some ways, at least three different approaches to modules (esm, commonjs, umd, and more...?), I could go on an on. There is a reason why everyone seemingly reinvents the wheel in that ecosystem over and over again -- the language and platform is fundamentally not capable of achieving peoples goals, and every solution developed comes with massive tradeoffs that the next iteration attempts to solve, but that just creates additional issues or regressions for future attempts to tackle.

I've been using Rust with Dioxus and was completely mind blown when I started with it. With barely knowing any Rust (just React) I was able to jump right in and build with it, somehow it was more intuitive to me than most modern JS full stack frameworks. It seemingly already has most if not all of the features that similar JS frameworks have been developing for years, and because it's written in Rust things like conditional compilation are built into the language instead of being a third party babel plugin. That helps to remove a ton of friction. And it's trivial to build those same apps for desktop and mobile as well, something that's basically not possible with the JS frameworks.

Even stuff like websockets, go try to implement a type safe web socket connection with a server and client in Next.js or Astro. You'll need a ws library, something like Zod for validation, etc. In Rust it's just:

   #[derive(Serialize, Deserialize, Clone, Default)]
   enum SocketMessage { Hello(id: i32) }
  
   #[get("/api/ws")]
   async fn web_socket(options: WebSocketOptions) -> Websocket<SocketMessage> {
     options.on_upgrade(move |mut socket| async move {
       while let Ok(msg) = socket.recv().await {
         match msg { SocketMessage::Hello(id) => {} } // handle messages
       }
     })
   }

   fn App() -> Component {
     let mut socket = use_websocket(web_socket);
     rsx!{ button { onclick: move || socket.send(SocketMessage::Hello(42), "say hello" } }
   }
killerbreeze 1 day ago|
I think this is spot on. I've used Iced and Dioxus and both are great. I do take the author's point that the actual UI code, even in Dioxus, is verbose. It is. And that's a trade off I'm willing to make for guaranteed correctness.
slopinthebag 1 day ago||
I haven't used Iced but re. Dioxus, I don't know if it's necessary more verbose conceptually. One of the most frustrating things with React is handling async updates, and while Rust's async story is conceptually difficult, it's ultimately much easier to reason about (imo). Like are we sure a comparable component in React would be any less verbose?

   let mut breed = use_signal(|| "hound".to_string());

   let dogs = use_resource(move || async move {
     reqwest::Client::new()
       .get(format!("https://dog.ceo/api/breed/{breed}/images"))
       .send()
       .await?
       .json::<BreedResponse>()
       .await
   });

   rsx! {
     input {
       value: "{breed}",
       oninput: move |e| breed.set(e.value()),
     }

     div {
       display: "flex",
       flex_direction: "row",
       if let Some(response) = &*dogs.read() {
         match response {
           Ok(urls) => rsx! {
             for image in urls.iter().take(3) {
               img {
                 src: "{image}",
                 width: "100px",
                 height: "100px",
               }
             }
           },
           Err(err) => rsx! { "Failed to fetch response: {err}" },
         }
       } else {
         "Loading..."
       }
     }
   }
Imo the RSX here is much less verbose than JSX. Inline match statement, inline if statement, inline for loop, .take(3) compared to `Array.from({ length: 3 }).map((_, i) => urls[i]))`, etc etc. This gives you automatic cancellation of the future, whereas with React you would need a third party library like React Query, and then manually abort requests in the asynchronous function with an abort signal -- in Rust, you get that for free. You also get data validation for free, instead of needing eg. Zod for manual runtime validation.
clarabennett26 1 day ago||
[dead]
ewuhic 1 day ago||
[flagged]
dang 1 day ago|
You've been breaking the site guidelines so often and so badly that I've banned the account.

If you don't want to be banned, you're welcome to email hn@ycombinator.com and give us reason to believe that you'll follow the rules in the future. They're here: https://news.ycombinator.com/newsguidelines.html.

PowerElectronix 1 day ago||
[flagged]
Night_Thastus 1 day ago|
Long compiles are always going to be more friction. No project stays small and quick to compile forever. Get better hardware, and then one day the project is large enough that you're back with long compile times.
Kalpaka 1 day ago|
I run Rust/Axum for something that's less a web app and more a living system — autonomous agents, real-time state (pulse, mood, health metrics), a frontend that shifts based on internal conditions rather than just user input.

For this kind of use case, Rust's type system isn't overhead — it's the reason things stay coherent when multiple agents are running concurrently. The error handling that feels like boilerplate in a CRUD app actually matters when a missed unwrap means your system silently stops working at 3am.

The article reads to me like someone building a content site in Rust, which yeah, is painful for no reason. But I'd push back on the broader framing — the web is more than blogs and dashboards. When your backend does meaningful autonomous work beyond serializing JSON, Rust pays for itself.

lloydatkinson 1 day ago|
This comment sounds like an AI wrote it.