Latest / CyberSecurity Summary / Electron in Action
Transcript
- 0:00Speaker 1: Picture this, right, You are at a flea market in
- 0:03Speaker 1: New York City, just sort of wandering through the stalls,
- 0:06Speaker 1: and you spot this incredible piece of art.
- 0:10Speaker 2: Oh, I love a good flea market find.
- 0:12Speaker 1: Right, So it's this eighteen oh two illustration of a
- 0:15Speaker 1: woman from the Ottoman Empire, and you just you have
- 0:19Speaker 1: to have it. But there's a catch.
- 0:21Speaker 2: There's always a catch.
- 0:22Speaker 1: Always. The seller's packing up, they're actually flying back to
- 0:25Speaker 1: anchor of that very night. You don't have enough cash
- 0:28Speaker 1: on you, and of course they can't take a card.
- 0:30Speaker 1: So what do you do?
- 0:31Speaker 2: I mean normally you just walk away.
- 0:33Speaker 1: Right exactly, but not this time. You actually make a
- 0:36Speaker 1: verbal agreement, seal it with a handshake, walk away with
- 0:38Speaker 1: this priceless art under your arm, and you wire the
- 0:41Speaker 1: money internationally the very next day.
- 0:43Speaker 2: Wow. That is I mean, that is a massive leap
- 0:46Speaker 2: of faith.
- 0:47Speaker 1: It's totally wild, right, But that collision of old school
- 0:51Speaker 1: analog trust and modern execution is exactly what we are
- 0:55Speaker 1: unpacking today when it comes to software.
- 0:57Speaker 2: Yeah, and that specific anecdote, funnily enough, is actually how
- 1:00Speaker 2: the publisher acquired the physical cover art for the source
- 1:03Speaker 2: material we're pulling from today, Yes.
- 1:06Speaker 1: Which is this incredibly comprehensive engineering guide called Electron in
- 1:10Speaker 1: Action by Steve Kenney. It was published by Manning.
- 1:13Speaker 2: It's such a great book because we're basically looking at
- 1:16Speaker 2: a technology that takes something incredibly established, you know, traditional
- 1:21Speaker 2: native desktop applications.
- 1:23Speaker 1: Old school stuff, right.
- 1:24Speaker 2: And it completely rewires them using modern web technologies. And
- 1:28Speaker 2: I mean, if you are listening to this deep dive
- 1:30Speaker 2: right now, the odds are almost one hundred percent that
- 1:33Speaker 2: you are already relying on this architect Oh.
- 1:35Speaker 1: Absolutely, it's it's everywhere. Like if you use SLAG for
- 1:38Speaker 1: work messaging, or maybe visual Studio code for programming, or
- 1:42Speaker 1: even just the Brave browser for surfing the web, you
- 1:44Speaker 1: are using Electron.
- 1:46Speaker 2: Yeah. It is entirely hiding in planesight, it really is.
- 1:49Speaker 1: And it represents this this fundamental shift in how we
- 1:52Speaker 1: build for the desktop because for decades, you know, if
- 1:55Speaker 1: you wanted to build a native desktop application, you were
- 1:58Speaker 1: staring down this mass have totally fragmented engineering undertaking.
- 2:02Speaker 2: Oh it was a nightmare. You couldn't just write one app.
- 2:05Speaker 2: You had to learn entirely different programming languages and frameworks
- 2:09Speaker 2: for every single operating system.
- 2:12Speaker 1: Right, You'd need like C plus plus or maybe C
- 2:14Speaker 1: sharp to target Windows machines, and then you'd have to
- 2:18Speaker 1: completely pivot to objective C or Swift if you wanted
- 2:21Speaker 1: to be on macOS, and.
- 2:22Speaker 2: Then you might need a completely different toolkit like QT
- 2:26Speaker 2: for Linux.
- 2:26Speaker 1: Exactly, you're essentially funding and building the exact same application
- 2:30Speaker 1: three separate times, which is I mean, it's an absolute
- 2:33Speaker 1: nightmare for a solo developer or a startup.
- 2:35Speaker 2: It's cost prohibitive. But Electron it bypasses that fragmentation entirely.
- 2:41Speaker 2: It takes the holy trinity of web development. Right, So,
- 2:43Speaker 2: HTMLCSS and JavaScript.
- 2:45Speaker 1: This stuff everyone already knows exactly.
- 2:47Speaker 2: And it allows engineers to use those exact same tools
- 2:50Speaker 2: to build cross platform desktop applications from a single unified codebase.
- 2:55Speaker 2: You write it once and it compiles to a native
- 2:57Speaker 2: application for Mac Windows and Linux.
- 3:00Speaker 1: Which is basically magic. And the sources outline this really
- 3:04Speaker 1: helpful way to conceptualize this architectural shift. I kind of
- 3:08Speaker 1: want to try tweaking an analogy here.
- 3:09Speaker 2: If that's cool, Yeah, go for it.
- 3:11Speaker 1: So, if you think about traditional web development, it relies
- 3:14Speaker 1: entirely on a client server model, right. The user's browser
- 3:18Speaker 1: is really just a lightweight storefront all the heavy lifting,
- 3:21Speaker 1: the database, the file processing, all that business logic. It
- 3:25Speaker 1: happens on a distant server, right.
- 3:26Speaker 2: So the server is basically the kitchen, and the browser
- 3:29Speaker 2: is just the dining room exactly.
- 3:30Speaker 1: The browser is just where you eat. But if you
- 3:33Speaker 1: lose your Internet connection, the road from the dining room
- 3:36Speaker 1: to the kitchen is severed and the whole application just
- 3:39Speaker 1: it breaks. You get the dinosaur game, right, But an
- 3:42Speaker 1: Electron app fundamentally changes that architecture. Yeah, it is. It's
- 3:48Speaker 1: more like a high end food truck pulling right up
- 3:50Speaker 1: in your computer's driveway.
- 3:51Speaker 2: Oh I like that.
- 3:52Speaker 1: Yeah. It bundles the entire kitchen, like the whole back
- 3:55Speaker 1: end processing run time, and installs it directly on your
- 3:58Speaker 1: local hard drive right alongside the user interface. Everything required
- 4:01Speaker 1: to run the application is just totally self contained.
- 4:04Speaker 2: And you know, bundling that back end infrastructure locally that
- 4:08Speaker 2: alters the entire security paradigm, which is honestly why Electron
- 4:13Speaker 2: is so powerful. So well, think about when you visit
- 4:16Speaker 2: a website in a traditional browser. That browser actively sandboxes
- 4:21Speaker 2: the web application. It acts as this strict security perimeter.
- 4:25Speaker 1: Right because it doesn't trust the code.
- 4:26Speaker 2: Exactly, It assumes the code it just downloaded from a
- 4:29Speaker 2: random server is potentially hostile, so that browser explicitly blocks
- 4:34Speaker 2: the web app from reading your local file system, or
- 4:37Speaker 2: modifying your operating system menus, or running background processes.
- 4:40Speaker 1: But because an electron app is downloaded and explicitly installed
- 4:43Speaker 1: by the user, it completely bypasses that web sandbo That is.
- 4:47Speaker 2: The key mechanism. Yeah, by running an installer, the user
- 4:50Speaker 2: actively grants the application elevated native privileges. Yeah, the operating
- 4:55Speaker 2: system basically treats the exact same way it treats a
- 4:57Speaker 2: native C plus plus application. So the web code inside
- 5:01Speaker 2: the electron shell is suddenly allowed to read and write
- 5:04Speaker 2: local files, interact with USB devices, and function perfectly without
- 5:09Speaker 2: a network connection.
- 5:10Speaker 1: That is wild, and the text highlights some really crazy
- 5:14Speaker 1: real world examples of teams leveraging this, like Facebook built
- 5:19Speaker 1: an entire development environment called new clide with it, and
- 5:22Speaker 1: a company called Nihilis built this really heavy duty email client.
- 5:26Speaker 1: But the most striking example of that offline capability comes
- 5:29Speaker 1: from an agency called Wiredcraft.
- 5:31Speaker 2: Oh, the Me and Mar project.
- 5:33Speaker 1: Yeah, they needed to build an application to collect voter
- 5:36Speaker 1: registration data all across me and Mar.
- 5:38Speaker 2: Which is a region where relying on continuous Internet connectivity,
- 5:42Speaker 2: which is entirely unfeasible.
- 5:43Speaker 1: Yes, a traditional web app would be completely useless the
- 5:47Speaker 1: moment the connection dropped. But by using Electron, Wiredcraft was
- 5:50Speaker 1: able to use standard web developers to build a robust
- 5:53Speaker 1: Windows application.
- 5:54Speaker 2: And it stored all that data locally right exactly.
- 5:57Speaker 1: Its stored all the voter data locally on the machine's
- 5:59Speaker 1: hard and then it would automatically sync with the central
- 6:02Speaker 1: server whenever a network connection finally became available.
- 6:05Speaker 2: That's brilliant.
- 6:06Speaker 1: They achieved native offline stability and they didn't even need
- 6:10Speaker 1: to hire a specialized team of plus Windows engineers to
- 6:13Speaker 1: do it.
- 6:14Speaker 2: Now, it is definitely worth mentioning that Electron wasn't actually
- 6:18Speaker 2: the first framework to attempt this hybrid approach.
- 6:20Speaker 1: Oh right, there was an older one.
- 6:22Speaker 2: Yeah, it had a predecessor called NWJS, which some older
- 6:26Speaker 2: developers might remember as Node WebKit, but Electron eventually overtook
- 6:30Speaker 2: it as the absolute industry standard, mostly due to a
- 6:34Speaker 2: few critical architectural choices.
- 6:36Speaker 1: So what specifically made the industry pivot to Electron over
- 6:41Speaker 1: NWJS Again? Why did NWJS lose out?
- 6:44Speaker 2: The primary difference really lies in how they handled the
- 6:47Speaker 2: underlying browser engine. NWJS used a heavily customized, forked version
- 6:51Speaker 2: of the Chromium engine.
- 6:53Speaker 1: Okay, and four king is generally a headache, Yeah.
- 6:55Speaker 2: A massive headache. It meant every single time Google released
- 6:59Speaker 2: a new version of Chromium, the NWGS team had to
- 7:02Speaker 2: manually port all of their custom modifications over to the
- 7:05Speaker 2: new version. It just caused massive.
- 7:08Speaker 1: Delays, so they were always lagging behind.
- 7:10Speaker 2: Always. Electron conversely, relies on an completely unmodified standard release
- 7:16Speaker 2: of Chromium. Because they don't fork the engine, Electron can
- 7:20Speaker 2: rapidly update to the latest browser standards, sometimes within days
- 7:24Speaker 2: of a new release.
- 7:25Speaker 1: So developers always have access to the absolute bleeding edge
- 7:28Speaker 1: JavaScript futures.
- 7:29Speaker 2: Precisely, and beyond that, NWGS shared a single back end
- 7:33Speaker 2: process across every single window of the application, so if
- 7:36Speaker 2: one window crash, the whole thing goes down, the entire
- 7:38Speaker 2: application came down. But Electron enforces a strict separation of processes,
- 7:42Speaker 2: which creates a much more stable, resilient architecture. You add
- 7:46Speaker 2: in built in crash reporting and automated background updating, and
- 7:49Speaker 2: well it becomes pretty obvious why enterprise teams adopted it
- 7:53Speaker 2: so quickly.
- 7:54Speaker 1: Okay, so you just mentioned Chromium, which perfectly sets up
- 7:56Speaker 1: our next step here. To really understand how this local
- 7:59Speaker 1: food truck operates, we need to lift the hood.
- 8:02Speaker 2: Let's do it.
- 8:02Speaker 1: Electron achieves this by taking two massive, fundamentally different engineering
- 8:07Speaker 1: engines and just sort of bridging them together, the Chromium
- 8:11Speaker 1: content module and no JS.
- 8:15Speaker 2: It is an incredibly ambitious fusion. The Chromium content module
- 8:19Speaker 2: is responsible for parsing your HTML and CSS and actually
- 8:22Speaker 2: rendering it into a visual interface.
- 8:24Speaker 1: Right, and my understanding for the text is that the
- 8:26Speaker 1: content modules essentially the core rendering engine of Google Chrome, right,
- 8:30Speaker 1: like the blank rendering pipeline and the v eight JavaScript engine,
- 8:34Speaker 1: but without any of the actual Chrome browser wrapped around it.
- 8:37Speaker 2: That is a crucial distinction. It's basically the engine of
- 8:39Speaker 2: the car minus the leather seats in the stereo. You
- 8:42Speaker 2: get the world class rendering capabilities. But Electron completely strips
- 8:46Speaker 2: out all the consumer blow So no extensions, right. There
- 8:49Speaker 2: are no chromostensions, no bookmark syncting, no built in password managers,
- 8:53Speaker 2: and no PDF fewers. It is just the raw engine
- 8:57Speaker 2: required to turn code into pixels.
- 8:59Speaker 1: But I do have a question about that, because even
- 9:02Speaker 1: stripped down bundling an entire Chromium rendering engine inside every
- 9:06Speaker 1: single desktop app. That seems like a massive resource overhead.
- 9:10Speaker 2: It's definitely heavy.
- 9:11Speaker 1: Yeah, So why wouldn't Electron just use whatever default browser
- 9:15Speaker 1: the user already has installed on their machine to render
- 9:18Speaker 1: the interface? Like, why not just use their local Safari
- 9:21Speaker 1: your edge.
- 9:22Speaker 2: That's a great question, and it really comes down to
- 9:24Speaker 2: the concept of determinism.
- 9:26Speaker 1: Okay, determinist Right in.
- 9:28Speaker 2: Traditional web development, you build a site and you kind
- 9:30Speaker 2: of just cross your fingers hoping it looks the same
- 9:33Speaker 2: on a user's totally outdated version of Safari as it
- 9:36Speaker 2: does on like a brand new version of Firefox.
- 9:39Speaker 1: Oh, the cross browser compatibility nightmare.
- 9:41Speaker 2: Exactly, it's awful. But by bundling a specific, hard coded
- 9:45Speaker 2: version of Chromium directly inside the application, the developer guarantees
- 9:49Speaker 2: a perfectly deterministic environment. They know exactly which CSS features
- 9:54Speaker 2: are supported, they know exactly how the rendering pipeline behaves.
- 9:58Speaker 2: It completely eliminates the nightmare of cross browser compatibility testing.
- 10:02Speaker 1: Oh, that makes a lot of sense. You just bypass
- 10:04Speaker 1: the guesswork entirely. So you pair that highly predictable visual
- 10:07Speaker 1: engine with no JS, which is traditionally a server side
- 10:10Speaker 1: JavaScript run time. Yes, and Node is the piece that
- 10:13Speaker 1: provides the low level system access. So you have the
- 10:16Speaker 1: beautiful UI of Chromium essentially holding hands with the raw
- 10:20Speaker 1: filesystem power of Node.
- 10:22Speaker 2: And to keep those two engines from just stepping all
- 10:24Speaker 2: over each other's toes, Electron mandates a very strict process architecture.
- 10:29Speaker 2: In every Electron application, there is exactly one main process,
- 10:33Speaker 2: just one, just one, and this process runs purely in
- 10:37Speaker 2: no JS. It remains entirely invisible to the user. Its
- 10:40Speaker 2: sole job is to manage the application life cycle, handle
- 10:43Speaker 2: operating system integration, and sort of orchestrate things like native
- 10:46Speaker 2: application menus and system tree icons.
- 10:49Speaker 1: So the main process is basically the puppet.
- 10:50Speaker 2: Master, yes, exactly, and that single main process can then
- 10:54Speaker 2: spawn zero or more render processes. These are created using
- 10:57Speaker 2: an Electron module called browser window. Okay, and each renderer
- 11:01Speaker 2: process is an isolated instance of Chromium that displays an
- 11:04Speaker 2: actual window on the user's screen.
- 11:06Speaker 1: Okay, let's unpack this for a second, because I want
- 11:08Speaker 1: to push back on something that sources detail about these
- 11:10Speaker 1: renderer processes.
- 11:12Speaker 2: Sure.
- 11:12Speaker 1: The text notes that inside these UI windows, developers can
- 11:17Speaker 1: use the modern fetch API to ping third party servers directly, right,
- 11:22Speaker 1: they can scrape data from remote websites without routing the
- 11:25Speaker 1: requests through their own proxy server.
- 11:27Speaker 2: They absolutely can.
- 11:28Speaker 1: Well wait, doesn't that fundamentally bypass cross origin resource sharing
- 11:32Speaker 1: or cores, I mean, preventing a webscript from silently pinging
- 11:37Speaker 1: unverified external servers is like the foundational security policy of
- 11:42Speaker 1: the modern web. If Electron just turns off cores and
- 11:45Speaker 1: lets client side JavaScript do whatever it wants, isn't that
- 11:48Speaker 1: a massive vulnerability?
- 11:49Speaker 2: What's fascinating here is that it sounds alarming if you
- 11:52Speaker 2: view it through the lens of a web browser, but
- 11:53Speaker 2: you really have to shift your context to the desktop.
- 11:56Speaker 2: This goes entirely back to user.
- 11:58Speaker 1: Agency user agency. Right.
- 12:00Speaker 2: Visiting a URL is a passive action. You click a
- 12:02Speaker 2: link on a random forum and code starts executing on
- 12:04Speaker 2: your machine instantly. The web browser has to assume that
- 12:07Speaker 2: code is hostile, so it enforces cores to prevent data.
- 12:10Speaker 1: Theft because you didn't ask it to do anything other
- 12:12Speaker 1: than load.
- 12:13Speaker 2: A page exactly. But installing a desktop application is an active,
- 12:18Speaker 2: deliberate choice.
- 12:19Speaker 1: Ah, So by installing it, you are basically signing a
- 12:22Speaker 1: contract of trust.
- 12:23Speaker 2: Precisely, you are granting that software native authority. If a
- 12:28Speaker 2: developer writes a malicious native C plus plus application designed
- 12:33Speaker 2: to secretly ping a remote server, the operating system allows it.
- 12:37Speaker 2: Electron simply gives web developers that identical native capability.
- 12:41Speaker 1: So it's not a bug, it's a feature.
- 12:43Speaker 2: Right. The application is no longer operating in the public
- 12:46Speaker 2: sandbox of the Internet. It is an installed piece of software.
- 12:49Speaker 2: It basically removes the training wheels and hands the developer
- 12:52Speaker 2: the keys to the engine.
- 12:54Speaker 1: Okay, we are officially out of the sandbox, so let's
- 12:57Speaker 1: look at how this architectural shift radically simplifies building an
- 13:01Speaker 1: actual application. The text walks through constructing this starter project
- 13:05Speaker 1: called Bookmarker.
- 13:06Speaker 2: Oh, the bookmarker app. Yeah, that's a great example.
- 13:08Speaker 1: Yeah. The premise is pretty straightforward. The user pastes a
- 13:11Speaker 1: URL into a text field, the application fetches the title
- 13:14Speaker 1: of that remote web page, and it just says it
- 13:17Speaker 1: to a list.
- 13:17Speaker 2: And this project perfectly highlights the advantage of that deterministic
- 13:21Speaker 2: Chromium engine we discussed earlier. Because the developer knows exactly
- 13:25Speaker 2: which version of V eight is running, they don't need
- 13:27Speaker 2: to write any legacy fallback code for Internet.
- 13:31Speaker 1: Explorer eleven Oh, thank goodness.
- 13:33Speaker 2: Right, they can rely heavily on modern JavaScript standards.
- 13:36Speaker 1: Right. So the application takes the URL, uses the fetch
- 13:40Speaker 1: API to ping the target server directly from the client side,
- 13:43Speaker 1: and downloads the raw HTML string of the remote site. Now, normally,
- 13:48Speaker 1: if you have a massive string of raw eachtmail, you
- 13:51Speaker 1: need a pretty hefty third party library to parse through
- 13:53Speaker 1: it and find the specific data you want. Right.
- 13:55Speaker 2: You definitely would if you were operating purely in a
- 13:57Speaker 2: node back end. But because this code is actually running
- 14:01Speaker 2: inside a Chromium renderer process, the developer has access to
- 14:04Speaker 2: native browser APIs, so they can simply hand that raw
- 14:08Speaker 2: HTML string directly to the built in DOM parser object.
- 14:11Speaker 2: It instantly converts the text into a fully traversible object tree,
- 14:15Speaker 2: allowing them to extract the title tag with a single line,
- 14:18Speaker 2: a standard DOM manipulation.
- 14:20Speaker 1: That is incredibly elegant. And then to make sure the
- 14:24Speaker 1: data actually survives when the user quits the application or
- 14:27Speaker 1: reboots their computer, Bookmarker simply saves the list of links
- 14:32Speaker 1: using the browser's standard local storage API. No complex SQL
- 14:36Speaker 1: database required at all, None at all. But I love
- 14:39Speaker 1: this part of the text points out a really funny
- 14:42Speaker 1: practical trap that developers always fall into when they are
- 14:45Speaker 1: building their first Electron app.
- 14:46Speaker 2: Yes, the unintended navigation trap. It gets everyone, it's so funny.
- 14:50Speaker 1: So what does this all mean? When the user actually
- 14:53Speaker 1: clicks the saved link inside our app? Like the app
- 14:56Speaker 1: is working perfectly, the user has a beautiful list of
- 14:59Speaker 1: save links. What happens when they click one?
- 15:01Speaker 2: Well, because the renderer process is fundamentally just a Chromium browser,
- 15:05Speaker 2: it reacts exactly how a browser is programmed to react.
- 15:08Speaker 2: When a hyperlink is clicked, it immediately navigates the current
- 15:11Speaker 2: window to that new URL.
- 15:13Speaker 1: Which sounds totally fine until you realize, Yeah, our custom
- 15:16Speaker 1: Electron app doesn't have a back button, it doesn't have
- 15:18Speaker 1: an address bar. So the user clicks their saved article,
- 15:22Speaker 1: the UI just disappears, the web page loads, and they
- 15:26Speaker 1: are completely trapped inside that site. The only way out
- 15:30Speaker 1: is to actually force quit the entire application and relaunch it.
- 15:33Speaker 2: It is a perfect example of the mindset shift required
- 15:37Speaker 2: for Electron. You have to constantly remember you aren't building
- 15:40Speaker 2: a website, You're building native software that just happens to
- 15:44Speaker 2: use web rendering, So how do you fix it? To
- 15:46Speaker 2: fix this, developers utilize an Electron module called shell, and.
- 15:51Speaker 1: The logic here is brilliant. Instead of letting the click
- 15:54Speaker 1: execute normally, the developer writes an event listener to intercept
- 15:58Speaker 1: the click. They grab the URL, prevent the default navigation,
- 16:02Speaker 1: and then pass the URL to a command called shell
- 16:04Speaker 1: dot open external Yeah.
- 16:06Speaker 2: That command takes the request and basically bridges the gap
- 16:08Speaker 2: between the web app and the operating system. It asks
- 16:11Speaker 2: thes hey, what is the user's globally preferred application for
- 16:15Speaker 2: handling weblinks?
- 16:16Speaker 1: So it's asking the computer, not the app exactly.
- 16:20Speaker 2: The operating system then intercepts the intent and launches the
- 16:22Speaker 2: link in the user's actual external browser, whether that is Safari,
- 16:26Speaker 2: Edge or Firefox.
- 16:27Speaker 1: It hands the URL back to the native ecosystem. That's
- 16:32Speaker 1: so smart now. Bookmarker proves you can bypass network restrictions
- 16:36Speaker 1: and handle data natively. But a floating box of text
- 16:41Speaker 1: doesn't really feel like true desktop software.
- 16:44Speaker 2: No, it still feels a bit like a widget.
- 16:46Speaker 1: Right. To truly replace traditional applications, the UI needs to
- 16:49Speaker 1: seamlessly mimic the host operating system, and that leads us
- 16:53Speaker 1: to the next, much more sophisticated project in the source text,
- 16:56Speaker 1: which is a markdown text editor called firesaleire Cell.
- 17:00Speaker 2: Is an excellent case study in UI integration. It features
- 17:02Speaker 2: this dual pain interface. The user type's raw markdown formatting
- 17:06Speaker 2: on the left PAIN, and the application instantly renders it
- 17:09Speaker 2: as formatted HTML on the right PAIN using a library
- 17:12Speaker 2: called marked.
- 17:13Speaker 1: Structurally balancing those two columns is pretty trivial because the
- 17:16Speaker 1: developer can just use modern CSS flexbox without I'm constantly
- 17:20Speaker 1: worrying about browser support.
- 17:21Speaker 2: Yeah, the determinism strikes again exactly.
- 17:24Speaker 1: But where the source material gets truly fascinating is the
- 17:26Speaker 1: specific CSS techniques used to actively disguise the fact that
- 17:30Speaker 1: the interface is built with HTML.
- 17:31Speaker 2: Well, the typography integration is a total standout technique.
- 17:34Speaker 1: It really is. Yeah, because if you just define a
- 17:36Speaker 1: standard web font stack like Aerial or Helvetica, the application
- 17:41Speaker 1: will always look slightly foreign on a modern operating system,
- 17:45Speaker 1: it won't match the surrounding system menus. So instead the
- 17:49Speaker 1: developer applies a specific CSS declaration dot font menu.
- 17:53Speaker 2: And what makes that so powerful is that it isn't
- 17:56Speaker 2: just a static fun assignment. It's actually a dynamic queer.
- 18:00Speaker 1: Really.
- 18:00Speaker 2: Yeah. When Chromium reads font dot menu, it reaches out
- 18:04Speaker 2: to the underlying operating system's UI layer and asks what
- 18:07Speaker 2: is the currently active system font? So on macOS, it
- 18:11Speaker 2: instantly inherits Apple's San Francisco font. On Windows, it pulls
- 18:15Speaker 2: Cego UI.
- 18:16Speaker 1: That's amazing, it is.
- 18:17Speaker 2: The text rendering completely bridges the gap between web CSS
- 18:20Speaker 2: and the native C plus plus rendering of the OS.
- 18:23Speaker 1: The developer also tackles focus outlines in this project, which
- 18:26Speaker 1: is another huge tell. In a normal web browser, when
- 18:29Speaker 1: you click into an input field, usually get this glowing
- 18:31Speaker 1: blue ring around the box to show that it's active.
- 18:33Speaker 2: Right, which is vital for web accessibility. But native desktop
- 18:37Speaker 2: text editors don't really do that.
- 18:39Speaker 1: No, they don't. So by explicitly overriding that default web
- 18:43Speaker 1: behavior in the CSS, the application stops looking like a
- 18:46Speaker 1: web form and really starts feeling like a standalone tool.
- 18:49Speaker 2: But the most crucial polished technique discussed in the text
- 18:52Speaker 2: addresses a deeply ingrained psychological cueue, which is the white flash.
- 18:57Speaker 1: Oh yes, this solves something that has annoyed me for years.
- 19:01Speaker 1: Whenever you launch a heavy web wrapped desktop application, you
- 19:06Speaker 1: often get this jarring, blinding white screen for a fraction
- 19:12Speaker 1: of a second before the dom actually loads and paints
- 19:14Speaker 1: the interface.
- 19:15Speaker 2: It completely shatters the illusion, right it really does.
- 19:17Speaker 1: It screams, hey, I am a slow website trying to load.
- 19:20Speaker 2: It is an absolute dead giveaway of the underlying technology,
- 19:23Speaker 2: but the solution provided by electrons life cycle events is
- 19:26Speaker 2: incredibly elegant. When the main process executes the node code
- 19:30Speaker 2: to construct the browser window, the developer simply passes a
- 19:33Speaker 2: configuration property dot show false, so.
- 19:35Speaker 1: The chromium window is actually spawned in the system memory,
- 19:39Speaker 1: but it remains completely invisible to the user.
- 19:41Speaker 2: Correct the application is given the time it needs to
- 19:44Speaker 2: parse the HTML, execute the CSS, and fully render the
- 19:48Speaker 2: dawn tree entirely in the background. Meanwhile, the developer sets
- 19:51Speaker 2: up a listener for a specific life cycle event called
- 19:54Speaker 2: or ready to show, and then the instant the rendering
- 19:57Speaker 2: pipeline is complete and the pixels are ready, that event
- 20:00Speaker 2: fires and only then does the code called the show
- 20:03Speaker 2: method wow.
- 20:04Speaker 1: So the user double clicks the app icon in their dock,
- 20:07Speaker 1: and just a fraction of a second later, the fully formed,
- 20:10Speaker 1: perfectly rendered application simply materializes on the screen exactly. There's
- 20:15Speaker 1: no loading state, there's no white flash. It's a tiny
- 20:18Speaker 1: architectural detail, but psychologically it makes the software feel incredibly premium.
- 20:22Speaker 2: And responsive, and Firesale pushes that native integration even further
- 20:27Speaker 2: by bridging the gap to the operating system's native dialogue.
- 20:30Speaker 1: Like the filepicker window.
- 20:32Speaker 2: Yes, when you try to upload a file on a
- 20:34Speaker 2: standard website, the browser provides a very generic, restricted filepicker
- 20:38Speaker 2: it feels disjointed. But in Electron, the node based main
- 20:41Speaker 2: process can actually access the dialogue module, specifically the show
- 20:45Speaker 2: open dialogue.
- 20:46Speaker 1: Method, And because the main process has native OS privileges,
- 20:51Speaker 1: this method actually triggers the literal native C plus plus
- 20:56Speaker 1: file explorer window built into Windows or the mac os
- 21:00Speaker 1: exactly the exact same window that like Microsoft Word or
- 21:04Speaker 1: Adobe Photoshop uses. You can program it to only accept
- 21:07Speaker 1: text files or allow multi selection, and the user has
- 21:10Speaker 1: absolutely no idea they are interacting with the web application.
- 21:13Speaker 2: It is seamless.
- 21:15Speaker 1: Of course, all of this seamless integration sounds fantastic until
- 21:18Speaker 1: something breaks. So let's talk about the friction of actually
- 21:21Speaker 1: building this architecture. Yeah, because when you are smashing a
- 21:24Speaker 1: no JS server and a Chromium browser together into a
- 21:27Speaker 1: single concurrent application, how do you even begin to debug
- 21:31Speaker 1: it when the logic fails?
- 21:32Speaker 2: Oh? It has historically been one of the biggest headaches
- 21:35Speaker 2: of electron development. I can imagine because you have two
- 21:38Speaker 2: fundamentally different run times operating simultaneously and they are separated
- 21:42Speaker 2: by an interprocess communication bridge, so you have to adopt
- 21:45Speaker 2: a dual debugging strategy.
- 21:46Speaker 1: Let's break that down. Start with the front end, like
- 21:48Speaker 1: the UI running in the renderer process.
- 21:50Speaker 2: Well, the renderer process is straightforward because it's literally just
- 21:54Speaker 2: an unforked instance of Chromium debugging. It is identical to
- 21:59Speaker 2: debugging a website. You don't need specialized tools. You just
- 22:02Speaker 2: use what you know, right, You simply press the exact
- 22:05Speaker 2: same keyboard shortcut like command option ionomac and the familiar
- 22:09Speaker 2: Chrome developer tools slide open right inside your application. You
- 22:13Speaker 2: have full access to your console, the network tab, the
- 22:16Speaker 2: element inspector, it's all there.
- 22:19Speaker 1: That's familiar territory for any web developer. But what about
- 22:22Speaker 1: the main process, the node logic that handles the filesystem
- 22:26Speaker 1: and the native OS integration. Because you can't exactly inspect
- 22:30Speaker 1: system level node execution with browser dev tools, and that.
- 22:34Speaker 2: Is exactly where the architecture used to cause immense frustration historically,
- 22:38Speaker 2: using tools like node Inspector to trace execution across that
- 22:41Speaker 2: IPC bridge was frankly incredibly unreliable. The connection would just
- 22:45Speaker 2: drop or break points would drift.
- 22:47Speaker 1: That sounds infuriating, it was, so what is the modern
- 22:50Speaker 1: solution the text actually recommends.
- 22:52Speaker 2: The real breakthrough is leveraging an ID like visual Studio code,
- 22:56Speaker 2: which ironically is itself an Electron application. Creating a specific
- 23:01Speaker 2: configuration file called launch dot Jason within your project, you
- 23:04Speaker 2: can instruct vs code to attach its built in debugger
- 23:08Speaker 2: directly to the dedicated no debugging port of the Electron
- 23:11Speaker 2: main process.
- 23:12Speaker 1: Meaning you aren't flying blind anymore. You can actually set
- 23:15Speaker 1: brake points directly in your code editor.
- 23:18Speaker 2: Yes, you literally click the margin in your JavaScript or
- 23:21Speaker 2: tech script file to set a breakpoint. Start the application,
- 23:25Speaker 2: and the execution of the underlying VIGHT engine will physically
- 23:28Speaker 2: halt the moment it hits that line.
- 23:30Speaker 1: It is so cool.
- 23:31Speaker 2: You can step line by line through the native OS
- 23:33Speaker 2: level code, inspect variables in memory, and watch exactly how
- 23:37Speaker 2: your main process is interacting with the filesystem. It transforms
- 23:41Speaker 2: what used to be a chaotic dual environment nightmare into
- 23:44Speaker 2: a highly controlled, manageable workflow.
- 23:46Speaker 1: It is genuinely amazing how the tooling ecosystem has evolved
- 23:50Speaker 1: to support this hybrid architecture, So zooming out, let's kind
- 23:53Speaker 1: of synthesize what this all means.
- 23:55Speaker 2: Let's do it.
- 23:55Speaker 1: Electron represents a massive paradigm shift in how software is
- 23:59Speaker 1: created by creatively recycling the web technologies that millions of
- 24:04Speaker 1: developers already know, HTML, CSS, JavaScript, It completely democratizes native development.
- 24:11Speaker 2: It really does.
- 24:12Speaker 1: Individuals and small teams can now build these powerful cross
- 24:16Speaker 1: platform tools with direct filesystem access and offline capabilities, software
- 24:22Speaker 1: that historically required massive specialized engineering departments to pull off.
- 24:26Speaker 2: It takes the ubiquity of web skills and applies them
- 24:28Speaker 2: directly to the power of the desktop.
- 24:30Speaker 1: It absolutely does. But unpacking all of this raises a
- 24:33Speaker 1: genuinely profound question, based on the implications of Steve Kinney's text,
- 24:38Speaker 1: Think about the logical conclusion of this architecture. If tools
- 24:41Speaker 1: like Electron allow developers to recreate incredibly complex, high performance
- 24:45Speaker 1: desktop amosystems using nothing but pure web technologies, what happens
- 24:50Speaker 1: to the whole concept of the operating system in the future.
- 24:52Speaker 2: Oh, that is a fascinating thought experiment.
- 24:55Speaker 1: Right If every major application we rely on daily our
- 25:00Speaker 1: communication tools like Slack, our code, editors like bs code,
- 25:03Speaker 1: our music players like Spotify. If they're all ultimately just
- 25:07Speaker 1: highly privileged web browsers wearing clever disguises, does the underlying
- 25:12Speaker 1: operating system eventually become totally irrelevant? It makes you wonder,
- 25:16Speaker 1: because Windows or macOS eventually just become a glorified, invisible
- 25:19Speaker 1: bootloader whose only real purpose is to launch web applications.
- 25:23Speaker 2: If the canvas doesn't matter anymore, only the paint does.
- 25:26Speaker 1: Yes, yes, exactly, just like that handshake deal at the
- 25:29Speaker 1: New York flea market. The old world structure of the
- 25:31Speaker 1: native desktop operating system is simply providing a sturdy, antique
- 25:35Speaker 1: frame to display the vibrant modern art of the web.
- 25:38Speaker 2: A perfect way to frame the evolution.
- 25:40Speaker 1: Thank you for taking this deep dive with us. Keep
- 25:42Speaker 1: questioning the architecture the tools you use every day, and
- 25:45Speaker 1: keep exploring until next time.