Wails: Golang's Bet On Desktop Grade Apps To Beat Electron

BBetter Stack
Computing/SoftwareInternet Technology

Transcript

00:00:00Wales is a cross-platform technology that lets you build desktop-grade apps in Go.
00:00:04This has been requested a ton of times on the channel after doing a bunch of desktop comparison
00:00:08videos. So today I'm going to take you through using Wales to build desktop-grade apps
00:00:13and compare it to using frameworks like Electron and Tori. We're going to go through the build of
00:00:17a desktop video recorder which we've done in other videos and compare things like file size,
00:00:22performance and developer experience. And Wales is actually completely new to me so we're going
00:00:27to be learning together on this one. So Wales works very much in the same way as Tori but the
00:00:36backend is in Go rather than Rust. You still build a front-end in a web view using web technologies
00:00:41then called native APIs which are managed by Golang. This means you can compile an application that's
00:00:47compatible with both Mac and Windows. But unlike Electron, Wales does not embed a browser. Instead
00:00:52it reuses the native rendering engine for each platform much like Tori does. So the bundle size
00:00:58technically should be a lot smaller but we're going to see that later on when we do the comparison.
00:01:03And if you enjoy content like this guys then subscribe for more. So this is the screen recording
00:01:07tool that I've developed with Wales and I've also done the same thing in Electron and Tori. We'll
00:01:12select the screen that we want to record. Press record. You can move the mouse around. The actual
00:01:16desktop app won't appear in the record itself. I'll press stop. Then you can see the screen I've just
00:01:21recorded. I could cut this up if I wanted to and then just click export to MP4 to just save the video
00:01:27directly to my machine. So if we look inside the build for this you'll see that it's a very similar
00:01:32setup to what you would expect on Electron. We have all the front-end files in a front-end folder
00:01:36and then we have the entry file. And in this case it's a Go file called main.go and inside here
00:01:41we've got a main function. Again you would expect to see a similar thing inside Electron and we can do
00:01:47things like declare the title, the width and height, set things like the background color and then set
00:01:52things for Mac specifically. So if you do want differences between Mac and Windows that's completely
00:01:57possible. Now if we look inside the front-end here inside source you would actually see all of the
00:02:02React code. So if we look inside app.tsx this is just standard React code except from we're calling
00:02:09APIs that are defined on the Go side. So if we look at this import here API and see its usages across the
00:02:16file you can see we're doing API.onrecording finished, onrecording failed, start recording and that API is
00:02:22automatically generated by Wales. So if we look inside the API itself you can see that all of the core
00:02:27functions are coming from this file here wales.js slash go slash main slash app. Now if we look inside
00:02:33here you can see that this file is automatically generated and we've got Welsh at the top and English
00:02:39and that's because believe it or not the creator of Wales is Welsh. So we've got all these functions
00:02:43here like export video, list sources, request screen access, all the things that you would need for a
00:02:49screen recording tool. So then if we jump over to the Go side here in app.go and then we comment out
00:02:54list sources and then save that file you'll see that suddenly we get an error inside API.ts because now
00:02:59list sources does not exist and this is because we're running wales.dev. So anytime a change happens
00:03:05inside the Go file it automatically re-renders the TypeScript definitions. So if we go back now and then
00:03:11comment this back in you'll see that now the error disappears and then the desktop app actually reloads
00:03:16because all of the changes from the Go side so from the back end automatically recompile and re-render
00:03:23the application. Now let's do some comparisons to see the difference between these three frameworks.
00:03:27First we'll look at bundle size. Wales comes in at 52 megabytes, Torii at 57 megabytes and Electron
00:03:34at no surprise 324 megabytes. Wales and Torii are noticeably smaller here and that's because they do
00:03:41not bundle Chromium so that's pretty much expected. However I would say by using each platform's native
00:03:47web view which is what Wales and Torii do you are more likely to see some platform differences.
00:03:51That is much less of an issue these days but just something to keep in mind. So basically Torii and
00:03:57Wales are going to produce similar artifacts in terms of bundle size because both frameworks are
00:04:02architected in pretty much the same way despite using vastly different technologies under the hood.
00:04:07Now let's take a look at startup time and as with previous videos I've done on desktop apps we're
00:04:12going to launch each of these apps 10 times and then just take the average. Wales comes in at 395
00:04:18milliseconds, Torii at 410 milliseconds and Electron at 350 milliseconds. Now with cold starts where we
00:04:26purge the cash each time Wales gets 2,337, Torii 2,049 and Electron comes in a little bit faster
00:04:34actually at 1,890. Now looking at performance and as with Torii the runtime performance when recording
00:04:40the screen is much better than Electron and that's actually because of our setup where we use the
00:04:45native capture kit from Mac so no data is traveling over the bridge whereas with Electron we record from
00:04:51the web view itself and then pass data to the back end which does come with a little bit of overhead.
00:04:56Technically you could use the native capture kit if you was to write some custom c code with Electron
00:05:02but this is like the default way of doing things with Electron so that's what we're comparing it to
00:05:06today. Now let's take a look at developer experience and this is really where we're going to see the
00:05:11biggest difference. I actually really enjoyed building with Wales however I would say the part of the
00:05:15screen capture was not as easy as with Torii. I had to write objective c code to access capture kit
00:05:21whereas with Torii you could stay completely in Rust and this is because Rust has a big ecosystem of
00:05:28community crates wrapping Apple's native frameworks. So in Torii I just pulled in a crate called screen
00:05:33capture kit and the whole recording API is normal Rust. Go has nothing decent for screen capture kit that I
00:05:39could find but it does have something called C Go which is Go's built-in way for compiling C code.
00:05:44This means with Go you can just write native C in a .m file, expose it as plain C functions and then
00:05:50tell Go which of Apple's frameworks to link against. So this means you end up writing real objective C
00:05:56and calling the same Apple APIs as the Rust crate but this time you own all of the code. That actually
00:06:02ended up being about 450 lines of objective C code which the Rust app just didn't have. So overall I am
00:06:08leaning slightly more towards Torii. The ecosystem around Rust crates is better from what I found
00:06:14but really it does come down to preference. If you like developing it in Go then Wales is a really
00:06:18decent option and if you like Rust then just choose Torii. However if you do pick Wales you may have to
00:06:24write some native code just because the ecosystem isn't as established. Well hopefully you enjoyed this
00:06:29one guys and you can subscribe for more content like this and if you want to see more comparison videos
00:06:33of desktop frameworks like where we compared Dino desktop to Electrobun. I've linked a video right
00:06:39here that you can watch. Otherwise thanks so much for watching. I've been Warren from Betterstack
00:06:43and I'll see you in the next one. And unfortunately guys Milo said no more videos for the week so
00:06:49I'll see you on Monday.
00:06:50*music plays*

Key Takeaway

Wails provides a lightweight Go alternative to Tauri and Electron by using system web views to produce 52 MB binaries, though developers must occasionally write native Objective-C code via CGo due to Go's smaller desktop wrapper ecosystem.

Highlights

  • Wails yields a 52 MB binary for a desktop screen recorder, compared to Tauri at 57 MB and Electron at 324 MB.

  • Unlike Electron's bundled Chromium browser, Wails and Tauri reuse the host platform's native rendering engine.

  • Electron records the screen inside the web view with extra bridge overhead, whereas Wails and Tauri achieve higher runtime performance by interfacing directly with native macOS APIs.

  • Electron achieves faster cold-start launch times at 1,890 ms, outperforming Wails at 2,337 ms and Tauri at 2,049 ms.

  • Building a macOS screen capture feature in Wails required writing 450 lines of Objective-C via CGo due to the lack of Go wrapper libraries for Apple's ScreenCaptureKit.

Timeline

Architecture and Development Workflow of Wails

  • Wails pairs a Go backend with a web view frontend to target macOS and Windows.
  • System-native rendering engines power Wails instead of an embedded Chromium browser.
  • TypeScript API definitions regenerate automatically upon modifying Go backend methods.

Wails operates similarly to Tauri by using Go on the backend while leaving user interface rendering to the operating system's native web view engine. Front-end development relies on standard Web frameworks like React inside a dedicated folder structure. Running the local development server bridges backend Go functions directly to TypeScript, updating client-side definitions and triggering automatic re-renders whenever backend Go files change.

Benchmark Comparison: File Size, Startup Speed, and Performance

  • Wails produces the smallest bundle size at 52 MB.
  • Electron achieves the fastest startup times across warm and cold launches.
  • Direct native API access eliminates the IPC bridge bottleneck present in standard Electron builds.

Testing across frameworks shows Wails leading in bundle size at 52 MB, followed closely by Tauri at 57 MB, while Electron reaches 324 MB due to its bundled Chromium runtime. Electron retains an advantage in launch speed, averaging a 350 ms warm start and a 1,890 ms cold start compared to Wails' 395 ms warm start and 2,337 ms cold start. For screen recording runtime performance, Wails and Tauri achieve higher efficiency by routing video data directly through native OS APIs rather than passing frames across the web view bridge.

Developer Experience and Native System Integration

  • Tauri offers pre-built Rust crates for native macOS frameworks like ScreenCaptureKit.
  • Wails requires bridging Go to native Objective-C code through CGo for unsupported OS APIs.
  • Framework choice depends primarily on language preference between Go and Rust.

Integrating lower-level platform APIs reveals differences in ecosystem maturity. While Tauri developers can import existing community Rust crates to interact with macOS ScreenCaptureKit directly, Go lacks equivalent community packages. Using Wails required writing roughly 450 lines of Objective-C and compiling it through Go's CGo foreign function interface. Developers comfortable with Go get a streamlined desktop framework, but system-level integrations may demand manual native coding.

Community Posts

View all posts