Desktop Apps with Electron and Tauri
Glossary
133 terms from Desktop Apps with Electron and Tauri, in plain words, each with the chapter that teaches it.
#
- #[derive]
- A Rust attribute that asks serde to write the code that turns JSON into a struct (`Deserialize`) or a struct into JSON (`Serialize`).
A
- accelerator
- A menu item property that sets its keyboard shortcut. "CmdOrCtrl+N" on KC Till's New sale item means Cmd+N on a Mac and Ctrl+N elsewhere.
- action: "deny"
- The value `setWindowOpenHandler` returns to block a new window. The handler runs before any window opens and must return `allow` or `deny`.
- activate
- An Electron app event that fires on macOS when the user clicks the Dock icon. KC Till opens a new window if none are open.
- app lifecycle
- The conventions for how an Electron app starts, gets ready, reacts to the Dock, and quits. They differ between macOS and Windows/Linux.
- App User Model ID
- An id Windows uses to group an app's notifications. An app needs a Start Menu shortcut carrying it before Windows will show its notifications.
- app.getPath
- An Electron function that returns a standard per-user folder, such as `userData` for the till's `sales.json`. Use it instead of the app's own folder, which may be read-only.
- app.whenReady
- Returns a promise that resolves once Electron has finished starting up. You may only create windows after that.
- app_data_dir
- The Tauri call that gives Rust the app's own data folder. It is the counterpart of Electron's `userData`.
- AppHandle
- A Tauri value that gives a Rust command access to the running app, for example to find its data folder. Tauri passes it in automatically.
- Application menu
- An app's menu bar (File, Edit, View). It sits inside the window on Windows and Linux and at the top of the screen on macOS. You build it from a template.
- asar
- An archive that packs an Electron app's files into one file. It loads faster and keeps the packaged folder tidy.
- async fn
- A Rust function marked async. Tauri runs an async command in the background so slow work such as reading a big file doesn't freeze the window; it can't take borrowed arguments like `&str`.
- Atomic save (temp file + rename)
- Writing data to a temporary file and then renaming it over the real file. A crash halfway through a write can't leave a half-written file.
- Attack surface
- Every way bad code could reach your app's powers. In KC Till that means the page, through XSS, a bad npm package, or a remote page loaded by mistake.
- Attribute (Rust)
- A `#[...]` note in Rust that changes the item below it. `#[tauri::command]` turns a function into a command.
- Auto-update
- An app installing its own new versions. It asks an update server for a newer release, downloads and verifies it, installs it, and restarts.
- Azure Artifact Signing
- Microsoft's cloud code-signing service, formerly called Trusted Signing. It can remove the SmartScreen warning without you keeping a hardware certificate, but is available only in some countries.
B
- Borrowing (&)
- In Rust, putting `&` before a value lets code read it without taking ownership, as in `for l in &lines`. That is why `&str` is borrowed text.
- BrowserWindow
- Electron's class for making a window. Its options set size, title, preload and more, and each window's page runs in its own renderer process.
- Bundle formats (.msi, NSIS, AppImage)
- The installer formats `tauri build` makes: `.msi` and an NSIS `-setup.exe` on Windows, `.app` and `.dmg` on macOS, and `.deb`, `.rpm` and AppImage on Linux.
C
- Capability (Tauri)
- A Tauri file, such as `capabilities/default.json`, that lists which permissions certain windows get. It decides what the page may call.
- Cargo
- Rust's package manager and build tool, like npm for Rust. `Cargo.toml` lists the crates the app uses.
- Certificate
- A file that ties your signing key to your verified name, issued by Apple or a certificate company. Code signing needs one.
- Channel
- The name an IPC message travels under, such as `sale:save`. Sender and receiver must use the same string.
- check()
- The Tauri updater function that asks the endpoint for a newer version. It resolves to an update object, or `null` if there is none.
- child window
- A window created with the `parent` option. It stays on top of its parent and closes with it.
- Chromium
- The open-source core of Chrome. Electron bundles a copy in every app, which makes pages look the same everywhere but makes the app large.
- CI/CD
- Automated build and release systems such as GitHub Actions. Teams use them to build all three systems' installers at once.
- Code signing
- Adding a digital signature to an app. It proves who made it and that nobody changed it afterward, which avoids warnings from macOS and Windows.
- Command (Tauri)
- A Rust function the page can call by name with `invoke`. It plays the role of an `ipcMain.handle` handler in Electron, like the till's `cart_total`.
- CommonJS
- The older Node module style that uses `require()` and `module.exports`. Sandboxed preload scripts and the Forge config in an ES-module project must use it, so their files end in `.cjs`.
- Context isolation
- Keeping the preload's JavaScript world separate from the page's. The page can't reach the preload's variables or Electron objects, only what `contextBridge` exposes.
- contextBridge
- The one door between the preload and the page. `exposeInMainWorld("till", api)` copies an API object into the page as `window.till`.
- core:default
- A safe starter permission set in Tauri, mostly for reading information such as the window's title or the app's version. Anything more must be added.
- Crate
- A Rust package. Cargo downloads and builds the crates your app lists, such as serde.
- CSP (Content Security Policy)
- A rule telling Chromium where a page may load things from. `default-src 'self'` allows only the app's own files and blocks inline script.
- CSV
- A plain-text table format that spreadsheets open. KC Till exports each day's sales as a header row plus one row per sale.
D
- Desktop app
- A program you install and start from the Start menu, Dock or launcher, running in its own window. It can work offline, use files and add tray icons.
- DevTools
- Chromium's developer tools, also inside Electron. They show the renderer's console, not the main process's output.
- dialog
- Electron's module for opening native dialogs from the main process. Each call returns a promise that resolves to the user's choice.
- Distributable
- The general word for any file you give to users, such as an installer, a `.dmg` disk image, or a zip.
- downloadAndInstall
- The Tauri updater call that downloads an update, checks its signature against the public key, and installs it. A bad signature makes it fail and install nothing.
E
- Electron
- A tool that builds desktop apps from web code by bundling Chromium and Node.js in every app.
- Electron Forge
- The Electron team's tool for packaging an app and making installers. It adds the `package` and `make` scripts and is configured in `forge.config.cjs`.
- electron-builder
- A popular alternative to Electron Forge that does the same packaging job with its own config.
- electron-squirrel-startup
- A small package that handles the special arguments Squirrel passes while installing. It tells the app to quit once the shortcuts are made.
- electron-updater
- An update package that works with electron-builder to download and install new versions of an Electron app. It can be used with private repositories, where `update-electron-app` and its free update server don't apply.
- Endpoint
- The web address an app asks for update information, such as the `latest.json` URL in Tauri's updater settings.
- ENOENT
- Node's error code for "no such file". KC Till treats it as "no sales yet" when `sales.json` doesn't exist.
- Environment variable
- A named setting that a terminal passes to the programs it starts. It is often used to supply secrets such as signing keys and passwords to a build without storing them in files.
- ES modules
- JavaScript's `import`/`export` module style. Setting `"type": "module"` in `package.json` makes `.js` files use it.
- EV certificate
- A Windows signing certificate issued after strict identity checks. Its key must live on secure hardware.
- event delegation
- Putting one click listener on a parent element and using `closest("button")` to find which child was clicked. KC Till's product grid does this.
- event.senderFrame.url
- The address of the page that sent an IPC message. Main checks that its protocol is `file:` before trusting the request.
F
G
- garbage collection
- JavaScript freeing any object nothing refers to. That is why the `tray` variable must live outside `createTray`, or the icon vanishes.
- Gatekeeper
- The macOS check that runs when an app first opens. It blocks apps that aren't signed and notarized.
- generate_handler!
- A Rust macro that registers your commands so the page can call them. Forgetting to list a command gives a "not found" error.
I
- Identifier
- A Tauri app's unique id, written as a reversed domain such as `com.kettleandcrane.till`. The OS uses it to keep this app's data apart from other apps'.
- inline script
- Code written directly inside a `<script>` tag or an `onclick` attribute, instead of in a separate `.js` file. A Content Security Policy such as `default-src 'self'` blocks it, which stops injected code from running.
- input validation
- Checking everything that arrives over IPC before acting on it. KC Till's `checkSale` recomputes the total from main's own prices.
- installer
- A file that puts a program in the right place and adds shortcuts, such as a Windows `Setup.exe` or a Linux `.deb`.
- invoke
- The call that asks the other side a question and returns a promise. In Electron it is `ipcRenderer.invoke`, and in Tauri it calls a Rust command.
- IPC
- Inter-process communication: messages passed between the main process and the page's renderer process on named channels.
- ipcMain.handle
- Registers the main-process answer to a channel. Whatever the handler returns or resolves to becomes the page's result, and a throw rejects the page's promise.
- ipcRenderer.on
- The way messages go from main to the page. Main calls `webContents.send(channel)` and the preload listens with `ipcRenderer.on`.
L
- latest.json
- The file on a static update server that tells Tauri's updater the newest version, notes, and each platform's installer URL and signature.
M
- Macro (Rust)
- Code that writes more code when Rust compiles. You call one with a `!`, as in `format!`.
- Main process
- Electron's Node.js process, one per app. It runs `main.js`, opens windows, menus and dialogs, and reads and writes files.
- Maker
- A Forge plugin that builds one installer format, such as Squirrel, dmg, zip or deb.
- Menu.buildFromTemplate
- Turns an array of plain menu objects into a menu. `setApplicationMenu` then installs it as the app menu.
- modal window
- A child window that blocks its parent until it closes, like a dialog. The daily report window is one.
N
- native
- Built for the operating system itself, like Finder or File Explorer. Electron and Tauri wrap web code in a native shell.
- Native dialog
- A Save, Open or message box drawn by the system rather than by your page.
- nativeImage
- Electron's image type. `createFromPath` loads one from a file, for use as the tray icon.
- Node.js
- A runtime that runs JavaScript outside the browser, with access to files and the system. Electron bundles it for the main process; the page has no Node.
- nodeIntegration
- An Electron setting, `false` by default, that stops page scripts from calling `require`. Leave it off.
- Notarization
- Apple's malware scan of a signed Mac app. You upload the app, and Gatekeeper then trusts it.
- Notification
- The message box the OS shows in a corner of the screen, even when the app is in the background. Electron has a `Notification` class; Tauri uses a plugin.
- npm
- Node's package manager. It installs libraries and runs the scripts in `package.json`, such as `npm start`.
O
- offline
- Working with no network connection. KC Till has to save sales when the shop's Wi-Fi drops.
P
- package
- Your app as a normal program: Electron's executable with your files inside, in a folder you could copy to another computer.
- package.json
- The file that names your app, its version, start file (`main`), scripts and dependencies.
- path.join
- `path.join` glues folder and file names with the right separator for the system. `import.meta.dirname` is the folder holding the current module.
- Permission (Tauri)
- A Tauri setting that allows one command or plugin feature, such as `core:window:allow-set-title`. Capabilities group them.
- Plugin (Tauri)
- An add-on crate with a JavaScript side that provides a system feature, such as notifications or the updater. `npm run tauri add` installs one.
- Preload script
- A small script Electron runs in the renderer just before the page loads. It uses `contextBridge` to give the page a safe API like `window.till`.
- Private / public key
- A pair of keys. The private key signs each Tauri release and must be kept secret, and the public key is built into the app to check the signature.
- process
- A separate running program that can't see other processes' variables. An Electron app runs at least a main process and one renderer process per window.
- process.platform
- A Node.js value naming the operating system: `"darwin"` on macOS, `"win32"` on Windows (even 64-bit) and `"linux"` on Linux. Electron apps use it for per-system behavior.
R
- ready-to-show
- A window event that fires once the page has drawn for the first time. Creating the window with `show: false` and calling `win.show()` then avoids a blank flash.
- relaunch
- The Tauri process-plugin function that restarts the app on its new version after an update.
- release
- Each new version you publish. It is numbered with a semantic version and, for Electron updates, published as a GitHub release.
- Release build
- A slower-to-compile, smaller build made for users rather than for testing. `tauri build` makes one.
- Renderer process
- The Chromium process that runs one window's page. It can show HTML and handle clicks but has no Node.js.
- Result
- A Rust type for either success (`Ok`) or failure (`Err`). A Tauri command's `Ok` resolves the page's promise and `Err` rejects it.
- role
- A menu item property giving a built-in job with the right label and shortcut per system, such as `quit`, `copy`, `paste` and `reload`.
- Rust
- A fast, compiled language that checks your code for mistakes before it runs. Tauri's back end is written in it.
- Rust keywords (fn, let mut, use)
- `fn` starts a Rust function and `->` gives its return type; `let` makes a variable that can't change unless you write `let mut`; `use` brings names from a crate into the file.
- Rust types (u32, String, &str, Vec)
- `u32` is a whole number from 0 to about 4 billion; `String` owns its text while `&str` borrows it; `Vec<T>` is a list whose items all have one type, like a typed JavaScript array.
- rustup
- Rust's official installer and version manager. It also installs Cargo.
S
- Sandbox
- A locked-down mode limiting what a process may do. In Electron the renderer is sandboxed, and the preload can load only `electron` and a few safe modules.
- Semantic version
- A version like `1.2.0` of major.minor.patch. Raise the last for fixes, the middle for features, and the first for breaking changes.
- serde
- The Rust library that converts values to and from JSON. In Tauri it turns the page's arguments into structs and results back into JSON.
- shell.openExternal
- Opens a link in the user's own browser. Call it only for `https:` addresses, since other schemes could start a program.
- shell.showItemInFolder
- Opens File Explorer, Finder or the Linux file manager with a given file selected.
- sidecar
- A helper program bundled with a Tauri app and shipped alongside it. The app can start it to do work that the app's own code doesn't handle.
- SmartScreen
- Windows' blue "Windows protected your PC" warning for unknown, unsigned apps.
- SQLite
- A small database that stores everything in a single file and needs no separate server. It is a common choice for an app's data once a single JSON file becomes too large to manage.
- Squirrel
- The Windows install-and-update framework Electron uses. It makes the Start menu shortcut and powers `autoUpdater` on Windows and macOS.
- Struct
- A Rust type with named fields, each with a type. The till's `Line` and `Totals` are structs.
- Structured clone
- How IPC copies plain data between processes. Strings, numbers, arrays and objects work, but functions fail with "An object could not be cloned".
- system tray
- The area by the clock on Windows and Linux, or the right end of the macOS menu bar, where apps keep small icons.
- System webview
- The browser engine the operating system already has. Tauri uses WebView2 on Windows, WKWebView on macOS and WebKitGTK on Linux instead of bundling one.
T
- Tauri
- A tool that builds desktop apps from the system webview plus a Rust back end. Apps are small but you must test on each OS.
- Tauri CLI
- The command-line tool run through `npm run tauri ...`. It starts the app, builds installers, adds plugins and makes icons and keys.
- tauri.conf.json
- The Tauri file holding the app's name, identifier, windows, CSP and bundle settings.
- TAURI_SIGNING_PRIVATE_KEY
- The environment variable that points Tauri at the private key (or its contents) when building a release. It lets `tauri build` write `.sig` files.
- template (menu)
- An array of plain objects describing a menu, one per menu. `Menu.buildFromTemplate` turns it into a real menu.
- template image
- A black-and-transparent PNG whose name ends in `Template`. macOS recolors it for light and dark menu bars.
- Tray icon
- A small icon in the system tray or Mac menu bar that keeps the app reachable while its window is hidden. It can have a tooltip and a menu.
- tray-icon feature
- An optional part of a Rust crate that must be switched on in `Cargo.toml`. Tauri's tray needs the `tray-icon` feature.
U
- update server
- The server an app asks for newer versions. For Electron it can be update.electronjs.org, and for Tauri it can be any web server.
- update-electron-app
- A small package that connects Electron's `autoUpdater` to Electron's free update server for public GitHub repositories on Windows and macOS.
- updater plugin
- Tauri's plugin for updates. It works with any web server and always verifies signatures.
W
- webContents
- The page inside an Electron window. It is used to open DevTools, send messages and listen for navigation.
- webPreferences
- The `BrowserWindow` option where you name the preload script and set security options.
- will-navigate
- A `webContents` event fired before the page goes to a new address. Calling `event.preventDefault()` cancels the move.
- window-all-closed
- An app event fired when the last window closes. Windows and Linux apps quit then, while macOS apps normally keep running.
- window.__TAURI__
- The global object holding Tauri's JavaScript functions. It is available when `withGlobalTauri` is true, so a plain page needs no bundler.
X
- XSS
- Cross-site scripting: text such as a product name that gets run as code in your page. A strict CSP and `textContent` help stop it.