Say, I want to write a full stack web application in Rust, preferably with zero JavaScript (WASM is okay, though).
What is everyone's favourite? I've used Yew before and it was nice. I've heard about Leptos, but apart from spending a total of 5 minutes glancing at its docs and examples, I know nothing about it.
Are there others? What's people's favourite?
For added bonus, it would be lovely if I could write my CSS in Rust too.
@ptrc Zero JavaScript as in I write none of it. If something compiles to JS / WASM, that's fine. I will need some of that, can't do what I want without it1. I don't want to write JS myself, is all.
Technically, I can, and will, because progressive enhancement, and I want the Thing™ to work without JS. But if JS is available, I'll try to make gentle use of it. ↩︎
@algernon axum and htmx if you can accept running the htmx js part.
@federico3 I worked with htmx before, and wasn't a big fan. It's better than most JS frameworks, but it's still JS. I'd prefer to do everything in Rust, no JS parts.
@algernon I'm sure someone will mention Dioxus shortly but this one was more niche and had an interesting name so enjoy https://rust-on-nails.com/
@arichtman This was intriguing until:
Auto generate Rust functions from SQL definitions
Nope, thanks. Other way around please.
Also: https://github.com/purton-tech/rust-on-nails/blob/main/AGENTS.md
That's a quick disqualifier too. :(
Some of the suggetions & my own findings so far:
AGENTS.md means it's not an option.I have no desire to touch JS, so using something like htmx is not an option. I want to write everything in Rust. I don't care if that's not the most performant, or most ergonomic thing. I do not want to touch JS for this project. A tiiiiny amount of gluecode, maybe, but...I was able to do completely JS-free with Yew, a couple of years ago. I should be able to do the same now, too.
θΔ ⋐ & ∞
AGENTS.mdmeans it’s not an option.
this is how i feel about facet, it’s a lot better than serde but was sludge coded by claude code so i can’t use it
i wish serde was too so i was picking the lesser of two evils but oh well
θΔ ⋐ & ∞
@algernon also i used to use leptos if i remember correctly. i don’t write web apps in rust any more, i just use php now
@tauon Yeah, big same. Although, the choice between GenAI and Palantir (iirc) is... a tough one.
θΔ ⋐ & ∞
@algernon the choice between huh and whuh??? what happened?!
@byte Nah, I want the frontend as a webapp, not a desktop app, and want it to work without JS/WASM (but work nicer if WASM is available).
@tauon facet vs serde. One's GenAI tainted, the other's Palantir tainted (iirc dtolnay works for Palantir, or some other rather questionable corporation).
There's no good choice there.
θΔ ⋐ & ∞
@algernon oh that’s so fucked
and i’m not going to even pretend i have the spoons to write my own alternative
@algernon huh, I thought "I don't want to touch JS at all" was the main selling point of htmx (haven't used it myself yet)
@technomancy It does greatly reduce the need, yes. But I still have to write the backend parts that it will hit, and will have to think in htmx to serve what htmx expects.
I mean... probably little to no JS, but I have to dance around the framework, and I can't just:
let counter = use_state_eq(|| 0);
let onclick = use_callback(counter.clone(), |_, counter|
counter.set(**counter + 1));
html! (
<p>{ * counter }</p>
<button {onclick} />
)
I vastly prefer this over htmx's markup.
That, and... htmx having Claude's taint makes it a non-option for me, even if it was perfect in every other way. :(
Since htmx was mentioned a few times...
Mind you, I can't figure out how or when claude contributed. But I did find a few PRs reviewed by CoPilot. That's enough of an indicator that I want nothing to do with htmx if I can help it.
Now, I will use crates and tools and whatnot that I'd prefer not to, if I have no other option.
Like, serde doesn't have an alternative. Yes, there's facet, with GenAI taint. Hurray.
But if I do have a choice, I will never chose the GenAI infested option.
@algernon afaik you need js to even load wasm
and if you want to do dom manipulation, you need to go through js (see: wasm-bindgen)
in the past I've also been suggested https://egui.rs (for a project I never went through with, so I have no experience with it)
however it's important to note that egui.rs completely forgoes all html and instead everything is rendered in a <canvas>, so in terms of accessibility there is absolutely none.
@solonovamax Just enough JS to load WASM is acceptable. wasm-bindgen too. As long as I don't write the JS myself, but have it generated for me, I'm okay.
I wrote an entire Tauri app ~3 years ago with Yew, where I had zero JS in the source. Not sure how it worked, but there's no JS there, only via Rust.
Something similar is my current aim.
@algernon tbh, I do also have a rather intense dislike for js as well, however usually I'll just grit my teeth and write typescript.
if this is a smaller app then I'd recommend doing the same, but if this is a much larger application then it may be worthwhile going the rust route.
another option that exists however if you don't want to use js but can't find anything with rust is kotlin/js (kotlin which gets compiled/transpiled to js code). I do not particularly like kotlin/js (even though I like kotlin (however it has been quite some time since I last tried it)), but it's an option that I thought I'd mention
@solonovamax Oh, I absolutely know I can do it with Rust alone. Did that ~3 years ago, can't see why I couldn't today.
As for how much JS I will need: I don't know. Not much, I hope. But some Rust-y thing will generate it for me.
The goal here is to do it with Rust. Not necessarily to avoid JS, but to use Rust.