My name is Kam. I’m the founder of Linen and today we are launching our Mac and Windows Desktop clients. Linen is a search engine friendly Slack alternative for communities. We started out as a static site render but has evolved in to a fully fledged Slack alternative. One of our core tenants at Linen is that performance shouldn’t be an after thought and when we were choosing a framework to build our desktop client we needed to balance the our desire to build a performant client vs the engineering resources of our small team. We didn’t want to be a bloated Electron app. But being a small team we didn’t have the resources to build a separate desktop client for each platform. Luckily we ended up stumbling upon Tauri, which is a Rust based Electron alternative. This lets us set up desktop client with a single language across multiple platforms while not contributing to the desktop client bloat. We are launching our (beta) Mac/Windows (alpha) Linux desktop clients today as well as wanting to share our experience building on Tauri instead of electron.
You can download them here:
Mac – Beta
Windows – Beta
Linux – Alpha
What is Tauri and how does it compare to Electron?
Tauri is an open-source electron alternative that is built in Rust. The promise of Tauri is that you can build smaller, more performant and more secure desktop clients. One of the main core differences with Tauri is that it uses a Webview instead of using chromium like in Electron. This means that every desktop application doesn’t have to ship with chromium and can rely on the native browser’s webviews. The downside here is that because it is using Webview you have to deal with different quirks of different operating systems. Additionally Tauri’s ecosystem isn’t as mature as Electron’s which means that you will run in to quirks and have to build more custom code.
Building the desktop client:
Setting the ground work:
Linen is original built with NextJS and heavily relied on server rendering it meant that it was actually quite difficult to get Tauri working with Nextjs. This isn’t a problem with NextJS or Tauri but more that the two is not very compatible if you are using the server-side rendering features of NextJS. We discovered this after trying to build Tauri and realized that it required you to export a static version of NextJS. This is doable but it essentially means that you have to build NextJS as a single page app which defeats the purpose of server rendering of NextJS. Side note: (We would run in to a similar issue with Electron and NextJS as well)
To get this working we essentially had to refactor all of our code out from NextJS to a separate package that can be reused between both the NextJS app and a single page app that is built for Tauri. It took us 2 months of engineering hours for this refactor. If you need a desktop client I would recommend building a classic react single page app over using NextJS. If you have the strange requirement of requiring both server rendering as well as single page app (like us) I would recommend you extract most of your components out in to a package that can be reused in both applications, which is ultimate what we ended up doing. The advantage here is that these components are very modular and can be reused in different project/packages. Since our project is a mono repo it didn’t introduce too many issues.
What was our developer experience with Tauri?
Tauri was quick to set up and were we able to get a pretty smooth developer experience in the beginning. We were able to build the desktop clients to get started but ran in to a few issues and had to implement some work arounds.
- TitleBarStyle – For us we wanted the desktop to feel as native as possible and not like a browser. It was difficult to customize the the header to the styling to exactly what we wanted. We ended up having to make the header transparent and implement a custom drag region to make our window draggable. You can see more details
- Notification lacking callbacks/Listeners – There is no way to know which notification the user clicks in Tauri. There is a few work arounds one is using a third party notification system we haven’t found one we were happy with yet. Tauri uses
https://github.com/hoodie/notify-rust under the hood but there is no way for the app to know which notification user clicked on for mac and windows which means we don’t know which thread/channel to show. There is an outstanding issue opened here https://github.com/tauri-apps/tauri/issues/3698 the underlying dependency is Notify-Rust. We’ve also opened a bounty for this github issue https://github.com/hoodie/notify-rust/issues/186
- Drag and drop file uploads – We have multiple text areas for file uploads. Tauri’s doesn’t only provide information about the element that is dragged over. Because we have multiple draggable chat boxes where you can drag files to upload, we don’t know if you are replying to a thread or a channel message. One work around would be to detect the cursor position and select the element based on the draggable area but that would be a fairly ugly hack. We are hoping that this following feature gets released:
- Linux client – We also ran in to an issue with Linux client’s fonts and emoji’s not building properly. We’re still working through this but wanted to release our Mac and Windows client since that covers over 90% of our users. If anyone has any tips or advice around this feel free to comment on our Github issues.
Overall our experience with Tauri has been overall positive but there has been quite a bit of additional work to get even our Mac and Windows client working. There are still a lot more work that needs to be done for to have a great desktop experience so if anyone would like to take a crack at fixing some of these issues check out our repo at https://github.com/linen-dev/linen.dev
Our bundle size and our bundle size for the desktop clients:
- Mac – 4.17 MB
- Windows – 4.13 MB
- Linux – 73.8 MB
If any one from the Tauri or is great at rust team is reading this we would love to see some attention on these github issues:
Again you can download the releases: