Conversation

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?

#rust #webapp

6
0
1

For added bonus, it would be lovely if I could write my CSS in Rust too.

1
0
1
@algernon I started to dig into Rocket's documentation, and it looked well thought out, but stopped before I really got into it. May worth a look: https://rocket.rs/
0
0
1

@algernon how "zero javascript" are we talking? because if you're thinking about statically generated sites, maud is quite nice; i personally use it with rouille, but you can pick pretty much any web framework[1]

1
0
0

@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.


  1. 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. ↩︎

0
0
0

@algernon axum and htmx if you can accept running the htmx js part.

1
0
0

@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.

0
0
0

@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/

1
0
0

@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. :(

0
0
0

Some of the suggetions & my own findings so far:

  • Yew is what I know, it was nice.
  • Leptos I heard about, didn't look into it much.
  • Rust-on-Nails sounded funny, but AGENTS.md means it's not an option.
  • Dixous looks nice, batteries included and all. But it has TailwindCSS integration by default (I do not want anything to do with Tailwind), if the widgets it includes by default depend on Tailwind, then it doesn't really have anything over Leptos or Yew as far as I'm concerned.

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.

5
0
1

@algernon

AGENTS.md means 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

1
0
0

@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

0
0
0

@tauon Yeah, big same. Although, the choice between GenAI and Palantir (iirc) is... a tough one.

1
0
1

@algernon the choice between huh and whuh??? what happened?!

1
0
0
@algernon if wasm is okay then you could write frontend as a usual desktop app and use some UI crate, like bevy ui, or egui, or anything else and just have it running in the browser and sending requests to backend
1
0
0

@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).

0
0
0

@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.

1
0
1

@algernon oh that’s so fucked
and i’m not going to even pretend i have the spoons to write my own alternative

0
0
0

@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)

1
0
0

@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. :(

0
0
0

Since htmx was mentioned a few times...

2
0
1

@algernon oh i should do that hang on

0
0
0

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.

1
0
0

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.

0
0
0

@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.

2
0
0

@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.

0
0
0

@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

1
0
0

@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.

0
0
0