17 ms·
Dioxus 0.6 – Crossplatform apps with Rust
- datadeft 2y agoIs Tauri and Dioxus similar projects, or those are made for different purposes?
- huevosabio 2y agoAFAIK, Tauri is an electron replacement: a portable web view container where you can use any web tech to build an app. So you can build with JS/TS or any language that compiles to WASM. You can use the Rust native host but you don't have to. Dioxus is a full UI kit for Rust. They stick as close as possible to React and even have CSS and Html syntax. But, it's not a web environment.
- synergy20 2y agoa quick read shows it tries to be 'flutter but in rust'
- deleted 2y ago[deleted]
- 0x457 2y agoNeither Tauri nor Dioxus is trying to be flutter. The only similarity is that those projects exists in GUI space. Tauri is an electron alternative. It handles windows creation, rendering of web pages as well as IPC between frontend and backend. Dioxus is a frontend framework similar to Next.js and other react-based frameworks. Flutter uses an entirely different approach to GUI.
- anentropic 2y agoThe linked article literally states: Our goal is to build a "Flutter but better."
- jkelleyrtp 2y agoI never know how to position Dioxus, so would be happy to have some 3rd party insight. When I say we use a webview, people immediately jump to Tauri. But we're very architecturally different than Tauri. No WASM on native, just a regular old executable. When I compare us to Flutter, people immediately think of Flutter's negatives (poor web support). We have excellent web support (DOM is 1st class). When I compare us to React Native, people immediately think the web is 2nd-class and then wonder why we don't implement NSScrollView and all that. We are shooting for something like Flutter (web, desktop, mobile, embedded) but where the web is the defining feature. As someone outside Dioxus, how do you think I should describe it?
- anentropic 2y ago> We have excellent web support (DOM is 1st class) ah I missed that... I read something about Flutter and WASM and kind of assumed it was rendering to canvas that's very nice
- jasonjmcghee 2y agoDifferent purposes- at least that's how it started / feels like it currently is. A similar comparison would be Electron and React / React Native. Tauri is a way to package a web app (e.g. could be react or svelte written in typescript) in a window and interface with rust code. Dioxus is a way to write web apps (and other applications) in pure rust.
- fl0id 2y agohow pure though if it's using react.
- jasonjmcghee 2y agoit isn't. it's "like react"
- airstrike 2y ago"Pure rust" is not quite accurate given the rsx! macro DSL stuff
- jasonjmcghee 2y agosure it is. the macro is written in rust and used in rust and compiled using the rust compiler
- airstrike 2y agothe tooling might be in Rust, but now I have to write some new DSL that isn't Rust
- jkelleyrtp 2y agoThe DSL is basically just Rust structs with optional fields. We essentially use the same struct parser rust uses but with some small tweaks. You want to use a macro for this so you can do hot-reloading - doing it with native Rust is currently impractical for rapid dev.
- resoluteteeth 2y agoEdit: apparently the documentation indicating this was inaccurate -------- Original comment: Dioxus appears to currently use Tauri for the desktop renderer (https://dioxuslabs.com/learn/0.6/guides/desktop/ https://dioxuslabs.com/learn/0.6/guides/desktop/) so it seems like it's a cross-platform framework that uses tauri on the desktop. However it seems like they to switch to their own html renderer for desktop at some point.
- jkelleyrtp 2y agoWe don’t necessarily use Tauri… Tauri has a library called wry that’s basically a more maintained fork of the Rust web-view library. https://github.com/Boscop/web-view https://github.com/Boscop/web-view We are great friends with Tauri but I think people misunderstand our architecture and philosophy just because we use one of their maintained libraries. We’ve been working on a native HTML/CSS library for a while called blitz which is reaching stability soon. https://github.com/DioxusLabs/blitz https://github.com/DioxusLabs/blitz
- ezero 2y agoI'm guessing some of that misunderstanding comes from the fact that it states "Dioxus desktop is built off Tauri" here: https://dioxuslabs.com/learn/0.6/guides/desktop/ https://dioxuslabs.com/learn/0.6/guides/desktop/
- jkelleyrtp 2y agoOh, my bad. That language has never been accurate and I'm not 100% sure why it's phrased that way. Just pushed an update.
- resoluteteeth 2y agoI'm just going based off of the page I linked (which appears to be the documentation for version 0.6 which was just released) which says: > Dioxus desktop is built off Tauri. Right now there are limited Dioxus abstractions over the menubar, event handling, etc. In some places you may need to leverage Tauri directly – through Wry and Tao. Maybe that paragraph is out of date though? From your comment it seems like wry is not (currently?) based on Tauri so it doesn't seem like it would make sense to "leverage Tauri directly – through Wry"; was wry previously based on Tauri and is that part left over from before that change? Or did the person who wrote the documentation misunderstand how it works?
- echelon 2y agoI've been interested in Dioxus, Leptos, egui, etc. for awhile, but I have to admit I don't know the technical workings of the framework. On desktop/mobile, does Dioxus run as a native app? Is it an immediate mode renderer like egui? How do you style it? Or is it JavaScript + webview/electron? On the web does it run as a WASM binary against a canvas renderer, or is it write to DOM? How does it talk to the DOM? WASM, JavaScript transpilation, etc.? Can you do multithreading on web with web workers? Is the async story good? HTTP/gRPC clients? Do you have to build your entire app in Dioxus, or can you incorporate other web (eg. React) apps? Can it talk to JavaScript? How solid is the API now? Is it going to change a lot in the near future? Do you think it'd be trivial to stuff a Bevy game inside of a Dioxus shell? We've thought it might be easier to prototype the UX outside the engine, especially since web is a deployment target. How big is the community? Looking into this for a project soon, so if any of the Dioxus devs can answer some of this, I'd super appreciate it. (Sorry for all the questions which may already be answered in the FAQ/docs.)
- jkelleyrtp 2y agoDioxus is similar to modern React Native in architecture. Your rust code is running natively and you can call into JNI and Objective-C freely without a VM in your way. It’s retained mode and stays close to the architecture of a React/Svelte app. On the web, it talks DOM directly. We have SSR, hydration, streaming HTML, and a fullstack nextjs-esque framework to go with it. All done via webassembly. The async story is great. Our state management is multithreaded and many users are using web workers and PWAs. We have focused less on building a good multi-tenant story but you can definitely integrate React into Dioxus and Dioxus into React. We’re close to runtime compatible but React core is a shifting foundation to build on. The API feels closer to solid now but the scope of the project is big and APIs are bound to change. This update, we changed a few things but upgrading is quick. It will be a while before we want to rework interfaces again, and we’ll likely provide codemods at that point. I think the community is quite large (gaining critical mass for library support) picking up steam, but JS land certainly is going to be much bigger.
- niteshade 2y ago> Dioxus is similar to modern React Native in architecture. Your rust code is running natively and you can call into JNI and Objective-C freely without a VM in your way. Given the similarity, would it be feasible to add a compatibility layer to bring in React Native Turbo Modules? (Fabric support would be unlikely I'd imagine)
- diablozzq 2y agoI’ve been watching this for a while. It’s the most promising tech framework I’ve seen. If they succeed, it could obsolete all other frameworks. Mobile, desktop, web, rust They have an eye on performance up front which is where most previous attempts fail. And rust gives them the security and performance foundation up front. .5 was a huge leap, this looks like the polish that should make it viable.
- J_Shelby_J 2y agoImagine hitting deploy and your app builds for every platform that exists.
- highwaylights 2y agoThere’s this https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blaz... And to a lesser extent this: https://expo.dev/ https://expo.dev/ (It won’t target games consoles or non-headless edge devices, that I know of).
- bitbasher 2y ago^ Like a website? https://xkcd.com/1367/ https://xkcd.com/1367/
- jcelerier 2y agoidk I do this in plain ol' C++ with Qt & CMake, every commit builds for mac, windows with msvc and mingw, 15-ish linux distros / configurations, web, bsd... https://github.com/ossia/score?tab=readme-ov-file#build-status https://github.com/ossia/score?tab=readme-ov-file#build-stat...
- highwaylights 2y agoIt could well become very popular, but using words like “magical” and “blazing fast” immediately triggers my framework fatigue. To say if it succeeds that it could obsolete all other frameworks is an incredibly bold claim. .NET already did that, several times over, over many years. Other frameworks still exist because not every problem needs a hammer, and the more use cases you try to solve the more you suffer from the jack-of-all-trades problem. I’m interested in how this solves for the web and mobile. It references flutter in its marketing - is it doing its own rendering in these scenarios? If so, it’s DOA for me for a whole host of reasons that have already sunk projects like this a lot of times over.
- andridk 2y agoVery cool demo, but If the application code is HTML/JS/CSS, then why do we need RSX? Is the web framework necessary? How does this compare, to say Tauri w. React & Vite?
- jkelleyrtp 2y agoIn the same way React Native still uses JSX, Dioxus uses RSX even if those widgets are rendered natively (say, on the GPU).
- ewuhic 2y agoDioxus drastically lacks in ecosystem. There is not a single component library out there. I'm also not sure about virtual DOM. I do track and use their main competitor - Leptos.
- diablozzq 2y agoYea component library is a key feature they need asap. They did start one but development hasn’t taken off and prioritized. DIY components is rough for basic dev.
- Evan-Almloff 2y agoThere are several good community component libraries now. daisy rsx is one that is already updated with 0.6 support: https://crates.io/crates/daisy_rsx https://crates.io/crates/daisy_rsx
- davidatbu 2y agoAnother shoutout for leptos, which I'm also currently using, and loving (except for compile times (a Rust problem, not a leptos problem), and other smaller annoyances).
- marcyb5st 2y agoI had similar issues but I was able go largely solve them. Break down your project in crates in a cargo workspace. My reload time went from 10/15s to ~4. I followed the instructions here: https://benw.is/posts/how-i-improved-my-rust-compile-times-by-seventy-five-percent https://benw.is/posts/how-i-improved-my-rust-compile-times-b... . Specifically the 2nd part of the post
- davidatbu 2y agoI've tried following that same guide, and I believe I've tried every thing on that blog post except the mold linker, because I'm on MacOS, and the MacOS version of the mold repo says "use the default linker if you have XCode 15 or higher." And I do think I have a pretty granular crate system (would be _very_ happy to hear otherwise, because that would mean there's low hanging compile time fruit!): https://github.com/dnaaun/heimisch https://github.com/dnaaun/heimisch My current _incremental_ compilation time swings anywhere between 15 seconds and 3 minutes (no, I'm not kidding). And I work on an M3 max macbook pro. --- Things that I suspect are making my compile times worse: 1. The fact that I am doing SSR, which means my frontend code is included in the backend code as well. 2. I _think_ Rust is unnecessarily recompiling dependencies on incremental builds? (I don't understand how incremental compilation times can be so bad otherwise). But I'm clueless about how to go about debugging that.
- sa-code 2y agoWould be cool to see a front end for this in Mojo when the language matures a bit
- oDot 2y agoAfter discovering and adopting[0] Lustre, I can't think of using anything other than The Elm Architecture. It is so much more ergonomic it's not even comparable to today's mainstream state management techniques. I'm also building a screenplay editor prototype[1] in the Rust equivalent, Iced, and while not as ergonomic as Lustre and Gleam, it is TEA. Iced is still in flux but I have trust, considering System76 uses it to build Cosmic. [0]: https://blog.nestful.app/p/gleams-lustre-is-frontend-developments https://blog.nestful.app/p/gleams-lustre-is-frontend-develop... [1]: https://www.weedonandscott.com/tech/project-realm https://www.weedonandscott.com/tech/project-realm
- voat 2y agoWhat is wrong with the dioxis approach?
- oDot 2y agoI wouldn't say it's outright wrong, I just much prefer the ergonomics of an orderly, TEA-like state management. Many of the projects I make lend themselves well to that approach.
- tharmas 2y agoTyrian is the Scala.js framework that follows TEA. https://tyrian.indigoengine.io/ https://tyrian.indigoengine.io/
- cardanome 2y agoThe Elm architecture is amazing! Gleam looks great. Reading the FAQ, especially why the don't implement type classes, I am a bit worried though that it leans to much into trying to be simple. Minimalism can work in dynamic languages because they impose basically no restrictions on your types and you can have crazy complex ones for free but in a purely static languages a lack of more advanced type system features can make writing library code very annoying and make the language feel very boilerplaty. The advanced type system features that languages like Haskell or OCaml provide are not purely for academic wankery, some of them are extremely useful. Even Golang had to add generics. I hope they don't fall in the same trap as Elm did where it got so obsessed with simplicity that super knee-caped the language. I mean the Gleam devs seem already be way more pragmatic. At least it seems to have a decent FFI which provides an important escape hatch.
- _blk 2y agoSounds promising. I was looking at Tauri recently for an upcoming iOS/Android project but it doesn't seem mature enough. I will require bluetooth and with flutter I know how to go about it. How do you, @jkelleyrtp, feel Dioxus would perform in terms of DX for a dev comfortable with flutter, react and rust but a bit of a novice with Xcode. Publishing for iOS just always seems such a hassle, but if I can't get the last step done the whole project is worthless. With rsx, does Dioxus support more free-form layouts that are not the typical Gtk box in a box but more web-type layer over layer (i.e. absolute/static positioning in html or Flutter's Stack component)
- jjallen 2y agoEvery six months or so I long for a consensus rust gui framework and try this one and run into an error from downloading the demo or playground or something like that. Some of us want to invest many years of time and money into stuff and have to make the decision carefully.
- _blk 2y agoTotally agree. This is where you get to invest: They're still looking for monthly sponsors. https://github.com/sponsors/DioxusLabs#sponsors https://github.com/sponsors/DioxusLabs#sponsors
- jjallen 2y agoI want to invest in making an app out of this framework and not be a sponsor. Another thing that concerns me about this one (at least it did a while ago when I looked) is the general team size. This is a company yet there was only one employee the first couple times I looked at it.
- smilekzs 2y ago+1. Frameworks learning costs are non-trivial. After you worked so hard to become productive in a particular framework it's frustrating to see its core and/or ecosystem fizzle --- especially when your existing code already tied the framework's unique constraints, making it a hassle to port to other frameworks. In this sense the "bus factor" / resilience of the framework dev does matter to the app dev building on top of it.
- jjallen 2y agoIt's fine to downvote me. I do contribute $50 a month to an open source repo that I use commercially, so I'm not opposed to giving money to OSS projects. Dioxus is a private company though. It is fine if people want to contribute, or if Dioxus wants investors. But isn't it a little weird trying to influence me/someone to donate to a private company to improve their _product_? They are YC: they should raise more funds and get serious IMO. Hire more people, fix the broken stuff in the DX and more people will use the product. It's that simple. Also if you want people to contribute money I would work on getting the product to a more usable state. People don't want to buy products that don't work, software or not. If the first experience is repeatedly one of not working software, people will not want to use it.
- weinzierl 2y agoDioxus raised venture capital, so I'd be careful before betting my future on them. Do they require copyright assignment or a CLA? I could not find anything on their GitHub. How many of their contributors are payed?
- cies 2y agoGood questions. We need to be careful in deed when picking a fundament.
- satvikpendem 2y agoLooking forward to this as I use Flutter personally but sometimes I write code for it via its FFI package flutter_rust_bridge, but it'd be nice to use Rust directly everywhere. I am also interested in the usage of the GPU as Flutter does because that way you get a consistent experience on the web as well as mobile and desktop. Flutter recently removed their HTML renderer because it was hard to keep both renderers in sync, but I don't believe Dioxus will do that as they started off HTML-first rather than mobile-first like Flutter.
- suby 2y agoI'd like to report my experience trying out this release. I did a cargo install. I then used the dx command line app to create a new project. After initialization I ran dx serve in the directory as instructed, but it gave me a compiler error with seemingly no feedback on what specifically went wrong. And again, this is for a hello world app that they generated for me. I'm unsure how to obtain more information on why it failed. I feel like I'd have more insight and ability to debug this if I were trying to compile using a standard rust workflow rather than their CLI tool. You can press v to enable verbose logging, but this doesn't add information which provides clarity to me. Here's the compiler output with verbose logging, though heavily edited to be readable in this HN comment box 14:17:49 [dev] Building server... 14:17:49 [dev] Building app... 14:17:49 [dev] Executing cargo... 14:17:49 [dev] cargo args: ["--profile", "server-dev", "-- verbose", "--features", "dioxus/server", "--bin", "hack"] 14:17:49 [dev] cargo args: ["--verbose", "--features", "desktop", "--bin", "hack"] 14:17:49 [dev] cargo args: ["--profile", "server-dev", "--verbose", "--features", "dioxus/server", "--bin", "hack"] 14:17:50 [dev] Setting builder to failed state 14:17:50 [dev] Build failed: Other(Cargo build failed, signaled by the compiler) Status: Failed
- jkelleyrtp 2y agoThere is a weird issue with `cargo`'s output that not all errors get emitted as an "error" - I just kicked off a new `binstall` build `cargo binstall dioxus-cli@v0.6.0 --force` that fixes the filtering issue. You can also press `t` for `tracing` logs which will emit the relevant logs. I'm sure it's something pretty simple / easy to figure out like a wrong version.
- danudey 2y ago`cargo binstall dioxus-cli@0.6.0 --force`
- 0rzech 2y agoI had the same problem, but it turned out to be a missing dependency: my webkit2gtk was 4.0 instead of 4.1. Another one, to my surprise, was xdotool. Why does a Linux webview app built with Dioxus require it? I'm asking, because software inserting simulated HID inputs to arbitrary windows is not exactly my cup of tea. ;) And xdotool doesn't work on Wayland anyway, by design. Apparently there are similar programs for Wayland, but AFAIK they require the user to belong to the input group, which in turn gives any app run by such user access to /dev/uinput - a security risk. In general, though, Dioxus looks interesting and I wish you all the best in your endeavour!
- benatkin 2y agoThe username of one of the devs :) https://github.com/DogeDark https://github.com/DogeDark
- kussenverboten 2y agoIt works amazingly well. Great crate!!
- solarkraft 2y agoFrom a cursory look the Server Functions for Native seem like a what I imagined Tauri to be: A real RPC framework that skips you the anoyances of serialization.
- ryukoposting 2y agoI tried Dioxus out earlier this year - I wanted to make a little SSHFS GUI client. Think Google Drive UI but in a dedicated window and it's SSHFS instead of some cloud nonsense. Everything went swimmingly until I needed shared state between different contexts. From that point, the code got really messy, really quickly. I don't know what the right solution is for this problem. What I can say is Dioxus hasn't found it yet. The static HTML templating thing is pretty damn good, though. I actually use it to render parts of my blog.
- revskill 2y agoI love the simplicity of the flow: Mutation => Server returns full API for FE to rerender the whole page. Trying to figure out which parts of the page to auto reload is hacky to me. And it's the best proof of: Preoptimization is the root of all evil squares.
- ianpurton 2y agoI'm using Dioxus on the server side and have written about it here. https://rust-on-nails.com/ https://rust-on-nails.com/ The way you write components is really great and the overall developer experience is very good.
- tdomhan 2y agoThe new hot-reloading is amazing! Coming from another Rust web framework waiting for UI updates to show up has always been a huge painpoint, so thanks for this!
- ecmascript 2y agoIt's cool but I could never live with that syntax. Impossible to read, it feels like.
- jkelleyrtp 2y agoIt's very much inspired by Jetpack Compose and SwiftUI. At the end of the day we just use the Rust Struct parser! It's very similar to JSON or RON if you're familiar. https://github.com/ron-rs/ron https://github.com/ron-rs/ron
- ecmascript 2y agoI'm not, I find the entire Rust language to be very unreadable. I have seen a lot of templating languages like the one in Dioxus but I don't think you will "win" the hearts of people with a templating like this: ``` rsx! { footer { class: "footer", span { class: "todo-count", strong { "{active_todo_count} " } span { match active_todo_count() { 1 => "item", _ => "items", } " left" } } ``` Even if I can read it, it's much more of a hassle since I have to translate this into actual html in my brain. Why would I pick this over regular jsx with React? Sure crossplatform is cool, but I already do crossplatform since I only do web dev like most people nowadays. Maybe I'm not the target customer here, but I have a hard time finding a reason why I should pick something that is much more complex. Speed sure but the gains are not good enough to warrant learning this and if I was a betting man I would bet against it in it's current form due to the learning curve. Also I worry about the financing sine I've read that you guys are taking in VC. Obviously there is some kind of plan in order to make money in the future and I wonder what rug-pull will happen. The thing is, I have been looking on Rust due to the performance and the potential in wasm (I do very client heavy apps that would benefit from it). But I really don't like the language or the community so I'm basically waiting for other languages to keep up. When I go in on a technology, I want to master it. So it will require a lot of learning and time investment for me which is my most precious resource and not something I will throw away lightly.
- solidninja 2y agoDioxus is the only web-platform technology toolkit that I see having the ability to be cross-platform and use Javascript as little as possible - glad to see their native WGPU rendering stack progress (check out the videos by Nico Burns on Blitz, Taffy etc)
- trentontri 2y agoHave you considered contributing to Tauri?
- sionisrecur 2y agoTauri offers Dioxus as front-end framework when you create a new project.
- gr4vityWall 2y agoSuggestion: the post title contrast with the page background could be improved. Question: where does Qt stands these days, and how does this toolkit compare to it regarding accessibility and handling HiDPI screens? Are there any quality bindings for languages that aren't C++ and Python? It feels like they solved a lot of problems long ago, and the toolkit could be way more popular with better bindings and tooling.
- rubymamis 2y agoQt is a great choice these days. I developed my block editor (like Notion) using Qt with C++ and QML. I wrote about it here: https://rubymamistvalove.com/block-editor https://rubymamistvalove.com/block-editor There are many bindings to other languages[1]. [1] https://wiki.qt.io/Language_Bindings https://wiki.qt.io/Language_Bindings
- adastra22 2y agoI want a Rust GUI framework or even entire app framework that can target desktop, mobile, and web, but I DON’T want to use web technologies other than when I am actually running within a browser. Is that Dioxus? I can’t tell the answer from what’s written here and in the comments.
- jvanderbot 2y agoNo. But what you want does exist to a certain extent. DX tries to be "rust only" but basically gives you a macro to write HTML-like components, which are obviously just a shim between layers and the abstraction is leaky. You don't get much from that. You probably want egui.rs
- adastra22 2y agoI want native widgets.
- jkelleyrtp 2y agoIf you don't want to use web technologies but still benefit from the non-web parts of the ecosystem (SDK, hooks, build tools) there's Freya. The creator is a wonderful guy and has put a lot of great work into making a nice Skia-based renderer for Dioxus. https://freyaui.dev https://freyaui.dev WRT the other comment - `rsx!{}` is carefully designed to not leak details about the web. RSX is entirely abstract over the element+listener set so you can build whatever you want with it.
- adastra22 2y agoThat seems like more of the same? rsx!{} basically presents a web view API, with CSS-driven layout (or something approximating that). I'm looking for a native widget library that can compile to web technologies when running in the browser, but otherwise uses native widgets.
- _bin_ 2y agothis looks interesting and could be a cool option. have yet to dive in deep but tbh i'm uncomfortable using a Fancy New Framework that maintainers refuse to bump to >0 major version. i know semver is a bastardized wreck of its intended semantics but still, gotta stabilize at some point. could be misdirected here but i have a reactionary streak about this after seeing one too many 8 year old libraries with 5mil downloads that still won't freaking version a 1.0.0.
- jkelleyrtp 2y agoThis is more of a culture thing with the Rust ecosystem more than anything else. If the culture of the Rust ecosystem was to publish a 1.0, we would do it. And frankly, I'd really like to have an extra "version" to play with - 0.x.y is quite limiting. There's a few core things I want to clean up and split out in 2025. If all goes well, we might see a 1.0 next year.