The 2 AM Shock: When a “Hello World” App Devours Your RAM
It was exactly 2 AM when my phone started vibrating incessantly. A client was complaining that the internal dashboard I had just delivered was causing the accountant’s computer to… freeze completely. When I opened Task Manager, I was stunned. A simple application that only displayed charts and data tables was “hogging” up to 1.5GB of RAM. The culprit was none other than Electron.
This isn’t an isolated problem. Electron is incredibly convenient because it allows you to use HTML/CSS/JS for desktop apps. However, the price you pay is that every build must carry the entire Chromium engine and Node.js runtime. It’s common for a blank app to consume several hundred MB of RAM upon startup. Installer files weighing nearly 100MB are also standard.
Why Is Electron So Heavy?
Let’s look at how Electron operates to see the problem clearly. Every time you run an Electron app, the computer initializes an instance of Chromium. Imagine opening 10 different apps like Slack, Discord, VS Code, or Spotify. At that point, the system is burdened with 10 Chrome browsers running in the background. It’s a massive waste of resources.
Not to mention, bundling the entire Node.js source code along with a massive node_modules folder makes the app size balloon quickly. For projects requiring efficiency and security, Electron’s fatal weaknesses become apparent—weaknesses that no update can fully resolve.
Finding the Balance Between Speed and Usability
Faced with this challenge, I considered three main paths:
- Native (C++/C#): Peak performance and ultra-lightweight apps, but development time is too long. Designing complex user interfaces (UI) with CSS becomes an unaffordable luxury.
- Python (PyQt/PySide): Easier to write than C++, but packaging is a nightmare. Dependency errors are a common occurrence on end-user machines.
- Tauri: A “newcomer” making waves. It uses Rust for the system core and allows any Web framework like React, Vue, or Svelte for the UI.
Tauri – Lightweight as a Feather, Powerful as Rust
After a few real-world tests, I decided on Tauri. The biggest difference is that Tauri doesn’t come with Chromium. Instead, it leverages the operating system’s native WebView (WebView2 on Windows, WebKit on macOS/Linux). The results were astonishing: the installer size dropped from 80MB to just 4MB. RAM consumption also decreased from 1.5GB to under 100MB for the same functionality.
Step 1: Environment Setup (Don’t Skip This!)
Since Tauri runs on Rust, you need to install the Rust compiler first. Don’t worry; you don’t need to be a Rust expert to build applications.
# Install Rust (Windows/Mac/Linux) via rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Don’t forget to check Node.js to get React ready:
node -v
npm -v
Step 2: Initialize the Tauri + React Project
To save time, I usually use a quick-creation command instead of manual configuration:
npm create tauri-app@latest
The terminal will present a few options. Choose TypeScript / JavaScript, then select React combined with Vite for the fastest possible build speeds.
Step 3: Deciphering the Directory Structure
After initialization, you’ll see a src-tauri folder. This is where the Rust code lives—acting as the backend for heavy tasks or deep system integration. The src folder is still where you write your React code as usual.
While coding the UI, if you need to process complex JSON strings from an API, I often use tools at toolcraft.app. For example, the JSON Formatter tool helps quickly test data without installing bulky extensions in VS Code.
Step 4: Building the “Bridge” Feature
Tauri’s strongest selling point is the mechanism for calling Rust functions from JavaScript (Commands). If you need to read a file on the computer, let Rust handle it instead of Node.js for better security and performance.
In the src-tauri/src/main.rs file:
#[tauri::command]
fn greet(name: &str) -> String {
// Translated return message
format!("Hello {}, this app is only 4MB and opens in less than 2 seconds!", name)
}
fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
On the React side (App.tsx), calling this function is incredibly simple:
import { invoke } from '@tauri-apps/api/tauri';
const handleGreet = async () => {
const message = await invoke('greet', { name: 'Thanh' });
console.log(message);
};
Step 5: Build and Enjoy the Results
When everything is ready, run the build command to create the final installer:
npm run tauri build
Check the src-tauri/target/release/bundle folder. You’ll see an incredibly small `.msi` or `.dmg` file. It truly feels like a massive weight has been lifted.
Conclusion: When Should You Choose Tauri?
Tauri is powerful, but it’s not a silver bullet for every case. If your app needs deep integration with Chromium-specific features or if you want to use 100% Node.js on the backend without touching Rust, Electron is still the safe choice.
However, with the current trend toward performance optimization, Tauri is clearly a formidable competitor. It allows us to create apps that are both beautiful thanks to React, and fast and secure thanks to Rust. If you’re planning a new desktop project, give Tauri a try. You won’t want to go back to Electron.

