Deno 2.9: Introducing deno desktop
Deno 2.9 introduces deno desktop, a new command that transforms TypeScript projects—ranging from single files to full-scale Next.js applications—into self-contained, redistributable desktop binaries. This tool allows developers to bundle the Deno runtime, their application code, and a web rendering engine into a single platform-specific package.
Core Capabilities of deno desktop
deno desktop is designed to address common tradeoffs in desktop application development using web technologies. It provides several key technical advantages:
Framework Auto-Detection
One of the most significant features is the framework auto-detection. deno desktop can automatically identify and run production servers for projects built with Next.js, Astro, Fresh, Remix, Nuxt, SvelteKit, SolidStart, TanStack Start, or Vite SSR. Under the --hmr flag, it enables hot module replacement for a seamless development experience without requiring code changes to existing web projects.
Flexible Rendering Backends
Developers can choose between different rendering backends to balance binary size and rendering consistency:
- WebView Backend: Uses the operating system's native webview for smaller binaries.
- CEF (Chromium Embedded Framework): Bundles Chromium to ensure identical rendering across macOS, Windows, and Linux.
- Raw Backend: A specialized windowing backend designed for WebGPU rendering.
In-Process Bindings
Unlike many desktop frameworks that rely on socket-based Inter-Process Communication (IPC), deno desktop uses in-process channels for communication between the backend and the UI. This removes the cross-process round-trip overhead, although values are still encoded as they cross the call boundary.
Distribution and Maintenance
The tool provides built-in support for cross-compilation from a single machine for macOS, Windows, and Linux. It also includes a binary-diff auto-update system using Deno.autoUpdate(), which utilizes latest.json manifests and bsdiff patches to automatically apply updates and roll back on failed launches.
Getting Started with a Simple Application
Creating a desktop application with deno desktop is designed to be extremely simple. A basic "Hello World" application can be created with a single TypeScript file:
Deno.serve(() =>
new Response("<h1>Hello, desktop</h1>", {
headers: { "content-type": "text/html" },
})
);
To compile this into a binary, run:
deno desktop main.ts
The resulting binary opens a window pointed at a local HTTP server bound to the Deno.serve() handler, removing the need for the developer to manually specify ports or hostnames.
Community Feedback and Technical Considerations
Community discussion on Hacker News has highlighted several critical considerations for developers considering deno desktop:
Binary Size Concerns
Several users reported that the default build (using CEF) can result in very large binaries. One user on Windows 10 reported a "Hello World" app weighing 442 MB, while another on macOS reported 308 MB. However, it was noted that using the --compress flag in the canary build can reduce sizes as low as 15 MB for non-CEF builds.
Comparison to Other Frameworks
Users compared deno desktop to Tauri and Electron. While some noted that the Tauri architecture (Rust backend) is similar to the WebView backend approach, some argued that the deno desktop approach is more accessible because the business logic is written in TypeScript.
Security and Permissions
There is ongoing discussion regarding how deno desktop integrates with Deno's permission system. Currently, permissions granted at compile time are baked into the binary. Some community members suggested that these permissions should be surfaced to the end-user at runtime to allow for more granular control.
Native UI Patterns
Some critics argued that web-based UI toolkits often fail to adopt native OS UX patterns, a common criticism of Electron apps. This remains a challenge for any framework using a web rendering engine regardless of the runtime.
"The reason Electron apps get a lot of flak is because they are everything but a UI toolkit. They consistently miss the mark in adopting UI patterns from their host OS."
Roadmap and Availability
deno desktop is currently available in the canary build (deno upgrade canary) and is slated for a stable release in Deno v2.9.0. The command, configuration keys, and TypeScript APIs may change before the final stable release.