Remix.run Logo
fuddle 4 hours ago

The TS/React ecosystem is so mature, it's hard for Rust to compete with it. My optimal stack is currently: Rust on the backend, Typescript/React for web with OpenAPI for shared types.

user205738 an hour ago | parent | next [-]

Why not Angilar? React and Angular are not worth comparing directly, but why not use Angular for the web interface?

papa0101 2 hours ago | parent | prev | next [-]

React and its ecosystem is a pile of garbage perpetuated by industry inertia. UseState, useMemo, useThisAndThat where you have to guess whether that dependency will cause a re-render? Or 20 different routers, state managers, query builders? I'm not even talking about html-in-ts with `!!a && (<div>...</div>)` A stodgy, bloated, overhyped and misused monstrosity, that's what React is.

ChadNauseam 3 hours ago | parent | prev | next [-]

Running rust in wasm works really well. I feel like I'm the world's biggest cheerleader for it, but I was just amazed at how well it works. The one annoying thing is using web APIs through rust - you can do it with web-sys and js-sys, but it's rarely as ergonomic as it is in javascript. I usually end up writing wrapper libraries that make it easy, sometimes even easier than javascript (e.g. in rust I can use weblocks with RAII)

resonious 3 hours ago | parent [-]

It does work well logically but performance is pretty bad. I had a nontrivial Rust project running on Cloudflare Workers, and CPU time very often clocked 10-60ms per request. This is >50x what the equivalent JS worker probably would've clocked. And in that environment you pay for CPU time...

ChadNauseam 3 hours ago | parent [-]

The rust-js layer can be slow. But the actual rust code is much faster than the equivalent JS in my experience. My project would not be technically possible with javascript levels of performance

tcfhgj 34 minutes ago | parent | next [-]

the JS layer is slow, indeed, but it shouldn't be that much slower that it meaningfully impacts frontend apps

A demonstration of that by the creator of Leptos:

https://www.youtube.com/watch?v=4KtotxNAwME

resonious an hour ago | parent | prev [-]

That's fair and makes sense. In my case it was just a regular web app where the only reason for it being in Rust was that I like the language.

tcfhgj 32 minutes ago | parent [-]

did you profile what made it so slow specifically? sounds waaaaay worse than I would expect

resonious 19 minutes ago | parent [-]

I did. I don't remember the specifics too well but a lot of it was cold starts. So just crunching the massive wasm binary was a big part of it. Otherwise it was the matchit library and js interop marshalling taking the rest of the time.

edit: and it cold started quite often. Even with sustained traffic from the same source it would cold start every few requests.

resonious 3 hours ago | parent | prev [-]

I'm doing this now and it's mostly great but the openapi generators are not good. At least the Typescript ones produce confusing function signatures and invalid type syntax in some cases.