windadd
v0.3.0
Published
Node.js desktop library and CLI for native Windows 10/11 apps powered by WinAPI and WebView2.
Maintainers
Readme
Windadd
Windadd is a Node.js desktop library and CLI for Windows 10/11 apps built with:
- native WinAPI windows
- WebView2 for HTML, CSS, and JavaScript
It is designed to stay simple on the JavaScript side while still talking directly to native Windows APIs.
Requirements
- Windows 10 or Windows 11
- Node.js
>= 20 - x64 Node.js
- WebView2 Runtime installed
Install
npm install windaddWhat Changed In 0.3.0
- the npm package no longer ships a precompiled
Windadd.Host.exe - the native host is compiled locally from
native/Windadd.Host.cs - runtime artifacts are cached in
%LOCALAPPDATA%\Windadd\runtime\<packageVersion>\x64 - old generated projects can be migrated with
windadd repair - the recommended dev-server manifest format now uses
serverExecutable+serverArgs
Quick Start
Create a project:
windadd start-projectRun it:
windadd runCreate a Vite + React + TypeScript project:
windadd start-project --template vite-react-ts
npm install
windadd run --devCLI
Create a project
windadd start-project
windadd start-project --template vite-react-tsRepair an older generated project
windadd repairThis updates the generated src/main.js, normalizes package.json scripts, and migrates the old Vite dev command manifest when it matches the known Windadd scaffold.
Run the current project
windadd run
windadd run --dev
windadd run --url https://example.com
windadd run --file app/index.html
windadd run --entry src/main.js
windadd run --dev --verboseBuild a distributable folder
windadd compileThis produces Dist/ with:
- your project files
- a launcher
.exe node.exewhenbundleNodeis enabled- a local
node_modules/windaddruntime copy
Project Files
windadd start-project creates:
windadd-package.jsonpackage.jsonsrc/main.jssrc/preload.jsassets/
Default template also creates:
app/index.html
Vite template also creates:
web/index.htmlweb/src/*vite.config.tstsconfig.json
package.json Scripts
Generated projects get:
desktopdesktop:devdesktop:builddesktop:repair
The Vite template also adds:
dev:webbuild:web
Manifest
windadd-package.json controls app metadata, startup paths, window defaults, rendering, development mode, and build output.
Example:
{
"name": "Windadd Demo",
"appId": "dev.windadd.demo",
"version": "0.1.0",
"entry": "src/main.js",
"startupDirectory": ".",
"icon": null,
"development": {
"serverExecutable": "npm.cmd",
"serverArgs": ["run", "dev:web"],
"serverUrl": "http://127.0.0.1:5173",
"serverCwd": ".",
"readyTimeoutMs": 30000
},
"window": {
"title": "Windadd Demo",
"width": 1280,
"height": 820,
"minWidth": 960,
"minHeight": 600,
"resizable": true,
"center": true,
"show": true,
"frame": false,
"alwaysOnTop": false,
"roundedCorners": true,
"cornerRadius": 18,
"dragRegionHeight": 40,
"backgroundColor": "#10141b",
"devTools": true,
"file": "web-dist/index.html"
},
"rendering": {
"mode": "balanced",
"allowCpuFallback": true,
"backgroundInitialization": true,
"browserArguments": []
},
"build": {
"outputDirectory": "Dist",
"include": ["src", "assets", "web-dist", "windadd-package.json"],
"subdirectories": true,
"clean": true,
"bundleNode": true
},
"product": {
"executableName": "Windadd Demo"
}
}Development Manifest
Recommended format:
{
"development": {
"serverExecutable": "npm.cmd",
"serverArgs": ["run", "dev:web"],
"serverUrl": "http://127.0.0.1:5173",
"serverCwd": ".",
"readyTimeoutMs": 30000
}
}Legacy compatibility format still supported:
{
"development": {
"serverCommand": "npm run dev:web",
"serverUrl": "http://127.0.0.1:5173"
}
}Public API
Windadd exports:
createApp(options)WindaddAppBrowserWindowWindaddErrorformatErrorReport(error)loadProjectManifest(startDir)startProject(projectDir?, options?)repairProject(projectDir?)runProject(projectDir?, options?)compileProject(projectDir?)
App API
const { createApp } = require('windadd');
const app = createApp({
id: 'dev.windadd.demo',
name: 'Windadd Demo',
userDataDir: 'C:\\apps\\windadd-demo',
rendering: {
mode: 'balanced',
allowCpuFallback: true,
backgroundInitialization: true,
browserArguments: [],
},
});App options
idorappIdnameuserDataDiroruserDataPathrenderingrenderMode
App methods
await app.whenReady()await app.createWindow(options)app.getPath('appData' | 'userData' | 'temp' | 'home')app.setUserDataPath(path)await app.quit()
App events
readybefore-quitquitwindow-createdwindow-all-closedhost-errorhost-stderrerror
BrowserWindow API
const win = await app.createWindow({
title: 'Main Window',
width: 1280,
height: 820,
minWidth: 960,
minHeight: 600,
center: true,
show: true,
frame: false,
roundedCorners: true,
cornerRadius: 18,
dragRegionHeight: 40,
backgroundColor: '#10141b',
devTools: true,
});
await win.loadFile('app/index.html');Window options
titlewidthheightminWidthminHeightresizablecentershowframeframelessroundedCornerscornerRadiusdragRegionHeightalwaysOnTopbackgroundColordevToolsurlfile
Important validation
roundedCorners: truerequiresframe: falseorframeless: truecornerRadiusmust be at least4- runtime
url/fileoverrides can come from CLI flags or the manifest
Window methods
await win.loadURL(url)await win.loadFile(filePath)await win.show()await win.hide()await win.focus()await win.close()await win.setTitle(title)await win.setSize(width, height)await win.setPosition(x, y)await win.center()await win.minimize()await win.maximize()await win.restore()await win.send(channel, data)await win.executeJavaScript(script)win.handle(channel, handler)win.unhandle(channel)win.isDestroyed()
Window events
showncloseclosedresizenavigation-startnavigation-completedom-readycrashmessage
Renderer Bridge
Every loaded page receives window.windadd.
Renderer methods
window.windadd.send(channel, data)window.windadd.on(channel, handler)window.windadd.off(channel, handler)window.windadd.invoke(channel, data)
Example:
<script>
window.windadd.on('host:hello', (data) => {
console.log(data);
});
async function readVersion() {
const result = await window.windadd.invoke('system.version');
console.log(result);
}
window.windadd.send('renderer:ready', {
now: new Date().toISOString()
});
</script>Rendering Modes
rendering.mode supports:
balancedhardwarecpu
Additional rendering fields:
allowCpuFallbackbackgroundInitializationbrowserArguments
Vite + React + TypeScript
Create:
windadd start-project --template vite-react-tsInstall dependencies:
npm installRun dev mode:
windadd run --devBuild frontend and package desktop output:
npm run build:web
windadd compileIf you created the project with an older Windadd version, run:
windadd repairStorage and Runtime Paths
By default, Windadd writes to:
- WebView2 profile data:
%APPDATA%\Windadd\apps\<appId> - native runtime cache:
%LOCALAPPDATA%\Windadd\runtime\<packageVersion>\x64 - temporary launcher source:
%TEMP%\windadd-launcher-*.cs
Environment overrides:
WINDADD_RUNTIME_DIRWINDADD_USER_DATA_DIRWINDADD_RUN_URLWINDADD_RUN_FILEWINDADD_PACKAGE_ROOT
Security and Transparency
- no
preinstall,install, orpostinstallscripts - no hidden telemetry
- no automatic network requests during npm install
- no precompiled
Windadd.Host.exeinside the npm tarball
Useful references:
Error Reporting
Windadd returns structured errors through WindaddError and formatErrorReport(error).
Reports include:
- error code
- message
- source
- request ID when available
- window ID when available
- native details
- stack trace
- best-effort source location
Example:
try {
await app.createWindow({
frame: true,
roundedCorners: true,
});
} catch (error) {
console.error(formatErrorReport(error));
}Notes
- Windadd targets Windows x64.
- Live WebView2 windows require an interactive Windows session.
windadd run --dev --verboseis the fastest way to inspect startup problems.
