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

  • deur@feddit.nl
    link
    fedilink
    arrow-up
    8
    ·
    4 days ago

    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.

    • Ephera@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      3 days ago

      We have a web-UI of medium complexity in Leptos at $DAYJOB and haven’t written a single line of JavaScript. Occasionally, you need to read the JS documentation on MDN, because the Rust code is generated like the JS, but that’s also why you don’t need to write JS, because there’s a corresponding Rust API.

    • Alexander@sopuli.xyz
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      4 days 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.devOP
      link
      fedilink
      arrow-up
      1
      ·
      3 days ago

      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
        link
        fedilink
        English
        arrow-up
        2
        ·
        3 days ago

        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.devOP
          link
          fedilink
          arrow-up
          1
          ·
          3 days 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.