Rust full stack web frameworks have a bright future

Sdílet
Vložit
  • čas přidán 13. 01. 2024
  • A look at Rust full stack web frameworks, including a comparison between the Dioxus and Leptos.
    Keyboard: Glove80 - www.moergo.com/collections/gl...
    Camera: Canon EOS R5 amzn.to/3CCrxzl
    Monitor: Dell U4914DW 49in amzn.to/3MJV1jx
    SSD for Video Editing: VectoTech Rapid 8TB amzn.to/3hXz9TM
    Microphone 1: Rode NT1-A amzn.to/3vWM4gL
    Microphone 2: Seinheiser 416 amzn.to/3Fkti60
    Microphone Interface: Focusrite Clarett+ 2Pre amzn.to/3J5dy7S
    Tripod: JOBY GorillaPod 5K amzn.to/3JaPxMA
    Mouse: Razer DeathAdder amzn.to/3J9fYCf
    Computer: 2021 Macbook Pro amzn.to/3J7FXtW
    Lens 1: Canon RF50mm F 1.2L USM amzn.to/3qeJrX6
    Lens 2: Canon RF24mm F1.8 Macro is STM Lens amzn.to/3UUs1bB
    Caffeine: High Brew Cold Brew Coffee amzn.to/3hXyx0q
    More Caffeine: Monster Energy Juice, Pipeline Punch amzn.to/3Czmfox
    Building A Second Brain book: amzn.to/3cIShWf
  • Věda a technologie

Komentáře • 131

  • @SMOKE3104
    @SMOKE3104 Před 5 měsíci +3

    Thanks for bringing this to light!! will be trying them out!

  • @Luxalpa
    @Luxalpa Před 2 měsíci +1

    I've run into several rather critical leptos bugs, but I got them to have them all fixed so it should be pretty stable now lol. That being said, you can absolutely use leptos for a production app, you just gotta be prepared for show stopping bugs here and there and to put in the effort to report them and possibly also fix them (although the leptos maintainers are typically fixing most bugs I reported within a couple of hours or a few days).

  • @ahammadalipk
    @ahammadalipk Před 5 měsíci +1

    Nice one, seems like dioxus are using mythrilJS format for markup

  • @JarnoLaakso
    @JarnoLaakso Před 5 měsíci +75

    “Discord servers with maintainers” sounds cool and all but does not help one bit the poor dev who has been stuck on an issue and cannot find the answer with their search engine of choice.

    • @newtonchutney
      @newtonchutney Před 5 měsíci

      ChatGPT m8.. ChatGPT

    • @newtonchutney
      @newtonchutney Před 5 měsíci

      And also, I search on both Bing and Google before I decide search engines are of no help.. At most times, found Bing to be more helpful

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 Před 5 měsíci +4

      Leptos Discord "server" is bridged to Matrix, which can be indexed if the room settings are configured accordingly

    • @specy_
      @specy_ Před 5 měsíci

      ​@@newtonchutneygood luck using chatgpt for small libraries, I have problems even with huge ones like next.js

    • @johnjallen
      @johnjallen Před 5 měsíci +5

      @@newtonchutneydoesn’t help when your issue caused by a bug that’s a few weeks old

  • @ShaStudiMan
    @ShaStudiMan Před 5 měsíci

    Thanks

  • @wantinggwybodaeth
    @wantinggwybodaeth Před 3 měsíci +1

    I think the bigger issue with using Leptos or Dioxus for production development is that pre-1.0, they make no promises about major breaking changes to the code and how you use it prior to the 1.0 release. It's less about bugs and more about maintainability moving forward.

  • @justsomeguy8385
    @justsomeguy8385 Před 4 měsíci

    Looks like Dioxis is taking inspiration from mobile development trends with frameworks like Flutter, Swift UI, and Jetpack compose.

  • @awave7710
    @awave7710 Před 5 měsíci +6

    brb rewriting everything in leptos

  • @_modiX
    @_modiX Před 5 měsíci +31

    My problem with Dioxus is that it forces you into the React paradigm again, and they still leverage a WebView for their mobile and desktop targets. I don't like it, we need a proper React Native alternative that is truly native on all platforms, and I hope that it will not force the React-way on you.

    • @JosephDalrymple
      @JosephDalrymple Před 5 měsíci

      Oof. Yikes. Yeah, I was actually just digging into this. I was intrigued when I saw Desktop and Mobile, until I realized that it's effectively just pseudo-support like an Electron app.

    • @_modiX
      @_modiX Před 5 měsíci

      @@JosephDalrymple yep, back when I discovered Dioxus it looked too good to be a true and it took me a while to get what is really going on. I mean they popped up pretty fast, so it felt it can't be truly native on all platforms. Actually however, there is a true competitor to React Native that does things how I want: The Uno.Platform ... but in no life I will ever do XAML/WPF again, that was pure cancer when it comes to viewmodels, style templates and errors messages. But I have to give them probs. It's still a bit slow, but the web target renders a true DOM (instead of rendering on a canvas) and their mobile controls are native as well. It's still far from an enjoyable platform.

    • @darshankumawat1764
      @darshankumawat1764 Před 5 měsíci +3

      What exactly is "react way" I don't quite understand this phrase.

    • @JosephDalrymple
      @JosephDalrymple Před 5 měsíci

      @@darshankumawat1764 There's two things that it can refer to:
      1. JSX (HTML inside your code)
      2. Composition-style (useState, useFoo, useBar, etc...)

    • @cakedayy
      @cakedayy Před 5 měsíci

      @@darshankumawat1764 I think that means React's built-in state management, as opposed to more performant signal-based systems like Solid.

  • @aiomixrecords
    @aiomixrecords Před 4 měsíci +4

    From my experience, I highly recommend Leptos for the following reasons:
    - Leptos is fine-grained with a well designed reactive state flow, unlike dixous VDOM which is coarse-grained/component-scoped reactivity.
    - Leptos pure html syntax, more vanilla and rusty.
    - No scope variable.
    - Stable and never run into issue.

    • @codetothemoon
      @codetothemoon  Před 4 měsíci +1

      agree with all of this, although I have a slight preference for the Dioxus DSL, I'm not sure its worth the other stuff. I wouldn't count Dioxus out quite yet though, apparently 0.5 is a huge overhaul of many things - should be interesting to see

    • @crab-cake
      @crab-cake Před 3 měsíci

      dioxus is based on blockdom. million js was heavily inspired by blockdom. there is still a vdom but the diffing process is much faster with the blockdom pattern. if you look in js framework benchmark it actually outperforms solid and leptos in many metrics.

  • @KSmifune
    @KSmifune Před 5 měsíci +10

    All rust needs now is faster compile times, so it will be more enjoyable.

  • @PaulSebastianM
    @PaulSebastianM Před 5 měsíci

    I thought you used nvim not emacs (saw Rustic in the screenshot at 3:55 and googled it).

  • @cryptonative
    @cryptonative Před 5 měsíci +6

    anyone who tried either leptos or dioxus, what's your experience with your compile times? have you tried them with larger codebases?

    • @ZacharyHubbellCodes
      @ZacharyHubbellCodes Před 5 měsíci +9

      I wrote a character sheet app with many modules/components - after the first few compiles, not much has to be re-compiled. That plus the live reload feature made it so that I hardly ever had to wait on compiling, just on the browser refreshing (so not more than a couple seconds usually)

    • @cryptonative
      @cryptonative Před 5 měsíci +1

      @@ZacharyHubbellCodes Thanks! I hoped that was the case. In your experience was it more like 2-3 seconds or like 9-10 seconds? (when everything is compiled and cached)

    • @bear458ziif-s
      @bear458ziif-s Před 5 měsíci +4

      the compile times are painfully slow if you're used to build tools like vite. it's kind of comparable to using webpack. it feels ancient but it's not unbearable.

    • @aiomixrecords
      @aiomixrecords Před 4 měsíci +2

      Yes, I'm using Leptos with large codebase, and it's great, trunk build compile time is not bad at all. (tho i9 12gen cpu). but trunk build --release is slow, especially with wasm-opt flags which is acceptable.

  • @SamualN
    @SamualN Před 5 měsíci +3

    5:45 developers? I think Greg is the only active maintainer

    • @_diversable_
      @_diversable_ Před 5 měsíci +5

      For Leptos, Greg & Ben are both pretty active; the Leptos ecosystem crate authors are pretty active too. I tend to help onboard people and work out documentation issues more-so than the code-base..
      Don't know about the status of Dioxus, though..

  • @DarenC
    @DarenC Před 5 měsíci +5

    I like to see the HTML rather than an abstraction of it. I think I'd gravitate towards Leptos purely for that reason (disclaimer: I'm a PHP dev, not using Rust)

  • @yousafsabir7
    @yousafsabir7 Před 5 měsíci +1

    That's great and all, but how good is web-assembly wit SEO?

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +1

      Not an expert in SEO, but both Dioxus and Leptos support SSR which I understand to be key for SEO. Just need to make sure the content relevant to SEO is sent to the browser on first load as opposed to being retrieved after the initial page load

  • @indramal
    @indramal Před 3 měsíci

    Any rust framework to do SSR and send HTML not WEBA?

  • @thurston04
    @thurston04 Před 5 měsíci +2

    My stack involves using Dioxide and Rocket. Works great

    • @ElektrykFlaaj
      @ElektrykFlaaj Před 5 měsíci

      is rocket still maintained?

    • @thurston04
      @thurston04 Před 5 měsíci

      @@ElektrykFlaaj oh yeah. They released 0.5 not too long ago

    • @ElektrykFlaaj
      @ElektrykFlaaj Před 5 měsíci +1

      @boohba maybe cause of the fact that rust can handle 20x requests per second more than any js runtime

    • @ElektrykFlaaj
      @ElektrykFlaaj Před 5 měsíci

      @boohba it's not a scripting language, has zero-cost abstractions and requires less memory. 20x is an exageration (depends what you do, sometimes its 100x, sometimes its 2x), but when speed actually matters for your business, nobody sane uses JS for the backend

    • @ElektrykFlaaj
      @ElektrykFlaaj Před 5 měsíci

      @boohba lol

  • @ajinkyax
    @ajinkyax Před 4 měsíci +1

    why not Tauri which is more mature and its also even being talked in stateofjs.
    Dixious tries to mimic React, but with Tauri you can use Rust as backend and frontend you can use React or Vue or Svelte

    • @codetothemoon
      @codetothemoon  Před 4 měsíci

      my understanding is that Tauri is only for desktop applications, right?

    • @ajinkyax
      @ajinkyax Před 4 měsíci

      @@codetothemoon its for Desktop and with v.2 for mobile too

  • @lardosian
    @lardosian Před 5 měsíci +8

    Doesn't Dioxus have the ability to use one codebase to compile to Web, Desktop and Mobile, the creator mentioned this in one of his presentations.

    • @JosephDalrymple
      @JosephDalrymple Před 5 měsíci +2

      Looks like Dioxus' support for Desktop and Mobile is effectively an equivalent to an Electron App. It just renders everything in a WebView. It doesn't natively support Desktop and Mobile :(

    •  Před 5 měsíci +3

      ​@@JosephDalrymple It's not equivalent. An electron app is written in JS, so it occupies many MB of RAM and it's slower. A Dioxus app is written in Rust, and very few JS is executed, so it occupies much less RAM and runs faster.

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz Před 4 měsíci +1

      @@JosephDalrymple I know people keep saying it, but if you want your UI to look the same as it does on the web, then what's the point of rendering it natively and not just get away with using a WebView? Genuinely curious.

  • @neociber24
    @neociber24 Před 5 měsíci +3

    The compilation times still a problem for me on Rust, JS have a great advantage there.
    I experimented before creating a fullstack framework with Yew supporting any backend, was no fun, I think just supporting one like Dioxus is better.

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +3

      True that! compilation time can be a real downer in the write-test feedback loop. Re: Yew, I agree. I think it'd be really hard to justify building something with disparate frontend and backend frameworks when you have frameworks like Dioxus/Leptos that do all of the integration heavy lifting for you

    • @kalebburris6425
      @kalebburris6425 Před 5 měsíci +3

      I've had great compile times by turning on nightly with the new multithreaded frontend and turning on incremental compilation. Sub-5 seconds.

    • @neociber24
      @neociber24 Před 5 měsíci +1

      @@kalebburris6425 that's an improvent, I only tested on small toy projects, not sure how well it scales when you have a ton of components

    • @kalebburris6425
      @kalebburris6425 Před 5 měsíci

      @@neociber24 I've got a little over 1k lines right now, seems to scale decently.

    • @kalebburris6425
      @kalebburris6425 Před 5 měsíci

      Actually my incrementals compilations are typically sub 2 seconds depending on the scale of the change. This comp time stuff is only an issue if you have major changes or are compiling freshly.

  • @posteisnoob5763
    @posteisnoob5763 Před 4 měsíci +2

    genuinely curious why would someone use Rust over JS for the FE logic of production applications. I do get that for fun everyone can do what they want, but what's the benefit of bringing rust to the FE? One can achieve really good DX (i.e: TS) as well as performance (kv stores, CDN) - so what makes Rust a compelling choice to consider?

    • @codetothemoon
      @codetothemoon  Před 4 měsíci +4

      it's a great question! most frontends will not benefit much performance-wise from using Rust/WebAssembly. But for those that need to use WebAssembly for performance critical pieces (like Figma, Google Earth), it might make sense to just use Rust across the entire frontend instead of having a bridge between the JS and WASM.
      You could make the case that writing the frontend in Rust yields better compile time static analysis that may help prevent bugs. Same benefit on the backend.
      Also on the backend, using Rust will likely provide performance and memory efficiency benefits over using something like JS.
      Then putting it all together - using the same language on both the frontend and the backend provides so many benefits - the ability to have server functions which automatically handle the interface between the client and server, server side rendering, no need to context switch when developing in the frontend and backend, etc.

    • @posteisnoob5763
      @posteisnoob5763 Před 4 měsíci +1

      @@codetothemoon Thanks a lot for your in depth response.
      It's very interesting to see how the movement to move JS to the BE to have the same language across the stack is met with a response to move Rust to the FE for the same reasons. Communities of these languages are truly powerful and I can't help but to feel excited of what's going to come.
      Thanks a lot for your effort to make these videos. You inspire me to get better and 'make better' around me.
      :)

    • @VivekYadav-ds8oz
      @VivekYadav-ds8oz Před 4 měsíci +4

      In one of the recent Dioxus talks, I heard that Eurpoean Space Agency is using Dioxus to create some web app that runs on planes. If such serious and to-the-spec kinda people are deciding on Rust despite it being pretty new, I assume the performance has to be the most critical aspect of it.

  • @ollydix
    @ollydix Před 5 měsíci +12

    My issue with Axum and Artix is the auto-documentation sucks. Salvo and Poem are much better choices for APIs to be honest; Manually tagging OpenAPI docs is a terrible choice (for Axum and Artix) it leads to a lot of human error.

    • @evanalmloff8606
      @evanalmloff8606 Před 5 měsíci +1

      Dioxus also supports Salvo and Warp for fullstack in addition to Axum

  • @mantovani96
    @mantovani96 Před 5 měsíci +4

    I don’t get why they use their own syntax to create HTML elements, why would I like to learn an entire set of constraints related to their template since this would be useless somewhere else. It’s like learning how to make queries using an ORM instead of just using your knowledge in SQL.

    • @marcusrehn6915
      @marcusrehn6915 Před 4 měsíci

      Exactly, you still need to know html or sql and then translate it in your head

    • @crab-cake
      @crab-cake Před 3 měsíci

      yeah that's one of the main reasons i prefer leptos over dixous. i was able to pick up leptos quickly because it feels exactly like jsx.

    • @Volodya-th2bm
      @Volodya-th2bm Před dnem

      Elm lang is similar to dioxus. Based on Haskell. That is why.
      Most people are more familiar with React and not Elm. Check Elm out.

  • @AdlerWeber
    @AdlerWeber Před 5 měsíci +2

    I’d use Rust for the frontend if the ecosystem had accessible component libraries like shadcn. Until then, I’m going to prioritize UX/dev velocity over DX/maintainability and stick with Typescript. If I need Rust performance, I’ll use WASM bindings. The harsh reality is that development in Rust is always going to be slower than Typescript, and most projects never see 1000 users.

    • @stone-snare
      @stone-snare Před 5 měsíci

      faster in what way? not on the server, that's about 200x faster in rust. not on the client when most of these frameworks are using signals like solid. architecture is more important than language when it comes to frontend performance. the js glue performance cost is a myth.

    • @AdlerWeber
      @AdlerWeber Před 5 měsíci +1

      @@stone-snare Could you repeat your question? I mean that Rust brings many pros in terms of maintainability (think monadic error handling, exhaustive pattern matching) and performance (tight loops, fine-grained algorithms) to the frontend. However, I’d argue that being able to iterate quickly is more important to the frontend in 99% of projects, and writing Rust will almost always be slower than TS.

    • @stone-snare
      @stone-snare Před 5 měsíci

      @@AdlerWeber oh i didn't know you were referring development speed. for most js frameworks i'd agree, especially svelte and vue. for react it's debatable and even more so now with react server components.

    • @mwcz5190
      @mwcz5190 Před 5 měsíci

      There are accessible Web Component libraries out there which are fully compatible with Leptos/Dioxus/etc.

  • @asisdash4278
    @asisdash4278 Před 5 měsíci +2

    Hi any one will tell me i am done with rust basics, so any can help me which frame work should i learn for rust, i am thinking to start with rocket

    • @dr3w979
      @dr3w979 Před 4 měsíci

      For backend , dont use a framework for now , use a library like warp

  • @CODEDSTUDIO
    @CODEDSTUDIO Před 5 měsíci +1

    If the mobile was native or something like flutter type, I would have use it

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +1

      I suspect this sentiment is shared by many, hopefully they have something like this on the roadmap (I haven't checked)

  • @fieryscorpion
    @fieryscorpion Před 4 měsíci

    0:57 Not really; Blazor WASM is the pioneer of doing web app using Web Assembly. And it's leaps and bounds easier than doing it with Rust.

  • @avwie132
    @avwie132 Před 5 měsíci +2

    I really don’t understand why a DSL for HTML is seen as a pro

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +3

      I personally think HTML is more verbose than necessary and this syntax is both easier to work with and easier to read. But that’s just me 😎

    • @avwie132
      @avwie132 Před 5 měsíci +1

      ⁠​⁠@@codetothemoonbut how much less verbose is this DSL? You only lose the brackets and closing tags, but any normal ide will add these for you.
      The problem I have with these dsls is that they always cover not 100%. What if I want to use web components? Do I need to add something additional to the DSL?

  • @sterin557
    @sterin557 Před 5 měsíci

    Bro is on gun point

  • @unknown-user001
    @unknown-user001 Před 4 měsíci +1

    leptos is more readable for me.

    • @codetothemoon
      @codetothemoon  Před 4 měsíci

      I can definitely understand that perspective! Sometimes I'm still on the fence about which one I prefer from a readability perspective

  • @simonkalu
    @simonkalu Před 5 měsíci +1

    Rust is very powerful... It makes you feel super human once you understand the syntax. It's actually interesting to write in Rust if you have the brain and a trial will convince you 🤪

  • @jenreiss3107
    @jenreiss3107 Před 5 měsíci +7

    as long as WASM frameworks still need to go through JS to access the DOM, Rust frontend frameworks will never be able to achieve their true potential

    • @evanalmloff8606
      @evanalmloff8606 Před 5 měsíci +3

      The performance of going through the JS to access the DOM isn't much of an issue. There is some overhead to convert between the rust and JS string format, but Dioxus uses a custom binding system sledgehammer-bindgen to mitigate that issue. It has about half the overhead of wasm-bindgen for dom manipulation.
      Even with the slight overhead JS adds, both dioxus and leptos are both very fast. They are both faster than (the old version) svelte and react.

    • @climatechangedoesntbargain9140
      @climatechangedoesntbargain9140 Před 5 měsíci +2

      Leptos is already faster than common JS frameworks in a simple app and the distance will only increase with app complexity

  • @olsuhvlad
    @olsuhvlad Před 5 měsíci +1

    Did you get paid from Dioxus? :) - Iced is cooler, I looked at all the GUI frameworks. Iced is cooler. :) - just kidding... I haven’t fully figured it out myself yet, but Iced and egui are praised in public.

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +2

      no, this was not sponsored. re: Iced is cooler - LOL i love it. took me a second 😎 Seriously though I've been wanting to check out Iced and egui, as you say they seem to get a lot of love from the community

    • @bradhuf
      @bradhuf Před 5 měsíci

      @@codetothemoon Egui seems to be most peoples choice among Iced, egui and druid. The documentation for Iced is subpar.

  • @JosephDalrymple
    @JosephDalrymple Před 5 měsíci +1

    4:10 - Red flag. 4:15 - Crisis averted

  • @basione
    @basione Před 5 měsíci +6

    Honestly, for a web server, I can't see myself picking Rust over Go anytime soon :)

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +3

      Hard to beat the simplicity of Go, especially because it's almost as fast as Rust in a lot of cases 😎

  • @hodawa
    @hodawa Před 4 měsíci +1

    The syntax looks ugly, not as good as in react.

    • @codetothemoon
      @codetothemoon  Před 4 měsíci +1

      that was kind of my first impression as well, but I found that when it became more familiar, this sentiment largely went away.

    • @hodawa
      @hodawa Před 4 měsíci

      @@codetothemoon don't know why people try to bring spaghetti code back on this while merging server side and client side code together like the practice people commonly used in 10-15 years ago in ASP or PHP projects. It may be OK in small projects, for big projects manage those kinds of code could be painful.

  • @user-iq334
    @user-iq334 Před 5 měsíci

    lol, just no.

  • @nameless4014
    @nameless4014 Před 5 měsíci +1

    no it doesn't

  • @chm-dev
    @chm-dev Před 5 měsíci +1

    Why on earth would anyone choose to code webdev stuff with Rust. It seems really stupid.

    • @_diversable_
      @_diversable_ Před 5 měsíci +6

      Because debugging JS code once it's in production is a terrible dev experience, and customers hate buggy JS apps.
      Rust helps you solve issues upfront, at compile time, so that bugs don't crop up unexpectedly in prod.

    • @bear458ziif-s
      @bear458ziif-s Před 5 měsíci +2

      the funny thing is that next 14 with rscs is more complicated than rust wasm frameworks

    • @_diversable_
      @_diversable_ Před 5 měsíci

      @@bear458ziif-s lol

    • @steveoc64
      @steveoc64 Před 5 měsíci +1

      Because the multi-billion dollar marketing machine behind rust has convinced a bunch of people that rust is the only choice

    • @simonkalu
      @simonkalu Před 5 měsíci

      @@steveoc64 Not true. Rust is great. A trial will convince you

  • @CrazyLuke11
    @CrazyLuke11 Před 5 měsíci

    Second🎉🎉 😂

  • @yanfernandes2892
    @yanfernandes2892 Před 5 měsíci

    that sintax is shi

  • @steveoc64
    @steveoc64 Před 5 měsíci

    Rust has been a huge success in coming up with a paradigm that literally sucks all the enjoyment out of programming
    It’s a great language for ppl that don’t give a rats about computers

  • @mintx1720
    @mintx1720 Před 5 měsíci +4

    It's all sunshines and rainbows in rust front end until you reach web_sys.

    • @codetothemoon
      @codetothemoon  Před 5 měsíci +3

      why is that?

    • @ZacharyHubbellCodes
      @ZacharyHubbellCodes Před 5 měsíci +4

      I had a decent experience using it - I've found it to be a very helpful escape hatch for when the framework doesn't do what you're wanting

    • @bear458ziif-s
      @bear458ziif-s Před 5 měsíci

      web-sys is just the dom api's in rust