this post was submitted on 07 May 2025
17 points (100.0% liked)

Rust

6940 readers
53 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS
 

Hey all, just looking for some advice. I'd like to do a WASM application, just generally like a calendar + notes app. I'd like it to work on mobile and desktop through the browser. It'll be served through Actix with Diesel for the backend. For the "frontend" I was thinking egui or leptos.

I'd like to avoid any JavaScript, so thought SSR might be the best approach.

Any thoughts/pitfalls? Should I look at something else for the frontend?

Its a lot of working parts for a calendar + notes app, but this will be a testing ground to see if I can get it all going :S

top 12 comments
sorted by: hot top controversial new old
[–] deur@feddit.nl 8 points 2 weeks ago (2 children)

You will be writing JavaScript. You will not be avoiding JavaScript. WASM is still glued to the DOM with JavaScript, if you are lucky and your idea isn't that novel you won't need to write any JavaScript, I guess.

[–] alzymologist@sopuli.xyz 2 points 2 weeks ago* (last edited 2 weeks ago)

This is so true! Tried "nice crossplatform WASM" multiple times - every time you need a system call, drawing single pixel, networking, or catching input - you just start debugging JS. If the logic is simple, whole code ends up being JS mess with small inclusions of Rust. Very unpleasant experience, even with all the modern frontend code generator tools.

I ended up deciding that making custom bindings instead (edit: mention uniffi here) and building frontend in native (Qt/Kotlin/Swift) ends up being simpler, more pleasant, and the end result is faster and prettier (and no wasm limitations). The downside is having to actually use XCode if you do want iOS app to work (which is quite simple but unpleasant and requires you to have Apple hardware or suffer a lot), but if not and you don't care for Apple worshipers - it's pure win.

[–] Matty_r@programming.dev 1 points 2 weeks ago (1 children)

Really? I thought part of the attraction for WASM was that it could be native code without needing JS. That's good to know though. Thanks.

[–] TehPers@beehaw.org 2 points 2 weeks ago (1 children)

Not yet. WASM unfortunately does not have DOM access or the ability to call any native JS functions without glue code.

There are packages that work with wasm_bindgen in Rust that can generate that JS for you, but it's all still super early.

[–] Matty_r@programming.dev 1 points 2 weeks ago

OK, guess I'll avoid WASM for now then. Someone else mentioned HTMX and pair that with Leptos, I should be able to get away with no JS.

[–] mvirts@lemmy.world 4 points 2 weeks ago (1 children)

Egui seems great to me so far, not super experienced with it yet though. I think you can get away with very little js using egui for rendering.

[–] Matty_r@programming.dev 2 points 2 weeks ago

How do you find working with it? Especially the debugging side?

[–] 69420@lemmy.world 2 points 2 weeks ago

There is yew, which I like, but I think development may have stagnated on the project. There have been a few commits to master within the last week, but no new releases since 2023.

There is dioxus, which I haven't used, but looks pretty cool and seems like it fills the same niche.

[–] blechlawine@feddit.org 2 points 2 weeks ago (1 children)

I would use leptos for a wasm app, but you would need to figure styling out yourself, cause afaik there aren't any rellay usable ui frameworks for leptos yet

You could also use htmx for the frontend and render the html entirely on the server, then you wouldn't need a wasm build. For rendering on the server i like to use leptos' view! macro. Although if you need heavy interactivity you would probably still need to write at least some js, even when using htmx

[–] Matty_r@programming.dev 3 points 2 weeks ago (1 children)

I think I'm going to go this route - Leptos + HTMX. I'll see how far this gets me without any JS. What type of interactivity do you think might require JS? I assume I should be able to do form validation etc without it?

[–] blechlawine@feddit.org 1 points 2 weeks ago (1 children)

Depending on how powerful you want to make the calendar feature, that might require some amount of javascript. Things like dropdowns with more functionality than the standard select element, or autocomplete inputs, too. Generally anything that has some amount of client-side state, although many of them can easily be done with something like alpinejs or petitevue. Since form validation should be done on the server anyways and the html elements for inputs already have relatively powerful validation built in as well, form validation should not require any js.

[–] Matty_r@programming.dev 2 points 2 weeks ago

OK, that's fine. Just means I'd need to think more about how stuff is implemented. I'm thinking like input fields for date and time selection etc. Could be an interesting challenge for sure.

Surely its all been done before ha ha