Tauri and Electron are two popular frameworks that developers can use to build cross-platform desktop applications. In this blog post, we'll compare Tauri and Electron, discussing their key features, pros and cons, and use cases, to help you decide which one is right for your project.
What is Tauri?
Tauri is a framework for building cross-platform desktop applications using web technologies. It allows developers to use their existing knowledge of HTML, CSS, and JavaScript to build applications that can run on Windows, macOS, and Linux.
Tauri uses a unique approach to building desktop applications. Instead of using a web browser engine like most frameworks, Tauri uses a custom-built Rust-based engine that is optimized for performance and security. This allows Tauri applications to be smaller, faster, and more secure than traditional web-based applications.
What is Electron?
Electron is a popular framework for building cross-platform desktop applications using web technologies. It allows developers to use their existing knowledge of HTML, CSS, and JavaScript to build applications that can run on Windows, macOS, and Linux.
Electron uses a traditional approach to building desktop applications, using a web browser engine (Chromium) to render the user interface and provide access to native APIs. This allows Electron applications to be built quickly and easily, but it also means that they can be slower and less secure than native applications.
Tauri vs Electron: Key features
Both Tauri and Electron are frameworks for building cross-platform desktop applications using web technologies. However, there are some key differences between the two frameworks that are worth considering. Here are some of the key features of Tauri and Electron:
- Tauri uses a custom-built Rust-based engine that uses a platform-specific WebView instead of a full-fledged browser. This allows Tauri applications to be smaller, faster, and more secure than traditional web-based applications.
- Electron uses a web browser engine (Chromium) to render the user interface and provide access to native APIs. This allows Electron applications to be built quickly and easily, but it also means that they can be slower and less secure than native applications.
- Tauri offers support for building native plugins using Rust or C, which can be used to access native APIs and functionality that is not available in the web platform. This allows Tauri applications to be more powerful and flexible than traditional web-based applications.
- Electron offers support for building native plugins using C++, which can be used to access native APIs and functionality that is not available in the web platform. However, building native plugins can be more difficult and error-prone than using web-based technologies.
- Tauri offers a built-in build system that can be used to create installers and packages for different platforms. This allows developers to easily distribute their applications to users, without the need for external tools or services.
- Electron offers a built-in build system that can be used to create installers and packages for different platforms. However, this build system is not as powerful or flexible as the one provided by Tauri, and it may require the use of external tools or services to create more complex packages.
Conclusion
Overall, Tauri and Electron are both powerful frameworks for building cross-platform desktop applications using web technologies. Tauri offers better performance, security, and flexibility than Electron, but it may be more difficult to learn and use, particularly for developers who are not familiar with Rust or C. On the other hand, Electron offers a more familiar and accessible development experience, but its applications may be slower and less secure than Tauri applications.
Top comments (8)
Tauri does not use a custom-built Rust-based engine. It uses the OS webview engine, and doesn't bundle its own. You can see which engine it uses on each platform on its page.
Electron, on the other hand, bundles its own chromium browser. This means that it will run the same on every platform, and you don't need to worry about what each platform supports. This is one of the main attractions of Electron.
Nice catch, I clarified this part. By engine I meant their
wry
library which uses a platform-specific WebView. Thanks for pointing that out!Clearly Tauri wins but electron is also good For beginners but what you would prefer personally.
Kindly check my blog too
I have three projects I started on NW.js (similar to Electron but not as popular). I moved them to Tauri for a while and now I am using Wails 2 since I'm more fluent in Go than Rust. From my experience, NW.js or Electron make a good prototyping system for an application based on web tech. But, moving them to Tauri or Wails creates a faster application with a much smaller footprint. Tauri and Wails isn't just smaller on the executable size, but the running memory allocation is much less than Electron or NW.js.
The biggest obstacle for me is that both Tauri and Wails have issues with CORS for querying multiple sites from JavaScript on the web tech side. They have to be done in the Rust for Tauri or Go for Wails to avoid the CORs issues. But, many applications would not run into this hurdle. Tauri provides their own version of the fetch API, but it's not comparable with the normal API. That created lots of confusion for me at first. Wails leaves that for the developer to make for themselves which allows for a much easier implementation for the actual need.
Thanks Alexander for this comparison.
What do you personally prefer to use?
I like all the advantages that Tauri provides, so from now on I prefer to use it. However, I can imagine picking Electron for more consistency on different platforms since WebKit can be funky sometimes
For those whose preferred stack is Vue, there is also Quasar which uses Material Design by default, and will cross compile to native iOS and Android apps, PWA and Electron for universal desktop app
The only cons of Tauri for me is Rust, if you are not familiar with it, you’ll need some extra time.