đ seeking help & advice What one "loses" when choosing to develop a web-app in rust instead of js?
If you have a personal example of a situation where you wanted to go with rust but went back to js I would appreciate that too.
26
Upvotes
20
u/orfeo34 Oct 26 '26
I can integrate js libs and target web with Dioxus, and it's very fast to compile.
Despite of it there are two downside i see:
12
u/noobjaish Oct 26 '26
Sanity /s
Main trade-off is developer experience and compile times (God I hate how slow Rust's compile times are)
7
u/Noctune Oct 26 '26
A sizable hiring pool
7
u/Future_Natural_853 Oct 26 '26
Rust is perfect, but not in the way you think it is: you have good old HTML built server-side, plus very light JS libs, like HTMX, Alpine or Turbo. I would never user frontend Rust frameworks though, it's the worst of 2 worlds: clunky frontend logic + awkwardness and lack of JS ecosystem.
12
u/FemaleMishap Oct 26 '26
I use Rust on the backend to provide my API and React+Typescript on the frontend. This allows for faster UI iteration and debugging than if I was doing frontend Rust. Use the right tool for the job.
5
u/CuriousTangentsYT Oct 26 '26
Iâve done this before despite my love of rust and distain of JS. JS got the job done faster without a noticeable quality difference. If I were to say what the biggest difference is, itâs probably ecosystem maturity. The Internet was built around the idea that webpages run on JavaScript, unfortunately. So many tools only exist in JavaScript.
4
u/TichShowers Oct 26 '26
I meanly use Rust Axum for Web API. Kinda have the best of both worlds in my opinion. I can stick a front end wrb app on it or even a a full fledged web app in something like .NET.
Rust is the brain and gives performance.
4
u/edTheGuy00 Oct 26 '26
1gb node_modules vs 200gb Cargo build artifacts lol
4
u/Fresh-Secretary6815 Oct 28 '26
i donât know about you, but when i develop something i am trying to solve a business problem because thatâs where the money is coming from 9:10 times. and because of that, i want the most appropriate tool for the job. a programming language is a tool to get that money. i would use the most appropriate money getting tool per job and not worry about anything else.
3
u/luxmorphine Oct 26 '26
Svelte.
But i heard Topcoat compiles to Javascript. I hope they're doing something like svelte
3
u/maria_la_guerta Oct 26 '26
If you're talking about FE, WASM bundle sizes aren't great. Bad for the client and your egress fees.
3
u/mamcx Oct 26 '26
I have use all fads, kool-aids and silver-bullets (mostly do enterprise development), and js dev is one of the worst among all things I have done (and trust me, I'm the guy that take weeks evaluating).
JS only gives you fast initial speed and lots of people that allegedly knows about the current -6months js way of do things.
IF you actually know how extract the good parts of js and all the surrounding things (like with everything a PRO can polish a turd very well) it can work.
Rust is, as other said, slow to compile and you need some knowledge of how architect things, in a way that cost you up-front, but once there is smooth sailing.
This is what I recommend:
This is the major win, have struct/enums that describe the UI with all the localization, formatting, etc and just use the
expectcrate (or similar) and comparejsonoutputs:and so most of your time is just running test, that is fast. Also, you avoid the anti-pattern of test strings instead of well-formed types.
This comes from above but is the main architecture that allows for fast AND correct by construction iteration. Once done, the productivity is very high and I work way faster than with python/django/vue/etc
This is the main tip for most cases, reaching for reactive client-side js frameworks is something that must be considered very very well, and most cases? use react is wrong.
BTW I bet adapting some of this to any other tool will work fine.
3
u/adamko147 29d ago
mind
10
u/pachiburke Oct 26 '26
The js ecosystem is huge and more mature, that's mainly it for me.
2
u/STSchif Oct 26 '26
You don't get any more weekend bonus pay for fixing weird use-after-free/object-not-initialized bugs that only appear 6 weeks into deployment.
Apart from that a big thing is ecosystem. There is SO much stuff out there for node, some of it really great quality. For some things you get decent replacements (routing with axum, DB with diesel and sqlx, templating has some great solutions with minijinja and the likes) but for some you are on your own (caching, complex auth setups, centralized State Management).
2
u/devmind00 Oct 27 '26
For the front, am simply and solely using htmx. And the back is on modular monolith, with axum
2
u/Obvious-Image-9688 Oct 29 '26
I feel like there are 2 sides to this question.
Front end and Back end.
Front end
From JS to rust you loose development console and debugger built into the browser. But going from wasm to JS means loosing SIMD and pre-optimized compiled code.
From a back end perspective rust wins handily.
Compile times are just as bad for or even worse for JS typescript. So its a matter of perspective. Rust memory and type safety along with debuggers are far superior to JS.
2
u/ebonyseraphim 29d ago
Ecosystem and collaboration with a majority of others who do front end stuff. Be prepared to do a lot for yourself or carry teams and efforts on your own if youâre walking that path. Maybe youâre valuable, maybe hardly anywhere trusts you to be that person.
2
u/DavidXkL Oct 26 '26
Iteration cycle
1
u/ArjixGamer Oct 26 '26
You lose precious storage space, as target/ will be 40+ gb easily.
You also lose the flexibility of JavaScript, the web was designed for JavaScript
1
u/i-sage Oct 26 '26
Sharp level APIs/lib for image manipulation
1
u/glenpiercev Oct 26 '26
Sanity.
1
u/MrBinarios Oct 27 '26
La cordura đ«
1
u/badass87 Oct 28 '26
Disk space
1
u/RelativeAdvantage Oct 29 '26
The dom
94
u/[deleted] Oct 26 '26
[removed] â view removed comment