The desktop integration wraps your ChatJS web app in an Electron shell. The Electron process loads your deployed or local app in aDocumentation Index
Fetch the complete documentation index at: https://chatjs.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
BrowserWindow and adds desktop-specific behavior such as deep-link authentication, system tray support, native window chrome, and auto-updates.
Installing a prebuilt release
Prebuilt installers for the ChatJS reference app are published on the GitHub Releases page. Pick your platform below for the install steps.macOS
- Download
ChatJS-mac.dmg(or browse all assets). - Open the
.dmgand drag ChatJS intoApplications. - The first time you launch it, macOS will say the app “cannot be opened because Apple cannot check it for malicious software”. Close that dialog.
- Open System Settings and go to Privacy & Security. Scroll to the Security section. You will see a message about ChatJS being blocked, with an Open Anyway button. Click it.
- Launch ChatJS again and confirm with Open.
Windows
- Download
ChatJS-windows.exe(or browse all assets). - Windows SmartScreen will show a Windows protected your PC dialog because the installer is unsigned.
- Click More info, then Run anyway.
- Complete the installer as usual.
Linux
-
Download
ChatJS-linux.AppImageorChatJS-linux.deb(or browse all assets). -
For the
.AppImage, make it executable and run it: -
For the
.deb, install it withaptor your package manager of choice:
Shipping signed builds
If you are distributing your own fork to end users, see macOS Distribution Notes below for what is required to ship signed and notarized builds so your users do not see these warnings.Scaffold with the CLI
When you runnpx @chat-js/cli@latest create, the CLI asks:
electron/ subfolder into your project:
chat.config.ts.
Development
Start the web app first, then launch Electron:create. If you passed --package-manager npm (or another manager), replace bun above with that manager.
In development, the Electron wrapper points at http://localhost:3000 by default.
Authentication
OAuth redirects cannot return directly to an in-apphttp://localhost page inside Electron. ChatJS uses @better-auth/electron to bridge the browser sign-in flow back into the desktop app with a custom URL scheme and PKCE.
How it works
The main integration points are:- Server:
lib/auth.tsenables the Electron Better Auth plugin - Web client:
lib/auth-client.tshandles the browser-side redirect flow - Electron main:
src/main.tssets up deep-link handling and IPC bridges - Electron preload:
src/preload.tsexposes auth bridges to the renderer
Custom URL Scheme
The desktop auth scheme comes fromappPrefix in chat.config.ts.
Auto-Updates
The desktop integration usesupdate-electron-app with a public GitHub repository. Packaged builds check GitHub Releases for newer versions automatically.
Customization
App icon
Replaceelectron/icon.png with your own 512x512 PNG, then regenerate the platform-specific assets:
App name, scheme, and production URL
Editchat.config.ts in your project root:
branding.json file from those values so the desktop app stays aligned with your web app branding.
Building for Distribution
Build desktop installers from theelectron/ directory:
electron/out/.
- macOS:
.dmgand.zip - Windows:
.exeinstaller - Linux:
.deband.rpm
Release Flow
In the ChatJS monorepo, Changesets is the only release mechanism for both npm packages and desktop artifacts. The release flow is:- Add a changeset that includes
@chat-js/electron - Let the Changesets workflow open the version PR
- Merge that version PR
- The npm release workflow publishes any changed public packages, including
@chat-js/cli - The desktop artifact workflow reads the new
apps/electron/package.jsonversion, builds macOS, Windows, and Linux artifacts, and publishes them to GitHub Releases under the package-scoped tag@chat-js/electron@<version>
@chat-js/clipublishes to npm@chat-js/electronpublishes installers to GitHub Releases
macOS Distribution Notes
For public macOS distribution outside the App Store, you will usually want:- code signing
- notarization
- a stable bundle identifier and install path