Fireship · @fireship
Tauri in 100 Seconds
Uploaded May 6, 2022 · Length 2:40
Summary
towri toolkit for building native desktop apps with web tech and rust backend
- towri
- native desktop apps
- rust backend
- javascript framework
- cross-platform apps
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
towri a toolkit for building native
- 0:02
desktop apps with rented web
- 0:04
technologies and a lightweight rust back
- 0:06
end it allows you to use your favorite
- 0:08
javascript framework to design a ui then
- 0:10
package it for mac os windows and linux
- 0:12
from a single code base since the dawn
- 0:14
of time javascript developers have been
- 0:16
searching for the perfect way to build
- 0:18
cross-platform apps for the last decade
- 0:20
electron has been the leader in this
- 0:21
space which provides a back-end in
- 0:23
node.js and a front-end with the
- 0:24
chromium browser the main criticism of
- 0:26
this approach is that it results in a
- 0:28
very large executable file that consumes
- 0:30
a lot of memory on the machine towri
- 0:32
takes a different approach by replacing
- 0:34
node.js with rust and chromium with
- 0:36
libraries like tau and rye to provide a
- 0:38
lightweight webview the end result is a
- 0:40
smaller bundle size and more efficient
- 0:42
memory consumption it also takes
- 0:44
security very seriously and provides an
- 0:46
isolation pattern to prevent untrusted
- 0:48
scripts from accessing the backend from
- 0:50
a webview the towery api provides a
- 0:52
secure way to access native
- 0:54
functionality like the file system http
- 0:57
and system notifications it's secure by
- 0:59
default and the only way for the front
- 1:01
end to call back and code is when the
- 1:02
developer explicitly allows it to get
- 1:04
started install rust nodejs then create
- 1:07
a new towry app choose your favorite
- 1:09
javascript framework to build the front
- 1:11
end it looks identical to a web project
- 1:13
except for the source towry directory
- 1:15
this is the back end for your native
- 1:17
desktop app inside of which you'll find
- 1:19
icons that will be displayed when the
- 1:20
app is installed the icons are
- 1:22
referenced in the tower config file
- 1:24
which also contains important
- 1:25
information like the bundle identifier
- 1:27
as well as build settings for mac os
- 1:30
windows and linux now the entry point
- 1:31
for your back end is in the main.rs file
- 1:34
from here we can customize the
- 1:35
experience on the native operating
- 1:37
system by importing the menu types we
- 1:39
can create a custom native menu that
- 1:41
will work seamlessly on all platforms in
- 1:44
addition we can define code and rust
- 1:46
that can then be invoked from the
- 1:47
javascript front end and it has its own
- 1:49
custom event system that allows complex
- 1:51
message passing from the front end to
- 1:53
the back end and vice versa now in the
- 1:55
front end code a variety of native apis
- 1:57
can be accessed with javascript for
- 1:59
example we might import right file from


