deno desktop
deno desktop ships in Deno v2.9.0 and is not in a stable release yet. To try
it now, run deno upgrade canary to install the
canary build. The command, configuration
keys, and TypeScript APIs may still change before the feature is stable.
deno desktop compiles a Deno project into a self-contained desktop
application. The output binary bundles your code, the Deno runtime, and a
rendering backend into one redistributable executable per platform.
deno desktop main.ts
deno desktop --hmr main.ts
deno desktop --output MyApp.app main.ts
The entrypoint is optional. A bare deno desktop (or deno desktop .) detects
a supported framework (Next.js, Astro, Fresh, and others) in the current
directory and builds it without any code changes. See
Frameworks.
This page covers the command-line flags. For the full guide (backends,
Deno.BrowserWindow, bindings, auto-update,
DevTools, and distribution) see the Desktop apps section.
Runtime flags Jump to heading
deno desktop accepts the same runtime and permission flags as
deno run. The permissions you grant at compile
time are baked into the compiled binary:
deno desktop --allow-read --allow-net main.ts
Backend Jump to heading
--backend selects the rendering engine. It accepts webview (the default) or
cef. The raw backend is selected through the desktop.backend field in
deno.json. See Backends for the tradeoffs.
deno desktop --backend webview main.ts
Build output Jump to heading
--output (-o) sets the output path; its extension determines the format
(.app, .dmg, .AppImage, and so on):
deno desktop --output ./dist/MyApp.dmg main.ts
Use --icon to set the application icon (.ico on Windows, .icns or .png
on macOS), and --include / --exclude to add or remove files from the
compiled binary. These can also be configured in deno.json; see
Configuration.
Cross-compilation Jump to heading
--target builds for another platform, and --all-targets builds for every
supported platform at once. No platform-specific toolchain is needed on the
host:
deno desktop --target aarch64-apple-darwin main.ts
deno desktop --all-targets main.ts
See Distribution for the supported target triples and output formats.
Development Jump to heading
--hmr runs the app with hot module replacement during development. See
Hot module replacement.
deno desktop --hmr main.ts
The --inspect, --inspect-wait, and --inspect-brk flags attach a debugger
to both the Deno runtime and the renderer. --inspect-renderer overrides the
CEF renderer's debugger listen address. See
DevTools.
Configuration Jump to heading
Most settings can live in the desktop block of deno.json instead of being
passed on every build:
{
"desktop": {
"app": {
"name": "MyApp",
"identifier": "com.example.myapp",
"icons": {
"macos": "./icons/icon.icns",
"windows": "./icons/icon.ico",
"linux": "./icons/icon.png"
}
},
"backend": "cef",
"output": {
"macos": "./dist/macos",
"windows": "./dist/windows",
"linux": "./dist/linux"
},
"release": { "baseUrl": "https://updates.example.com" },
"errorReporting": { "url": "https://errors.example.com/report" }
}
}
For the full schema, see Configuration.