# 0trebor0/nodeviewjs architecture

> Architecture diagram of the GitHub repository 0trebor0/nodeviewjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0trebor0/nodeviewjs
- Repository: https://github.com/0trebor0/nodeviewjs

## Overview

NodeViewJS is a desktop runtime that hosts web apps in the operating system’s WebView and exposes a permission-checked backend command bridge rather than Node.js globals. The main workflow is a page invoking a named command, the runtime authorizing and dispatching it, and the handler returning a response; native window and WebView code host the page and bridge. The README also documents UI, helper, plugin, launch-routing, and update capabilities. Some feature wiring is documented but its implementation was not sampled, so those links cite the README.

Main entry points: [`runtime/app.js`](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/app.js) (App lifecycle), [`runtime/index.js`](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/index.js) (Public API), [`runtime/ipc.js`](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/ipc.js) (IPC protocol), [`src-nodeview/src/window.cpp`](https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/window.cpp) (Native windows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_app["App lifecycle<br/>[app.js]"]
  node_api["Public API<br/>[index.js]"]
  node_validation["Validation<br/>[validation.js]"]
  node_launch["Launch routing<br/>[launch-routing.js]"]
  node_plugin["Backend plugins<br/>[app.js]"]
end

subgraph group_bridge["Bridge and security"]
  node_bridgejs["Frontend bridge<br/>[bridge.js]"]
  node_ipc["IPC protocol<br/>[ipc.js]"]
end

subgraph group_native["Native desktop host"]
  node_nativejs["Native addon loader<br/>[native.js]"]
  node_runtimehost["Native runtime<br/>[app.cpp]"]
  node_window["Native windows<br/>[window.cpp]"]
  node_webview["System WebView<br/>[webview.cpp]"]
end

subgraph group_features["Desktop capabilities"]
  node_data[("App data<br/>[data-directory.js]")]
  node_menu["Menus and shortcuts<br/>[menu.js]"]
  node_network["HTTP client<br/>[net.js]"]
  node_update["Signed updates<br/>[updater.js]"]
  node_helpers["Native helpers<br/>[index.js]"]
  node_packaging["Native packaging<br/>[launcher.cpp]"]
end

node_developer(("App developer"))
node_page(("Web page"))
node_system["Operating system"]
node_http["HTTPS update host"]

node_developer -->|"creates app"| node_app
node_page -->|"invokes commands"| node_bridgejs
node_bridgejs -->|"sends requests"| node_ipc
node_ipc -->|"dispatches commands"| node_app
node_app -->|"registers handlers"| node_ipc
node_app -->|"validates options"| node_validation
node_app -->|"resolves launch config"| node_launch
node_app -->|"starts plugins"| node_plugin
node_api -->|"exports runtime"| node_app
node_api -->|"exports helpers"| node_helpers
node_app -->|"uses native host"| node_nativejs
node_nativejs -.->|"loads addon"| node_runtimehost
node_runtimehost -->|"creates windows"| node_window
node_window -->|"hosts page"| node_webview
node_webview -->|"exchanges messages"| node_ipc
node_app -->|"uses app data"| node_data
node_app -->|"handles menu events"| node_menu
node_api -->|"exports client"| node_network
node_api -->|"exports updater"| node_update
node_network -->|"fetches allowlisted URLs"| node_http
node_update -->|"downloads signed updates"| node_http
node_app -.->|"runs when packaged"| node_packaging
node_window -->|"uses system WebView"| node_system
node_helpers -.->|"accesses desktop services"| node_system

click node_app "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/app.js"
click node_api "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/index.js"
click node_validation "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/validation.js"
click node_launch "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/launch-routing.js"
click node_bridgejs "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/bridge.js"
click node_ipc "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/ipc.js"
click node_nativejs "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/native.js"
click node_runtimehost "https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/app.cpp"
click node_window "https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/window.cpp"
click node_webview "https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/webview.cpp"
click node_plugin "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/app.js"
click node_data "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/data-directory.js"
click node_menu "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/menu.js"
click node_network "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/net.js"
click node_update "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/updater.js"
click node_helpers "https://github.com/0trebor0/nodeviewjs/blob/main/runtime/index.js"
click node_packaging "https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/launcher.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_api,node_validation,node_launch,node_plugin toneBlue
class node_bridgejs,node_ipc toneAmber
class node_nativejs,node_runtimehost,node_window,node_webview toneMint
class node_data,node_menu,node_network,node_update,node_helpers,node_packaging toneRose
class node_developer,node_page,node_system,node_http toneIndigo
```

## Components

### App runtime

- [App lifecycle](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/app.js): `runtime/app.js`
- [Public API](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/index.js): `runtime/index.js`
- [Validation](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/validation.js): `runtime/validation.js`
- [Launch routing](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/launch-routing.js): `runtime/launch-routing.js`
- [Backend plugins](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/app.js): `runtime/app.js`

### Bridge and security

- [Frontend bridge](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/bridge.js): `runtime/bridge.js`
- [IPC protocol](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/ipc.js): `runtime/ipc.js`

### Native desktop host

- [Native addon loader](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/native.js): `runtime/native.js`
- [Native runtime](https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/app.cpp): `src-nodeview/src/app.cpp`
- [Native windows](https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/window.cpp): `src-nodeview/src/window.cpp`
- [System WebView](https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/webview.cpp): `src-nodeview/src/webview.cpp`

### Desktop capabilities

- [App data](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/data-directory.js): `runtime/data-directory.js`
- [Menus and shortcuts](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/menu.js): `runtime/menu.js`
- [HTTP client](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/net.js): `runtime/net.js`
- [Signed updates](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/updater.js): `runtime/updater.js`
- [Native helpers](https://github.com/0trebor0/nodeviewjs/blob/main/runtime/index.js): `runtime/index.js`
- [Native packaging](https://github.com/0trebor0/nodeviewjs/blob/main/src-nodeview/src/launcher.cpp): `src-nodeview/src/launcher.cpp`

### Other components

- **App developer**
- **Web page**
- **Operating system**
- **HTTPS update host**

## Connections

- App developer → App lifecycle: creates app (evidence: `README.md`)
- Web page → Frontend bridge: invokes commands (evidence: `README.md`)
- Frontend bridge → IPC protocol: sends requests (evidence: `README.md`)
- IPC protocol → App lifecycle: dispatches commands (evidence: `README.md`)
- App lifecycle → IPC protocol: registers handlers (evidence: `runtime/app.js`)
- App lifecycle → Validation: validates options (evidence: `runtime/app.js`)
- App lifecycle → Launch routing: resolves launch config (evidence: `runtime/app.js`)
- App lifecycle → Backend plugins: starts plugins (evidence: `runtime/app.js`)
- Public API → App lifecycle: exports runtime (evidence: `runtime/index.js`)
- Public API → Native helpers: exports helpers (evidence: `runtime/index.js`)
- App lifecycle → Native addon loader: uses native host (evidence: `runtime/app.js`)
- Native addon loader → Native runtime: loads addon
- Native runtime → Native windows: creates windows (evidence: `src-nodeview/src/app.cpp`)
- Native windows → System WebView: hosts page
- System WebView → IPC protocol: exchanges messages (evidence: `src-nodeview/src/webview.cpp`)
- App lifecycle → App data: uses app data (evidence: `runtime/app.js`)
- App lifecycle → Menus and shortcuts: handles menu events (evidence: `runtime/app.js`)
- Public API → HTTP client: exports client (evidence: `runtime/index.js`)
- Public API → Signed updates: exports updater (evidence: `runtime/index.js`)
- HTTP client → HTTPS update host: fetches allowlisted URLs (evidence: `README.md`)
- Signed updates → HTTPS update host: downloads signed updates (evidence: `README.md`)
- App lifecycle → Native packaging: runs when packaged
- Native windows → Operating system: uses system WebView (evidence: `README.md`)
- Native helpers → Operating system: accesses desktop services (evidence: `README.md`)
