Expand description
Node.js native addon for the WebUI framework via napi-rs.
Provides high-performance server-side rendering by compiling the Rust
WebUI handler directly into a .node native addon — no C ABI intermediary.
The render function accepts pre-compiled protobuf protocol data (from
webui build) and streams rendered HTML fragments via a callback, enabling
true streaming SSR without buffering the entire response.
§Usage (from Node.js)
import fs from 'node:fs';
// Load the native addon
const mod = { exports: {} };
process.dlopen(mod, './target/release/libwebui_node.dylib');
const { render } = mod.exports;
// Read pre-compiled protocol (from `webui build`)
const protocol = fs.readFileSync('./dist/protocol.bin');
const state = '{"name": "WebUI"}';
// Stream rendered fragments
render(protocol, state, (chunk) => process.stdout.write(chunk));Structs§
- JsBuild
Options - Build options for the webui build API.
- JsBuild
Result - Result of a successful build operation.
- JsBuild
Stats - Build statistics returned from the build function.
Functions§
- build
- Build a WebUI application from an app directory.
- inspect
- Inspect protocol bytes and return a JSON representation.
- render
- Render a pre-compiled WebUI protocol with JSON state, streaming each fragment to the provided callback.
- render_
component_ templates - render_
partial - Produce a complete JSON partial response for client-side navigation.